一、说明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的网关,也没有用到主从服务,你们多多交流吧