smokeping网络质量监控部署

前提条件

smokeping依赖于LNMP或者LAMP及rrdtool

安装rrdtool支持

1
2
3
4
5
6
yum -y install libxml2-devel libpng-devel glib pango pango-devel freetypefreetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel perl perl-Net-Telnet perl-Net-DNSperl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6perl-CGI-SpeedyCGI rrdtool-per
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
cd rrdtool-1.4.7
./configure --prefix=/usr/local/rrdtool
make && make install

问题c 1
解决

1
yum -y install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker

安装 smokeping 依赖的软件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
wget http://down1.chinaunix.net/distfiles/cgilib-0.5.tar.gz
tar xzvf cgilib-0.5.tar.gz
cd cgilib-0.5
make
cp libcgi.a /usr/local/lib
cp cgi.h /usr/include/
http://fping.org/dist/fping-3.4.tar.gz
./configure –prefix=/usr/local/fping
make && make install
whereis fping
fping: /usr/local/fping
ln -s /usr/local/fping/sbin/fping /usr/sbin/fping
这个链接是对应/usr/local/smokeping/etc/config里面的probe fping
wget http://ncu.dl.sourceforge.net/project/echoping/echoping/6.0.2/echoping-6.0.2.tar.gz
tar xzvf echoping-6.0.2.tar.gz
cd echoping-6.0.2
./configure
make && make install

问题cc
解决

1
2
3
4
5
6
7
8
9
10
11
12
下载popt-1.14.tar.gz
wget http://downloads.sourceforge.net/project/kanapi/sources/RELEASES/popt-1.14.tar.gz?r=http%3A%2F%2Fen.sourceforge.jp%2Fprojects%2Fsfnet_kanapi%2Fdownloads%2Fsources%2FRELEASES%2Fpopt-1.14.tar.gz%2F&ts=1368433312&use_mirror=jaist
./configure
make && make install
wget http://ftp.gnu.org/gnu/gettext/gettext-0.18.tar.gz
tar zxvf gettext-0.18.tar.gz
cd gettext-0.18
./configure
make && make install
cd ..

安装配置Smokeping

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz
tar zxvf smokeping-2.6.8.tar.gz
cd smokeping-2.6.8
./configure –prefix=/usr/local/smokeping
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
./configure –prefix=/usr/local/smokeping
gmake install
安装完毕,下面修改配置文件。
进入 bin 目录,修改 smokeping 文件
#vim smokeping
第八行: use lib qw(); # PERL5LIB
修改为: use lib qw(/usr/local/rrdtool/lib/perl);
进入 htdocs 目录
# mv smokeping.fcgi.dist smokeping.fcgi
进入 etc 目录
cp config.dist config
修改 config 文件
创建存放数据文件的目录
mkdir c/usr/local/smokeping/data /usr/local/smokeping/var
/usr/local/smokeping/cache
修改 smokeping 的目录为 nginx 运行用户的属主、组
chown -R daemon.daemon smokeping/
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
chmod –R 777 /usr/local/smokeping/cache /usr/local/smokeping/data
/usr/local/smokeping/var
创建 smokeping 的 log 文件
touch /var/log/smokeping.log
chown daemon.daemon /var/log/smokeping.log
启动 smokeping
perl /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log
建立 smokeping 启动脚本,方便启动
vim /etc/init.d/smokeping
添加为以下内容:
#!/bin/bash
#
# chkconfig: 2345 80 05
# Description: Smokeping init.d script
# Hacked by : YunVN - http://www.yunvn.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

给脚本有可执行权限

chmod 755 /etc/rc.d/init.d/smokeping

设置开机启动 smokeping

问题:
启动时出现问题: ccc 解决:yum -y install rrdtool-perl

解决:
https://github.com/geekwolf/sa-scripts/tree/master/config

注释:ping的节点可以适当做些调整

坚持原创分享,您的支持将鼓励我继续创作