SmokePing安裝手冊
阿新 • • 發佈:2018-01-12
.gz 修改 即時通信 art sed new 貴州 wid log
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-xian /Unicom/Telecom/telecom-shanghai /Unicom/Telecom/telecom-sichuan /Unicom/Telecom/telecom-shenzhen /Unicom/Telecom/telecom-zhejiang /Unicom/Telecom/telecom-changsha /Unicom/Telecom/telecom-wuhan /Unicom/Telecom/telecom-jiangsu /Unicom/Telecom/telecom-chongqing /Unicom/Telecom/telecom-fujian /Unicom/Telecom/telecom-neimeng /Unicom/Telecom/telecom-xinjiang /Unicom/Telecom/telecom-guizhou /Unicom/Telecom/telecom-tianjin /Unicom/Telecom/telecom-hubei /Unicom/Telecom/telecom-beijing
+++ telecom-xian
menu = 西安電信
title = 西安電信
alerts = someloss
host = 61.150.91.55
+++ telecom-shanghai
menu = 上海電信
title = 上海電信
alerts = someloss
host = 180.169.22.226
+++ telecom-sichuan
menu = 四川電信
title = 四川電信
alerts = someloss
host = 211.149.224.160
+++ telecom-shenzhen
menu = 深圳電信
title = 深圳電信
alerts = someloss
host = 183.63.53.120
+++ telecom-zhejiang
menu = 浙江電信
title = 浙江電信
alerts = someloss
host = 122.226.223.82
+++ telecom-changsha
menu = 長沙電信
title = 長沙電信
alerts = someloss
host = 124.232.150.171
+++ telecom-wuhan
menu = 武漢電信
title = 武漢電信
alerts = someloss
host = 59.173.18.243
+++ 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-neimeng
menu = 內蒙電信
title = 內蒙電信
alerts = someloss
host = 101.53.100.113
+++ telecom-xinjiang
menu = 烏魯木齊電信
title = 烏魯木齊電信
alerts = someloss
host = 124.119.87.204
+++ telecom-guizhou
menu = 貴州電信
title = 貴州電信
alerts = someloss
host = 222.87.128.7
+++ telecom-tianjin
menu = 天津電信
title = 天津電信
alerts = someloss
host = 221.238.254.118
+++ telecom-hubei
menu = 十堰電信
title = 十堰電信
alerts = someloss
host = 61.183.41.197
+++ telecom-beijing
menu = 北京電信
title = 北京電信
alerts = someloss
host = 119.90.3.2
++ Mobile
menu = 移動網絡監控
title = 移動網絡監控列表
host = /Unicom/Mobile/mobile-zhejiang /Unicom/Mobile/mobile-shanghai /Unicom/Mobile/mobile-tianjin /Unicom/Mobile/mobile-jinan /Unicom/Mobile/mobile-beijing /Unicom/Mobile/mobile-suzhou /Unicom/Mobile/mobile-wuhan /Unicom/Mobile/mobile-shenyang /Unicom/Mobile/mobile-quanzhou /Unicom/Mobile/mobile-xiamen
+++ mobile-zhejiang
menu = 浙江移動
title = 浙江移動
alerts = someloss
host = 211.140.143.3
+++ mobile-shanghai
menu = 上海移動
title = 上海移動
alerts = someloss
host = 117.135.137.82
+++ mobile-tianjin
menu = 天津移動
title = 天津移動
alerts = someloss
host = 117.131.207.163
+++ mobile-jinan
menu = 濟南移動
title = 濟南移動
alerts = someloss
host = 223.99.238.104
+++ mobile-beijing
menu = 北京移動
title = 北京移動
alerts = someloss
host = 111.13.56.26
+++ mobile-suzhou
menu = 蘇州移動
title = 蘇州移動
alerts = someloss
host = 112.25.230.238
+++ mobile-wuhan
menu = 武漢移動
title = 武漢移動
alerts = someloss
host = 111.47.111.229
+++ mobile-shenyang
menu = 沈陽移動
title = 沈陽移動
alerts = someloss
host = 223.100.7.69
+++ mobile-quanzhou
menu = 泉州移動
title = 泉州移動
alerts = someloss
host = 112.5.16.13
+++ mobile-xiamen
menu = 廈門移動
title = 廈門移動
alerts = someloss
host = 218.207.194.109
++ Unicom
menu = 聯通網絡監控
title = 聯通網絡監控列表
host = /Unicom/Unicom/unicom-dalian /Unicom/Unicom/unicom-beijing /Unicom/Unicom/unicom-jinan /Unicom/Unicom/unicom-shanghai /Unicom/Unicom/unicom-henan /Unicom/Unicom/unicom-heilongjiang /Unicom/Unicom/unicom-tianjin /Unicom/Unicom/unicom-shijiazhuang /Unicom/Unicom/unicom-taiyuan
+++ unicom-dalian
menu = 大連聯通
title = 大連聯通
alerts = someloss
host = 218.61.8.10
+++ unicom-beijing
menu = 北京聯通
title = 北京聯通
alerts = someloss
host = 118.186.222.66
+++ unicom-jinan
menu = 濟南聯通
title = 濟南聯通
alerts = someloss
host = 124.133.28.7
+++ unicom-shanghai
menu = 上海聯通
title = 上海聯通
alerts = someloss
host = 58.246.45.89
+++ 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-shijiazhuang
menu = 石家莊聯通
title = 石家莊聯通
alerts = someloss
host = 110.249.209.130
+++ unicom-taiyuan
menu = 太原聯通
title = 太原聯通
alerts = someloss
host = 221.204.238.54
參考鏈接:
https://chegva.com/528.html
http://www.xuliangwei.com/xubusi/507.html
SmokePing安裝手冊