一、說明html
OS:本人使用CentOS-7-x86_64-DVD-1611版本爲系統主機,安裝時選擇最小化Core安裝,linux
IP設置爲:192.168.58.109
apache
帳號設置:root 密碼:smokeping
vim
時區設置爲:Asia/Shanghaibash
若是安裝時時區設置不的正確或者安裝後發現忘記了設置正確的時區可用下面方法修改
網絡
timedatectl set-timezone Asia/Shanghai
hostname SmokePingServer
二、系統安裝後關閉防火牆與selinuxcurl
systemctl stop firewalld.service
vim /etc/selinux/config #SELINUX=enforcing #註釋掉 SELINUX=disable #添加
重啓系統ide
reboot
記得每次重啓系統都要把防火牆掉,我這裏沒有設置都不啓動
測試
安裝網絡時間同步服務ui
yum install ntpdate -y ntpdate times.aliyun.com
安裝依賴包
yum groupinstall "Compatibility libraries" "Base" "Development tools" -y
繼續安裝
yum install -y perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-IO-Socket-SSL perl-Socket6 perl-Time-HiRes perl-ExtUtils-MakeMaker rrdtool rrdtool-perl curl httpd httpd-devel gcc make wget libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel perl-CGI-SpeedyCGI perl-Sys-Syslog popt-devel libidn-devel fping
此時注意,我在安裝時提時有三個包未安裝
No package glib available No package perl-CGI-SpeedyCGI available No package fping available
這三個我發現glib不安裝也沒問題,perl-CGI-SpeedyCGI 下面的步驟中會安裝上,只有fping須要手動安裝
既然下載 都下載了吧
wget http://www.fping.org/dist/fping-4.0.tar.gz wget https://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz wget http://download.openpkg.org/components/cache/echoping/echoping-6.0.2.tar.gz
echoping 我如今還沒用到
安裝fping
tar -xvf fping-4.0.tar.gz cd fping-4.0 ./configure make && make install
安裝echoping
tar -xvf echoping-6.0.2.tar.gz cd echoping-6.0.2 ./configure make && make install
echoping -h / www.baidu.com #測試是否成功安裝 Elapsed time:0.091535 seconds #成功返回信息
下面安裝smokeping
tar xvf smokeping-2.6.11.tar.gz cd smokeping-2.6.11 ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty ./configure --prefix=/usr/local/smokeping
完成後會出現這樣畫面
checking checking for perl module 'FCGI'... Ok checking checking for perl module 'CGI'... Ok checking checking for perl module 'CGI::Fast'... Ok checking checking for perl module 'Config::Grammar'... Ok checking checking for perl module 'Digest::HMAC_MD5'... Ok checking checking for perl module 'Net::Telnet'... Ok checking checking for perl module 'Net::OpenSSH'... Ok checking checking for perl module 'Net::SNMP'... Ok checking checking for perl module 'Net::LDAP'... Ok checking checking for perl module 'Net::DNS'... Ok checking checking for perl module 'IO::Pty'... Ok checking checking for perl module 'LWP'... Ok checking checking for perl module 'RRDs'... Ok checking that generated files are newer than configure... done
主要看這幾個有沒有Failed的,若是有從新安裝,沒有了纔可進行下一步
都OK的會出現這個提示
/usr/bin/gmake install 開始安裝 /usr/bin/gmake install
全部都安裝完成,下面進行配置
cd /usr/local/smokeping/ mkdir cache data var touch /var/log/smkeping.log chown apache:apache cache data var chown apache:apache /var/log/smokeping.log chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist cd /usr/local/smokeping/htdocs mv smokeping.fcgi.dist smokeping.fcgi cd /usr/local/smokeping/etc/ mv config.dist config
apache配置修改
修改主配置文件
vim /etc/httpd/conf/httpd.conf <Directory "/var/www/html"> ==>><Directory "/usr/local/smokeping"> 增長somekping配置 vim /etc/httpd/conf.d/somekping.conf Alias /cache "/usr/local/smokeping/cache/" Alias /cropper "/usr/local/smokeping/htdocs/cropper/" Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi" <Directory "/usr/local/smokeping"> AllowOverride None Options All AddHandler cgi-script .fcgi .cgi Order allow,deny Allow from all DirectoryIndex smokeping.fcgi </Directory> systemctl restart httpd
OK 如今能夠打開頁面了 http://192.168.58.109/smokeping
添加監控內容
vim /usr/local/smokeping/etc/config #cgiurl = http://some.url/smokeping.cgi cgiurl = http://192.168.x.xx/smokeping.cgi #把192.168.x.xx替換成你的smokepingserverIP就好了 ########################################################### #+Test #menu= Targets ##parents = owner:/Test/James localtion:/ # #++ James # #menu = James #title = James #alerts = someloss #slaves = boomer slave2 #host = james.address # #++ MultiHost # #menu = Multihost #title = James and James as seen from Boomer #host = /Test/James /Test/James~boomer ########################################################### #以上幾行能夠直接刪除,也可註釋掉,沒有用,下面添加監控項 ##添加以下數據並保存 + Other menu = 三大網絡監控 title = 監控統計 ++ dianxin menu = 電信網絡監控 title = 電信網絡監控列表 +++ dianxin-bj menu = 北京電信 title = 北京電信 alerts = someloss host = 202.96.199.133 +++ dianxin-hlj menu = 黑龍江電信 title = 黑龍江電信 alerts = someloss host = 219.147.198.242 +++ dianxin-tj menu = 天津電信 title = 天津電信 alerts = someloss host = 219.150.32.132 +++ dianxin-sc menu = 四川電信 title = 四川電信 alerts = someloss host = 61.139.2.69
添加完成後從新啓動smokeping
/usr/local/smokeping/bin/smokeping --config=/usr/local/smokeping/etc/config --logfile=/usr/local/smokeping/var/smokeping.log #設置配置文件與日誌文件位置,完成等會就能夠看到圖了
如今的監控IP是我本身找的,我如今只監控到了我本身的三大ISP的網關,也沒有用到主從服務,你們多多交流吧