smokeping简介:
smokeping是rrdtool的作者Tobi Oetiker的作品,所以它在图形显示方面有很大优势,也是一个很有特点的opensource工具:多种探测方式,包括fping、echoping、dig、curl等;可以在多个节点收集同一个监测点的数据;很有特色的alert设置,不只是简单的设置一个阀值;
Smokeping 是一款用于网络性能监测的监控软件,通过它可以在自己公司IDC的网络状况,如延时,丢包率,是否BGP多线等,通过rrdtool制图方式,图形化地展示网络的时延情况,进而能够清楚的判断出网络的即时通信情况,可以监视www服务器性能,监视dns查询性能,监视ssh性能等
smokeping的优点:
- 最佳的画图功能,延迟和丢包用颜色和阴影表示很直观。
- 免费和开源,作者是MRTG和RRDtool作者。
- 支持主从的分布式模式。
- 可以自定义报警功能。
安装配置smokeping
[root@smokeping ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@smokeping ~]# uname -a
Linux smokeping 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
安装依赖包
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 popt popt-devel libidn libidn-devel
上传下面三个软件
[root@smokeping ~]# ls
echoping-6.0.2.tar.gz fping-3.10.tar.gz smokeping-2.6.10.tar.gz
编译、安装fping和echoping
[root@smokeping ~]# tar xf fping-3.10.tar.gz -C /usr/src/
[root@smokeping ~]# cd /usr/src/fping-3.10/
[root@smokeping fping-3.10]# ./configure
[root@smokeping fping-3.10]# make
[root@smokeping fping-3.10]# make install
[root@smokeping fping-3.10]# tar xf /root/echoping-6.0.2.tar.gz -C /usr/src/
[root@smokeping fping-3.10]# cd ../echoping-6.0.2/
[root@smokeping echoping-6.0.2]# yum -y install popt popt-devel
[root@smokeping echoping-6.0.2]# yum -y install libidn libidn-devel
[root@smokeping echoping-6.0.2]# ./configure && make && make install 如报错:
configure: error: Missing popt library, get it from ftp://ftp.rpm.org/pub/rpm/dist/rpm-x.y.z
解决办法:
yum install -y popt-devel 继续报错:
configure: error: Get the GNU libidn library (http://www.josefsson.org/libidn/) in order to use Unicode - multi-script - domain names or use --without-libidn to disable it
解决办法:
./configure --prefix=/usr/local/echoping --with-ssl --without-libidn 报错:
configure: error: Get the OpenSSL library (http://www.openssl.org/)
解决办法:
yum install -y openssl openssl-devel
安装smokeping
[root@smokeping echoping-6.0.2]# tar xf /root/smokeping-2.6.9.tar.gz -C /usr/src/
[root@smokeping echoping-6.0.2]# cd ../smokeping-2.6.9/
[root@smokeping smokeping-2.6.9]# mkdir -p /usr/local/smokeping/thirdparty
[root@smokeping smokeping-2.6.9]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
[root@smokeping smokeping-2.6.9]# ./configure --prefix=/usr/local/smokeping/
[root@smokeping smokeping-2.6.9]# /usr/bin/gmake install
配置smokeping
[root@smokeping smokeping-2.6.9]# cd /usr/local/smokeping/
[root@smokeping smokeping]# mkdir cache data var
[root@smokeping smokeping]# touch /var/log/smokeping.log
[root@smokeping smokeping]# chown apache:apache cache data var
[root@smokeping smokeping]# chown apache:apache /var/log/smokeping.log
[root@smokeping smokeping]# chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
[root@smokeping smokeping]# cd /usr/local/smokeping/htdocs/
[root@smokeping htdocs]# mv smokeping.fcgi.dist smokeping.fcgi
[root@smokeping htdocs]# cd /usr/local/smokeping/etc/
[root@smokeping etc]# mv config.dist config
[root@smokeping etc]# vim /usr/local/smokeping/etc/config
修改如下:
14 cgiurl = http://192.168.8.30/smokeping.cgi 33 *** Database ***
34
35 step = 60 #建议为60 一分钟采集一次数据
36 pings = 20 #建议为20 每20秒测试一次
109 binary = /usr/local/sbin/fping
编辑Apache配置文件
[root@smokeping etc]# vim /etc/httpd/conf/httpd.conf
ServerName 192.168.8.30 在文件最后加入
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>
调整字体库
图像界面的中文支持
[root@smokeping etc]# yum -y install wqy-zenhei-fonts.noarch
[root@smokeping etc]# vim /usr/local/smokeping/etc/config
50 charset = utf-8 #添加此行 [root@smokeping etc]# vim /usr/local/smokeping/lib/Smokeping/Graphs.pm
148 '--font TITLE:20:"WenQuanYi Zen Hei Mono"', 添加此行
配置测试数据,进行监测
[root@smokeping etc]# vim /usr/local/smokeping/etc/config 在配置文件最后添加: + Other
menu = 三大网络监控
title = 监控统计
++ dianxin
menu = 电信网络监控
title = 电信网络监控列表
host = /Other/dianxin/dianxin-bj /Other/dianxin/dianxin-hlj /Other/dianxin/dianxin-tj /Other/dianxin/dianxin-sc /Other/dianxin/dianxin-sh /Other/dianxin/dianxin-gz
+++ 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 +++ dianxin-sh
menu = 上海电信
title = 上海电信
alerts = someloss
host = 116.228.111.118 +++ dianxin-gz
menu = 广东电信
title = 广东电信
alerts = someloss
host = 113.111.211.22 ++ liantong
menu = 联通网络监控
title = 联通网络监控列表
host = /Other/liantong/liantong-bj /Other/liantong/liantong-hlj /Other/liantong/liantong-tj /Other/liantong/liantong-sc /Other/liantong/liantong-sh /Other/liantong/liantong-gz +++ liantong-bj
menu = 北京联通
title = 北京联通
alerts = someloss
host = 61.135.169.121 +++ liantong-hlj
menu = 黑龙江联通
title = 黑龙江联通
alerts = someloss
host = 202.97.224.69 +++ liantong-tj
menu = 天津联通
title = 天津联通
alerts = someloss
host = 202.99.96.68 +++ liantong-sc
menu = 四川联通
title = 四川联通
alerts = someloss
host = 119.6.6.6 +++ liantong-sh
menu = 上海联通
title = 上海联通
alerts = someloss
host = 210.22.84.3 +++ liantong-gz
menu = 广东联通
title = 广东联通
alerts = someloss
host = 221.5.88.88 ++ yidong
menu = 移动网络监控
title = 移动网络监控列表
host = /Other/yidong/yidong-bj /Other/yidong/yidong-hlj /Other/yidong/yidong-tj /Other/yidong/yidong-sc /Other/yidong/yidong-sh /Other/yidong/yidong-gz +++ yidong-bj
menu = 北京移动
title = 北京移动
alerts = someloss
host = 221.130.33.52 +++ yidong-hlj
menu = 黑龙江移动
title = 黑龙江移动
alerts = someloss
host = 211.137.241.35 +++ yidong-tj
menu = 天津移动
title = 天津移动
alerts = someloss
host = 211.137.160.5 +++ yidong-sc
menu = 四川移动
title = 四川移动
alerts = someloss
host = 218.201.4.3 +++ yidong-sh
menu = 上海移动
title = 上海移动
alerts = someloss
host = 117.131.19.23 +++ yidong-gz
menu = 广东移动
title = 广东移动
alerts = someloss
host = 211.136.192.6
启动服务
[root@smokeping etc]# echo 'export PATH=/usr/local/smokeping/bin/:$PATH' >> /etc/profile
[root@smokeping etc]# /etc/init.d/httpd start
正在启动 httpd: [确定] [root@smokeping etc]# /usr/local/smokeping/bin/smokeping
WARNING: Hostname 'james.address' does currently not resolve to an IPv6 or IPv4 address
Note: logging to syslog as local0/info.
Daemonizing /usr/local/smokeping/bin/smokeping ... #warning可忽略
浏览器访问 http://IP地址/smokeping
效果展示:
最后附上smokeping的图标参数说明: