SmokePing安装手册

SmokePing安装部署

SmokePing简介

Smokeping是一款用于网络性能监测的开源监控软件,主要用于对IDC的网络状况,网络质量,稳定性等做检测,通过rrdtool制图方式,图形化地展示网络的时延情况,进而能够清楚的判断出网络的即时通信情况。

SmokePing的特点

SmokePing keeps track of your network latency:

  • Best of breed latency visualisation.(最佳图形展示功能,延时丢包等可以很直观的可视化展现)
  • Interactive graph explorer.(交互式浏览器图表)
  • Wide range of latency measurement plugins.(丰富的网络状况测量插件)
  • Master/Slave System for distributed measurement.(支持主从的分布式部署模式)
  • Highly configurable alerting system.(自定义报警功能)
  • Live Latency Charts with the most 'interesting' graphs.(漂亮、免费、开源)
  • Free and OpenSource Software written in Perl written by Tobi Oetiker, the creator of MRTG and RRDtool
SmokePing安装
[root@linux-node1 ~]# cat /etc/redhat-release  #查看系统环境
CentOS Linux release 7.2.1511 (Core) 
[root@linux-node1 ~]# uname -r
3.10.0-327.18.2.el7.x86_64

[root@linux-node1 ~]# 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-CGI-SpeedyCGI perl-FCGI perl-ExtUtils-MakeMaker 
rrdtool rrdtool-perl curl fping echoping 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 freetype freetype-devel    #安装所需包

[root@linux-node1 ~]# cd /usr/local/src
[root@linux-node1 src]# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz #下载smokeping
[root@linux-node1 src]# tar xf smokeping-2.6.11.tar.gz    #解压
[root@linux-node1 src]# cd smokeping-2.6.11
[root@linux-node1 smokeping-2.6.11]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty #远程下东东,需要点时间,需要build都ok,不然编译会报错
[root@linux-node1 smokeping-2.6.11]# ./configure --prefix=/usr/local/smokeping    #编译

Ready to install Smokeping ******************************

Settings:

    PERL5LIB = not set
    PERL = /usr/bin/perl

The Smokeping Makefiles use GNU make functionality.
Continue installation with

    /usr/bin/gmake install
#出现这个提示就可以用gmake安装了
[root@linux-node1 smokeping-2.6.11]# /usr/bin/gmake install   #安装
#出现错误 Can't locate Sys/Syslog.pm in @INC (@INC contains: /usr/local/smokeing/thirdparty/lib/perl5/x86_64-linux-thread-multi /usr/local/smokeing/thirdparty/lib/perl5 ../lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ../lib/Smokeping.pm line 16.
[root@linux-node1 smokeping-2.6.11]# yum -y install perl-Sys-Syslog   #缺包了,安装这个就OK
[root@linux-node1 smokeping-2.6.11]# cd /usr/local/smokeping/   #进入smokeping安装目录
[root@linux-node1 smokeping-2.6.11]# mkdir cache data var  #创建所需文件夹
[root@linux-node1 smokeping-2.6.11]# touch /var/log/smokeping.log  #创建日志文件
[root@linux-node1 smokeping-2.6.11]# chown apache.apache cache data var /var/log/smokeping.log  #修改文件属主
[root@linux-node1 smokeping]# cd htdocs
[root@linux-node1 htdocs]# mv smokeping.fcgi.dist smokeping.fcgi     #修改文件名
[root@linux-node1 htdocs]# mv /usr/local/smokeping/etc/config.dist /usr/local/smokeping/etc/config   #添加配置文件
[root@linux-node1 htdocs]# chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist    #密码配置文件只让root能访问
修改smokeping配置文件
[root@linux-node1 ~]# sed -i 's#cgiurl   = http://some.url/smokeping.cgi#cgiurl   = http://192.168.182.152/smokeping.cgi#g' /usr/local/smokeping/etc/config    
[root@linux-node1 ~]# sed -i 's#300#60#g' /usr/local/smokeping/etc/config    #改为60,一分钟采集一次数据
[root@linux-node1 ~]# sed -i 's#20#60#g' /usr/local/smokeping/etc/config     #改为一分钟ping60次
[root@linux-node2 ~]# vim /usr/local/smokeping/etc/config          #添加utf-8中文字符集支持
*** Presentation ***
charset = utf-8
[root@linux-node1 ~]# egrep "cgiurl|\<60\>|utf-8" /usr/local/smokeping/etc/config   #查看修改的配置
cgiurl   = http://192.168.56.11/smokeping.cgi   
step     = 60   #一分钟采集一次数据
pings    = 60
charset = utf-8
修改apache配置文件
[root@linux-node1 htdocs]# htpasswd -c /usr/local/smokeping/htdocs/htpasswd luchuangao
New password: 
Re-type new password: 
Adding password for user luchuangao    #设置登陆密码

[root@linux-node1 htdocs]# vim /etc/httpd/conf/httpd.conf 
# DocumentRoot "/var/www/html" #在这行下面添加
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
AuthName "Smokeping" #登陆密码认证配置
AuthType Basic
AuthUserFile /usr/local/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi
</Directory>
创建Smokeping启动脚本
[root@linux-node1 etc]# cat /etc/init.d/smokeping 
#!/bin/bash
#
# chkconfig: 2345 80 05
# Description: Smokeping init.d script
# Hacked by : How2CentOS - http://www.how2centos.com
# Get function from functions library
. /etc/init.d/functions
# Start the service Smokeping
start() {
        echo -n "Starting Smokeping: "
        /usr/local/smokeping/bin/smokeping >/dev/null 2>&1
        ### Create the lock file ###
        touch /var/lock/subsys/smokeping
        success $"Smokeping startup"
        echo
}
# Restart the service Smokeping
stop() {
        echo -n "Stopping Smokeping: "
        kill -9 `ps ax | grep "/usr/local/smokeping/bin/smokeping" | grep -v grep | awk '{ print $1 }'` >/dev/null 2>&1
        ### Now, delete the lock file ###
        rm -f /var/lock/subsys/smokeping
        success $"Smokeping shutdown"
        echo
}
### main logic ###
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
status)
        status smokeping
        ;;
restart|reload|condrestart)
        stop
        start
        ;;
*)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac
exit 0

[root@linux-node1 etc]# chmod 755 /etc/init.d/smokeping
启动服务访问smokeping
[root@linux-node1 ~]# systemctl start httpd.service    #启动apache
[root@linux-node1 ~]# /etc/init.d/smokeping start     #启动smokeping

在浏览器输入http://192.168.5182.152/smokeping,输入之前设定的密码:
效果展示,略!

中文支持及添加监控节点
如果需要展示界面支持中文,需要安装中文编码:
[root@linux-node1 etc]# yum -y install wqy-zenhei-fonts.noarch
[root@linux-node1 etc]# vi /usr/local/smokeping/lib/Smokeping/Graphs.pm

