Smokeping:它是rrdtool的作者制作的,在图形显示方面很漂亮,可以用来很好的检测网络状态和稳定性,下面简单说一下Smokeping的安装以及配置方法。
0.首先关闭selinux和防火墙 // 这2个可是大坑
sed -i 's/enforcing/disabled/g' /etc/selinux/config setenforce 0 /etc/init.d/iptables stop getenforce //查看Selinux状态 iptables -L -n //查看防火墙状态 service iptables status //查看防火墙状态
1.首先安装LAMP环境
yum install httpd mysql mysql-server php php* php-mysql -y
2.配置PHP
vi /etc/php.ini ## 修改946行的时区 946 date.timezone = PRC
3.安装Smokeping所需的开发包
yum install cairo-devel libxml2-devel pango-devel pangolibpng-develfreetypefreetype-devellibart_lgpl-devel *rrdtool* ruby perl-CPAN http* gcc-c++ gcc* -y
4.安装rrdtool
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz tar zxvf rrdtool-1.4.7.tar.gz cd rrdtool-1.4.7 && ./configure && make && make install
5.安装Smokeping-2.6.8
cd ~ wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz tar zxf smokeping-2.6.8.tar.gz cd smokeping-2.6.8 && ./configure --prefix=/opt/smokeping
注意:到编译Smokeping的时候会提示CGI错误,代码如下,根据代码我们执行红色部分的提示即可
checking checking for gnu make availablility... /usr/bin/gmake is GNU make checking checking for perl module 'RRDs'... Ok checking checking for perl module 'FCGI'... Failed checking checking for perl module 'CGI'... Failed checking checking for perl module 'CGI::Fast'... Failed checking checking for perl module 'Config::Grammar'... Failed checking checking for perl module 'Digest::HMAC_MD5'... Failed checking checking for perl module 'LWP'... Failed ** Aborting Configure ****************************** If you know where perl can find the missing modules, set the PERL5LIB environment variable accordingly. FIRST though, make sure that 'perl' starts the perl binary you want to use for SmokePing. Now you can install local copies of the missing modules by running ./setup/build-perl-modules.sh /opt/smokeping/thirdparty The RRDs perl module is part of RRDtool. Either use the rrdtool package provided by your OS or install rrdtool from source. If you install from source, the RRDs module is located PREFIX/lib/perl
执行./setup/build-perl-modules.sh /opt/smokeping/thirdparty 来解决问题 接着在执行一下编译命令
./configure --prefix=/opt/smokeping
1.)如果出现以下报错 就执行一下 yum install cpan -y
checkingchecking for perl module 'RRDs'... Ok checkingchecking for perl module 'FCGI'... Failed checkingchecking for perl module 'CGI'... Ok checkingchecking for perl module 'CGI::Fast'... Failed checkingchecking for perl module 'Config::Grammar'... Failed checkingchecking for perl module 'Digest::HMAC_MD5'... Ok checkingchecking for perl module 'LWP'... Ok
问题:没有安装 FCGI CGI::Fast等
解决办法:用cpan可以很方便来安装
# perl -MCPAN -e 'install FCGI'
其它未安装的模块,做相应的替换:
# perl -MCPAN -e 'install FCGI'
# perl -MCPAN -e 'install CGI::Fast'
# perl -MCPAN -e 'install Config::Grammar'
如果有揭示未安装cpan,则用yum进行安装
没报错的话就直接安装smokeping
/usr/bin/gmake install
6.安装成功后查看 /opt/smokeping下是不是有bin etc htdocs lib share thirdparty文件
[root@Smokeping smokeping-2.6.8]# ls /opt/smokeping/ bin etc htdocs lib share thirdparty
7.安装fping
cd ~ wget http://www.fping.org/dist/fping-3.5.tar.gz cd fping-3.5 && ./configure && make && make install
8.配置Smokeping
cd /opt/smokeping mkdir data && mkdir cache && mkdir var //创建 data cache var三个目录 chown -R apache.apache /opt/smokeping/ //赋权限 cp etc/config.dist etc/config //复制一个配置文件 cd htdocs/ cp smokeping.fcgi.dist smokeping.fcgi cd /var/www/html ln -s /opt/smokeping/htdocs/ smokeping //在html 目录下建立一个 smokeping的目录软连接 ,此软连接到 /opt/smokeping/htdocs/ 目录下 cd /opt/smokeping/htdocs ln -s /opt/smokeping/cache cache ln -s smokeping.fcgi smokeping.cgi
9.修改Smokeping的配置文件
vi /opt/smokeping/etc/config
把14行的cgiurl = http://some.url/smokeping.cgi 改为自己的IP地址
cgiurl = http://42.51.152.166/smokeping/smokeping.cgi
然后搜素binary 这个地址是等于 fping的地址 不知道fping地址的可以使用whereis fping
106 + FPing 107 108 binary = /usr/local/sbin/fping
接着搜素 Presentation 在48行下面 加入中文的支持
48 *** Presentation *** 49 charset = utf8
在最后一行加入以下代码
148 + yanghongfei ##一级菜单 149 menu = 郑州 ##一级菜单名称 150 title = 郑州 ##一级菜单表头名称 151 152 ++ jinshui 153 menu = 金水 154 title = 金水 155 host = 42.51.51.51 ##指定的主机IP
10.修改配置文件/opt/smokeping/bin/smokeping
vi /opt/smokeping/bin/smokeping 7 use FindBin; 8 use lib qw(usr/local/rrdtool/lib/perl); 9 use lib "$FindBin::Bin/../thirdparty/lib/perl5"; 10 use lib "$FindBin::Bin/../lib";
chmod 600 /opt/smokeping/etc/smokeping_secrets.dist
11.修改 apache 的配置文件
vi /etc/httpd/conf/httpd.conf 402 DirectoryIndex index.html index.php index.html.var //添加index.php的支持 331 Options Indexes FollowSymLinks ExecCGI //添加ExecCGI 796 AddHandler cgi-script .cgi // 注释去掉
12. 开启Smokeping
/opt/smokeping/bin/smokeping start &
13.停止Smokeping
killall smokeping ps -ef | grep smoke kill xxx //进程号
14.注意安装中文语言包
yum groupinstall "Chinese Support"
15.访问测试
http://IP/smokeping/smokeping.cgi
Smokeping的使用:简单说下
1).修改Smokeping的config文件 最低下加入
130 + Test 131 menu= Targets 132 #parents = owner:/Test/James location:/ 133 134 ++ James 135 136 menu = James 137 title =James 138 alerts = someloss 139 slaves = boomer slave2 140 host = james.address 141 142 ++ MultiHost 143 144 menu = Multihost 145 title = James and James as seen from Boomer 146 host = /Test/James /Test/James~boomer 147 148 @include CT-IP.conf
2).在config的同等目录下创建新的文件 CT-IP.conf
CT-IP.conf内容如下:
++ CT menu=全国电信节点 title=全国电信节点 +++ Heilongjiang_CT menu=黑龙江电信 title=黑龙江电信[112.100.1.2] host=112.100.1.2 +++ Yinchuan_CT menu=银川电信 title=银川电信[124.224.254.70] host=124.224.254.70 +++ Jilin_CT menu=吉林电信 title=吉林电信[124.234.3.3] host=124.234.3.3 +++ Sichuan_CT menu=四川电信 title=四川电信[182.151.195.82] host=182.151.195.82 +++ Guangdong_CT menu=广东电信 title=广东电信[183.56.30.50] host=183.56.30.50 +++ Qinghai_CT menu=青海电信 title=青海电信[202.100.151.2] host=202.100.151.2 +++ Hainan-CT menu=海南电信 title=海南电信[202.100.197.50] host=202.100.197.50 +++ Shanxi_CT menu=陕西电信 title=陕西电信[202.100.4.15] host=202.100.4.15 +++ Gansu_CT menu=甘肃电信 title=甘肃电信[202.100.64.68] host=202.100.64.68 +++ Fujian_CT menu=福建电信 title=福建电信[202.101.103.55] host=202.101.103.55 +++ Zhejiang_CT menu=浙江电信 title=浙江电信[61.153.142.45] host=61.153.142.45 +++ Jiangxi_CT menu=江西电信 title=江西电信[202.101.224.69] host=202.101.224.69 +++ Guangxi_CT menu=广西电信 title=广西电信[116.11.32.14] host=116.11.32.14 +++ Jiangsu_CT menu=江苏电信 title=江苏电信[202.97.27.2] host=202.97.27.2 +++ Jiangsu3_CT menu=江苏电信2 title=江苏省无锡市电信[58.214.14.131] host=58.214.14.131 +++ Shanxi2_CT menu=山西电信 title=山西电信[202.97.43.133] host=202.97.43.133 +++ Guizhou_CT menu=贵州电信 title=贵州电信[202.98.192.254] host=202.98.192.254 +++ Beijin_CT menu=北京电信 title=北京电信[180.149.128.2] host=180.149.128.2 +++ Shandong_CT menu=山东电信 title=山东电信[219.146.19.6] host=219.146.19.6 +++ Neimenggu_CT menu=内蒙古电信 title=内蒙古电信[219.148.160.93] host=219.148.160.93 +++ Shenyang_CT menu=沈阳电信 title=沈阳电信[219.148.253.17] host=219.148.253.17 +++ Xizang_CT menu=西藏电信 title=西藏电信[219.151.32.3] host=219.151.32.3 +++ Kunming_CT menu=昆明电信 title=昆明电信[220.165.11.145] host=220.165.11.145 +++ Jiangsu2_CT menu=江苏电信2 title=江苏电信[221.231.191.214] host=221.231.191.214 +++ Tianjin_CT menu=天津电信 title=天津电信[221.238.15.10] host=221.238.15.10 +++ Chongqing_CT menu=重庆电信 title=重庆电信[222.176.3.4] host=222.176.3.4 +++ Hebei_CT menu=河北电信 title=河北电信[27.129.3.5] host=27.129.3.5 +++ Henan_CT menu=河南电信 title=河南电信[222.88.88.88] host=222.88.88.88 +++ Henan2_CT menu=河南电信2 title=河南电信2[219.150.189.5] host=219.150.189.5 +++ Xinjiang_CT menu=新疆电信 title=新疆电信[61.128.114.166] host=61.128.114.166 +++ Hubei2_CT menu=湖北电信2 title=湖北电信2[221.233.144.3] host=221.233.144.3 +++ Hunan_CT menu=湖南电信 title=湖南电信[61.137.3.42] host=61.137.3.42 +++ Shanghai_CT menu=上海电信 title=上海电信[61.152.86.54] host=61.152.86.54 +++ Anhui_CT menu=安徽电信 title=安徽电信[61.191.10.5] host=61.191.10.5 +++ Henan1_CT menu=河南信阳电信 title=河南信阳电信[219.150.236.12] host=219.150.236.12 +++ Henan255_CT menu=河南信阳电信2 title=河南信阳电信2[219.150.236.30] host=219.150.236.30 +++ Henan3_CT menu=河南驻马店电信 title=河南驻马店电信[123.52.207.19] host=123.52.207.19 +++ Henan4_CT menu=河南郑州市电信 title=河南郑州市电信[123.52.0.2] host=123.52.0.2 +++ Henan5_CT menu=河南郑州市电信2 title=河南郑州市电信2[123.52.0.33] host=123.52.0.33 +++ Henan6_CT menu=河南洛阳电信 title=河南洛阳电信[123.52.130.20] host=123.52.130.20 +++ Henan7_CT menu=河南濮阳电信 title=河南濮阳电信[123.52.231.31] host=123.52.231.31 +++ Henan8_CT menu=河南安阳电信 title=河南安阳电信[123.53.0.12] host=123.53.0.12 +++ Henan9_CT menu=河南安阳电信2 title=河南安阳电信2[123.53.0.11] host=123.53.0.11 +++ Henan10_CT menu=河南南阳电信 title=河南南阳电信[123.53.64.151] host=123.53.64.151 +++ Henan11_CT menu=河南漯河电信 title=河南漯河电信[123.55.225.33 ] host=123.55.225.33 +++ Henan12_CT menu=河南周口电信 title=河南周口电信[123.55.201.10] host=123.55.201.10 +++ Henan13_CT menu=河南三门峡电信 title=河南三门峡电信[123.55.181.2] host=123.55.181.2 +++ Henan14_CT menu=河南三门峡电信2 title=河南三门峡电信2[123.55.181.33] host=123.55.181.33 +++ Henan15_CT menu=河南新乡电信 title=河南新乡电信[123.55.79.2] host=123.55.79.2 +++ Henan16_CT menu=河南鹤壁电信 title=河南鹤壁电信[123.55.96.31] host=123.55.96.31 +++ Henan17_CT menu=河南鹤壁电信 title=河南鹤壁电信[123.55.96.4] host=123.55.96.4 +++ Henan18_CT menu=河南开封电信 title=河南开封电信[123.55.136.31] host=123.55.136.31 +++ Henan19_CT menu=河南开封电信2 title=河南开封电信2[123.55.136.5] host=123.55.136.5 +++ Henan20_CT menu=河南焦作电信 title=河南焦作电信[123.54.65.97] host=123.54.65.97 +++ Henan21_CT menu=河南焦作电信2 title=河南焦作电信2[123.54.68.2] host=123.54.68.2 +++ Henan22_CT menu=河南商丘电信 title=河南商丘电信[123.54.43.17] host=123.54.43.17 +++ Henan23_CT menu=河南平顶山电信 title=河南平顶山电信[123.55.32.17 ] host=123.55.32.17 +++ Henan24_CT menu=河南平顶山电信2 title=河南平顶山电信2[123.55.32.8 ] host=123.55.32.8 +++ dianli_CT menu=电力监控 title=电力监控[61.185.46.8] host=61.185.46.8 +++ kehu_CT menu=客户监控 title=客户监控[61.185.45.1] host=61.185.45.1 +++ sike_CT menu=思科监控 title=思科监控[61.185.46.2] host=61.185.46.2 +++ jifei_CT menu=计费监控 title=计费监控[61.185.46.5] host=61.185.46.5 +++ jiang_an_CT menu=郑州景安 title=景安郑州电信 [1.192.125.1] host=1.192.125.1 +++ jiang_an2_CT menu=郑州景安2 title=景安郑州电信2 [171.8.71.218] host=171.8.71.218 +++ test menu=test title=test host=182.116.6.202 +++ foshan_CT menu=广东省佛山市 电信 title=广东省佛山市 电信 [121.9.214.76] host=121.9.214.76 ++ CT2 menu=全国联通节点 title=全国联通节点 +++ Heilongjiang_CT2 menu=黑龙江联通 title=黑龙江联通[61.138.14.50] host=61.138.14.50 +++ Jilin_CT2 menu=吉林联通 title=吉林联通[119.48.221.102] host=119.48.221.102 +++ Sichuan_CT2 menu=四川联通 title=四川联通[119.4.25.8] host=119.4.25.8 +++ Sichuan2_CT2 menu=四川联通2 title=四川联通2[119.6.6.6] host=119.6.6.6 +++ Guangdong_CT2 menu=广东联通 title=广东联通[210.21.196.65] host=210.21.196.65 +++ Qinghai_CT2 menu=青海西宁市联通 title=青海西宁市联通[175.184.128.12] host=175.184.128.12 +++ Qinghai2_CT2 menu=青海西宁市联通2 title=青海西宁市联通2[221.207.12.13] host=221.207.12.13 +++ Hainan_CT2 menu=海南联通 title=海南联通[221.11.154.91] host=221.11.154.91 +++ Zhejiang_CT2 menu=浙江联通 title=浙江联通[124.160.70.4] host=124.160.70.4 +++ Jiangxi_CT2 menu=江西南昌市联通 title=江西南昌市联通[220.248.194.3] host=220.248.194.3 +++ Jiangxi2_CT2 menu=江西南昌市联通2 title=江西南昌市联通2[220.248.194.2] host=220.248.194.2 +++ Guangxi2_CT2 menu=广西南宁市联通2 title=广西南宁市联通2[221.7.244.6] host=221.7.244.6 +++ Jiangsu_CT2 menu=江苏徐州市联通 title=江苏徐州市联通[122.96.112.2 ] host=122.96.112.2 +++ Jiangsu2_CT2 menu=江苏联通2 title=江苏联通2[122.96.112.5] host=122.96.112.5 +++ Shanxi2_CT2 menu=山西联通 title=山西联通[121.30.226.4] host=121.30.226.4 +++ Beijin_CT2 menu=北京联通 title=北京联通[61.135.209.162] host=61.135.209.162 +++ Shandong_CT2 menu=山东联通 title=山东联通[119.164.219.2] host=119.164.219.2 +++ Shandong2_CT2 menu=山东联通2 title=山东联通2[119.164.222.10] host=119.164.222.10 +++ Neimenggu_CT2 menu=内蒙古联通 title=内蒙古联通[116.113.33.134] host=116.113.33.134 +++ Shenyang_CT2 menu=沈阳联通 title=沈阳联通[218.25.53.84] host=218.25.53.84 +++ Jiangsu22_CT2 menu=江苏联通2 title=江苏联通[122.194.203.4] host=122.194.203.4 +++ Tianjin_CT2 menu=天津联通 title=天津联通[117.8.1.2] host=117.8.1.2 +++ Tianjin2_CT2 menu=天津联通2 title=天津联通2[117.8.1.3] host=117.8.1.3 +++ Xinjiang_CT2 menu=新疆联通 title=新疆联通[221.7.0.28] host=221.7.0.28 +++ Xinjiang2_CT2 menu=新疆联通2 title=新疆联通2[221.7.0.62] host=221.7.0.62 +++ Hebei2_CT2 menu=河北联通2 title=河北联通2[202.99.168.14] host=202.99.168.14 +++ Hunan_CT2 menu=湖南联通 title=湖南联通[58.20.32.9] host=58.20.32.9 +++ Hunan2_CT2 menu=湖南联通2 title=湖南联通2[58.20.126.74] host=58.20.126.74 +++ Shanghai_CT2 menu=上海联通 title=上海联通[210.13.80.200] host=210.13.80.200 +++ Anhui_CT2 menu=安徽合肥市联通 title=安徽合肥市联通[58.242.193.98] host=58.242.193.98 +++ Anhui2_CT2 menu=安徽合肥市联通2 title=安徽合肥市联通2[58.242.194.110] host=58.242.194.110 +++ Henan_1_CT2 menu=河南郑州联通 title=河南郑州联通[ 218.28.130.74] host= 218.28.130.74 +++ Henan_13_CT2 menu=河南郑州联通2 title=河南郑州联通2[ 218.29.152.231 ] host= 218.29.152.231 +++ Henan_2_CT2 menu=河南安阳联通 title=河南安阳联通[61.54.219.25] host=61.54.219.25 +++ Henan_3_CT2 menu=河南南阳联通 title=河南南阳联通[ 218.28.87.33 ] host= 218.28.87.33 +++ Henan_23_CT2 menu=河南南阳联通2 title=河南南阳联通2[ 222.142.166.22 ] host= 222.142.166.22 +++ Henan_34_CT2 menu=河南信阳联通 title=河南信阳联通[61.53.192.1] host=61.53.192.1 +++ Henan_5_CT2 menu=河南周口联通 title=河南周口联通[222.136.167.141] host=222.136.167.141 +++ Henan_6_CT2 menu=河南驻马店联通 title=河南驻马店联通[ 218.28.102.198 ] host= 218.28.102.198 +++ Henan_7_CT2 menu=河南驻马店联通2 title=河南驻马店联通2[ 218.28.102.201 ] host= 218.28.102.201 +++ Henan_27_CT2 menu=河南驻马店联通3 title=河南驻马店联通3[ 61.168.234.82 ] host= 61.168.234.82 +++ Henan_8_CT2 menu=河南登封联通 title=河南登封联通[ 218.28.176.146 ] host= 218.28.176.146 +++ Henan_10_CT2 menu=河南新乡联通 title=河南新乡联通[ 61.168.61.222 ] host= 61.168.61.222 +++ Henan_12_CT2 menu=河南洛阳联通 title=河南洛阳联通[ 125.40.242.158 ] host= 125.40.242.158 ++ CT3 menu=全国移动节点 title=全国移动节点 +++ Shanxi_CT3 menu=山西省太原市移动 title=山西省太原市移动[ 211.142.26.30 ] host= 211.142.26.30 +++ Jilin_CT3 menu=吉林省白山市移动 title=吉林省白山市移动[ 211.137.208.3 ] host= 211.137.208.3 +++ Sichuan_CT3 menu=四川省南充市移动 title=四川省南充市移动[ 218.200.168.17 ] host= 218.200.168.17 +++ Anhui_CT3 menu=安徽省蚌埠市移动 title=安徽省蚌埠市[ 211.141.160.5 ] host= 211.141.160.5 +++ Hunan_CT3 menu=湖南省株洲市移动 title=湖南省株洲市[ 211.142.237.17 ] host= 211.142.237.17 +++ Beijing_CT3 menu=北京市移动 title=北京市[ 221.130.253.155 ] host= 221.130.253.155 +++ Xinjiang_CT3 menu=新疆维吾尔自治区乌鲁木齐市移动 title=新疆维吾尔自治区乌鲁木齐市[ 120.205.14.145 ] host= 120.205.14.145 +++ Tianjing_CT3 menu=天津市移动 title=天津市[ 111.31.149.44 ] host= 111.31.149.44 +++ Jiangsu_CT3 menu=江苏省苏州市移动 title=江苏省苏州市[ 211.143.244.11 ] host= 211.143.244.11 +++ Guangdong_CT3 menu=广东省清远市移动 title=广东省清远市[ 218.204.231.187] host= 218.204.231.187 +++ Qinghai_CT3 menu=青海省西宁市移动 title=青海省西宁市[ 218.206.160.190] host= 218.206.160.190 +++ Hainan_CT3 menu=海南省海口市移动 title=海南省海口市[ 211.138.160.234] host= 211.138.160.234 +++ Zhejiang_CT3 menu=浙江省杭州市移动 title=浙江省杭州市[ 211.140.31.78] host= 211.140.31.78 +++ Guangxi_CT3 menu=广西壮族自治区南宁市移动 title=广西壮族自治区南宁市[ 211.138.254.6 ] host= 211.138.254.6 +++ Shandong_CT3 menu=山东省菏泽市移动 title=山东省菏泽市[ 218.201.161.25 ] host= 218.201.161.25 +++ ShangHai_CT3 menu=上海市移动 title=上海市[ 221.130.176.140 ] host=221.130.176.140 +++ AnHui_CT3 menu=安徽省移动 title=安徽省[ 221.130.175.6 ] host=221.130.175.6 +++ FuJian_CT3 menu=福建省漳州市移动 title=福建省漳州市[ 218.207.96.82 ] host=218.207.96.82 +++ HeBei_Qingh_CT3 menu=河北省秦皇岛市移动 title=河北省秦皇岛市[ 218.207.95.4 ] host=218.207.95.4 +++ ChongQing_CT3 menu=重庆市移动 title=重庆市[ 218.207.7.177 ] host=218.207.7.177 +++ YunNan_BaoShan_CT3 menu=云南省保山市移动 title=云南省保山市[ 218.206.46.249 ] host=218.206.46.249 +++ JiangXi_GanZhou_CT3 menu=江西省赣州市移动 title=江西省赣州市[ 218.204.157.77 ] host=218.204.157.77 +++ GanSu_QingYang_CT3 menu=甘肃省庆阳市移动 title=甘肃省庆阳市[ 218.203.169.233] host=218.203.169.233 +++ NingXia_HuiZu_CT3 menu=宁夏回族自治区银川市移动 title=宁夏回族自治区银川市[ 218.203.101.191] host=218.203.101.191 +++ NeiMengGu_CT3 menu=内蒙古自治区巴彦淖尔市移动 title=内蒙古自治区巴彦淖尔市[ 218.202.70.233] host=218.202.70.233 +++ YunNan_DaLi_CT3 menu=云南省大理移动 title=云南省大理[ 218.202.26.58] host=218.202.26.58 +++ Henan1_CT3 menu=河南省洛阳市移动 title=河南省洛阳市移动[ 120.194.44.32 ] host= 120.194.44.32 +++ Henan2_CT3 menu=河南省新乡市移动 title=河南省新乡市[ 221.176.147.41 ] host= 221.176.147.41 +++ Henan22_CT3 menu=河南省新乡市移动2 title=河南省新乡市2[ 11.142.122.121 ] host= 11.142.122.121 +++ Henan3_CT3 menu=河南省驻马店市移动 title=河南省驻马店市[ 120.194.82.11 ] host= 120.194.82.11 +++ Henan4_CT3 menu=河南省周口市移动 title=河南省周口市[ 183.205.177.3 ] host= 183.205.177.3