for my $host (@hosts){
            my ($graphret,$xs,$ys) = RRDs::graph
            ("dummy",
            '--start', $tasks[0][1],
            '--end', $tasks[0][2],
            '--font TITLE:20:"WenQuanYi Zen Hei Mono"', #添加这行即可


vim /usr/local/smokeping/etc/config 
#添加监测源的IP库,加入到config中,修改后重启smokeping才会生效
#添加监控节点示例:注意+是第一层,++是第二层,+++ 是第三层

+ Unicom

menu = 各地网络连通性监控
title = 监控统计

++ Telecom
menu = 电信网络监控
title = 电信网络监控列表
host = /Unicom/Telecom/telecom-beijing /Unicom/Telecom/telecom-shanghai /Unicom/Telecom/telecom-shenyang /Unicom/Telecom/telecom-sichuan /Unicom/Telecom/telecom-changsha /Unicom/Telecom/telecom-jiangsu /Unicom/Telecom/telecom-chongqing /Unicom/Telecom/telecom-fujian /Unicom/Telecom/telecom-guizhou /Unicom/Telecom/telecom-hubei /Unicom/Telecom/telecom-chengdu /Unicom/Telecom/telecom-xinjiang /Unicom/Telecom/telecom-wuhan /Unicom/Telecom/telecom-hangzhou /Unicom/Telecom/telecom-xiamen /Unicom/Telecom/telecom-guangzhou /Unicom/Telecom/telecom-shenzhen /Unicom/Telecom/telecom-nanning /Unicom/Telecom/telecom-beijingxinlang /Unicom/Telecom/telecom-beijingDNS /Unicom/Telecom/telecom-shanghaixinlang /Unicom/Telecom/telecom-shanghaiDNS

+++ telecom-beijing
menu = 北京电信
title = 北京电信
alerts = someloss
host = 220.181.22.1

+++ telecom-beijingxinlang
menu = 北京新浪电信
title = 北京新浪电信
alerts = someloss
host = 218.30.114.37

+++ telecom-beijingDNS
menu = 北京电信DNS
title = 北京电信DNS
alerts = someloss
host = 219.141.136.10

+++ telecom-shanghaixinlang
menu = 上海新浪电信
title = 上海新浪电信
alerts = someloss
host = 222.73.28.96

+++ telecom-shanghaiDNS
menu = 上海电信DNS
title = 上海电信DNS
alerts = someloss
host = 202.96.199.133

+++ telecom-shanghai
menu = 上海电信
title = 上海电信
alerts = someloss
host = 61.129.65.58

+++ telecom-shenyang
menu = 沈阳电信
title = 沈阳电信
alerts = someloss
host = 219.148.204.66

+++ telecom-sichuan
menu = 四川电信
title = 四川电信
alerts = someloss
host = 211.149.224.160

+++ telecom-changsha
menu = 长沙电信
title = 长沙电信
alerts = someloss
host = 124.232.150.171

+++ telecom-jiangsu
menu = 江苏电信
title = 江苏电信
alerts = someloss
host = 58.215.186.208

+++ telecom-chongqing
menu = 重庆电信
title = 重庆电信
alerts = someloss
host = 219.153.71.238

+++ telecom-fujian
menu = 福建电信
title = 福建电信
alerts = someloss
host = 218.6.9.4

+++ telecom-guizhou
menu = 贵州电信
title = 贵州电信
alerts = someloss
host = 222.87.128.7

+++ telecom-hubei
menu = 十堰电信
title = 十堰电信
alerts = someloss
host = 61.183.41.197

+++ telecom-chengdu
menu = 成都电信
title = 成都电信
alerts = someloss
host = 61.139.2.69

+++ telecom-xinjiang
menu = 新疆电信
title = 新疆电信
alerts = someloss
host = 61.128.114.133

+++ telecom-wuhan
menu = 武汉电信
title = 武汉电信
alerts = someloss
host = 221.232.129.35

+++ telecom-hangzhou
menu = 杭州电信
title = 杭州电信
alerts = someloss
host = 202.96.96.68

+++ telecom-xiamen
menu = 厦门电信
title = 厦门电信
alerts = someloss
host = 202.101.103.54

+++ telecom-guangzhou
menu = 广州电信
title = 广州电信
alerts = someloss
host = 211.136.192.6

+++ telecom-shenzhen
menu = 深圳电信
title = 深圳电信
alerts = someloss
host = 202.96.154.15

+++ telecom-nanning
menu = 南宁电信
title = 南宁电信
alerts = someloss
host = 202.103.224.68


++ Mobile
menu = 移动网络监控
title = 移动网络监控列表
host =  /Unicom/Mobile/mobile-beijing /Unicom/Mobile/mobile-shenyang /Unicom/Mobile/mobile-jinan /Unicom/Mobile/mobile-qingdao /Unicom/Mobile/mobile-chengdu /Unicom/Mobile/mobile-xizang /Unicom/Mobile/mobile-xiamen /Unicom/Mobile/mobile-changsha /Unicom/Mobile/mobile-nanjing /Unicom/Mobile/mobile-guangzhou /Unicom/Mobile/mobile-shenzhen

+++ mobile-beijing
menu = 北京移动
title = 北京移动
alerts = someloss
host = 211.136.17.107

+++ mobile-shenyang
menu = 沈阳移动
title = 沈阳移动
alerts = someloss
host = 211.137.32.178

+++ mobile-jinan
menu = 济南移动
title = 济南移动
alerts = someloss
host = 211.137.191.26

+++ mobile-qingdao
menu = 青岛移动
title = 青岛移动
alerts = someloss
host = 202.102.128.68

+++ mobile-chengdu
menu = 成都移动
title = 成都移动
alerts = someloss
host = 202.98.96.68

+++ mobile-xizang
menu = 西藏移动
title = 西藏移动
alerts = someloss
host = 211.139.73.34

+++ mobile-xiamen
menu = 厦门移动
title = 厦门移动
alerts = someloss
host = 218.207.194.109

+++ mobile-changsha
menu = 长沙移动
title = 长沙移动
alerts = someloss
host = 211.142.236.87

+++ mobile-nanjing
menu = 南京移动
title = 南京移动
alerts = someloss
host = 221.131.143.68

+++ mobile-guangzhou
menu = 广州移动
title = 广州移动
alerts = someloss
host = 211.136.192.6

+++ mobile-shenzhen
menu = 深圳移动
title = 深圳移动
alerts = someloss
host = 120.196.165.7

++ Unicom
menu = 联通网络监控
title = 联通网络监控列表
host =  /Unicom/Unicom/unicom-beijing /Unicom/Unicom/unicom-dalian /Unicom/Unicom/unicom-henan /Unicom/Unicom/unicom-heilongjiang /Unicom/Unicom/unicom-tianjin /Unicom/Unicom/unicom-shanghai /Unicom/Unicom/unicom-shenyang /Unicom/Unicom/unicom-xian /Unicom/Unicom/unicom-jinan /Unicom/Unicom/unicom-qingdao /Unicom/Unicom/unicom-xinjiang /Unicom/Unicom/unicom-xizang /Unicom/Unicom/unicom-wuhan /Unicom/Unicom/unicom-zhengzhou /Unicom/Unicom/unicom-changsha /Unicom/Unicom/unicom-nanjing /Unicom/Unicom/unicom-xiamen /Unicom/Unicom/unicom-taiyuan /Unicom/Unicom/unicom-guangzhou /Unicom/Unicom/unicom-shenzhen /Unicom/Unicom/unicom-nanning

+++ unicom-beijing
menu = 北京联通
title = 北京联通
alerts = someloss
host = 123.125.46.202

+++ unicom-dalian
menu = 大连联通
title = 大连联通
alerts = someloss
host = 218.61.8.10

+++ unicom-henan
menu = 河南联通
title = 河南联通
alerts = someloss
host = 125.46.54.236

+++ unicom-heilongjiang
menu = 黑龙江联通
title = 黑龙江联通
alerts = someloss
host = 125.211.202.138

+++ unicom-tianjin
menu = 天津联通
title = 天津联通
alerts = someloss
host = 60.28.24.236

+++ unicom-shanghai
menu = 上海联通
title = 上海联通
alerts = someloss
host = 211.95.72.254

+++ unicom-shenyang
menu = 沈阳联通
title = 沈阳联通
alerts = someloss
host = 113.224.187.254

+++ unicom-xian
menu = 西安联通
title = 西安联通
alerts = someloss
host = 124.89.76.214

+++ unicom-jinan
menu = 济南联通
title = 济南联通
alerts = someloss
host = 202.102.152.3

+++ unicom-qingdao
menu = 青岛联通
title = 青岛联通
alerts = someloss
host = 202.102.128.68

+++ unicom-xinjiang
menu = 新疆联通
title = 新疆联通
alerts = someloss
host = 221.7.1.20

+++ unicom-xizang
menu = 西藏联通
title = 西藏联通
alerts = someloss
host = 221.13.65.38

+++ unicom-wuhan
menu = 武汉联通
title = 武汉联通
alerts = someloss
host = 218.104.111.122

+++ unicom-zhengzhou
menu = 郑州联通
title = 郑州联通
alerts = someloss
host = 218.28.199.235

+++ unicom-changsha
menu = 长沙联通
title = 长沙联通
alerts = someloss
host = 58.20.127.238

+++ unicom-nanjing
menu = 南京联通
title = 南京联通
alerts = someloss
host = 221.6.4.66

+++ unicom-xiamen
menu = 厦门联通
title = 厦门联通
alerts = someloss
host = 36.248.249.1

+++ unicom-taiyuan
menu = 太原联通
title = 太原联通
alerts = someloss
host = 221.204.238.54

+++ unicom-guangzhou
menu = 广州联通
title = 广州联通
alerts = someloss
host = 210.21.4.130

+++ unicom-shenzhen
menu = 深圳联通
title = 深圳联通
alerts = someloss
host = 210.21.196.6

+++ unicom-nanning
menu = 南宁联通
title = 南宁联通
alerts = someloss
host = 221.7.128.68

参考链接:
https://chegva.com/528.html
http://www.xuliangwei.com/xubusi/507.html

转载于:https://www.cnblogs.com/luchuangao/p/8277262.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值