Smokeping 简介:
Smokeping 是 rrdtool 的作者 Tobi Oetiker 的作品,是用 Perl 写的,主 要是监视网络性能,包括常规的 ping,用 echoping 监控 www 服务器性能, 监视 dns 查询性能,监视 ssh 性能等。底层也是 rrdtool 做支持,特点是画的 图非常漂亮,网络丢包和延迟用颜色和阴影来表示。 1.2 Smokeping 架构组件 Smokeping 有以下组件组成:RRDtool、Fping、Echoping、Curl、Dig、 SSh、Perl 模块,Perl、SpeedyCGI、Apache 等。 master/slave 的工作方式,可以在多个节点收集同一个监测点的数据;
安装smokeping需要的依赖软件包
[root@smokeping-server ~]# yum install rrdtool rrdtool-perl gettext-devel.x86_64 perl-CGI.x86_64 perl-CPAN perl-devel perl-libwww-perl httpd httpd-devel httpd-server -y
安装fping软件
[root@smokeping-server ~]# tar zxvf fping-3.8.tar.gz -C /usr/src/
[root@smokeping-server ~]# cd /usr/src/fping-3.8/
[root@smokeping-server fping-3.8]# ./configure
[root@smokeping-server fping-3.8]# make
[root@smokeping-server fping-3.8]# make install
安装popt软件
[root@smokeping-server ~]# wget http://jaist.dl.sourceforge.net/project/cross-stuff/cross-stuff/1.0/popt-1.7.tar.gz
[root@smokeping-server ~]# tar zxvf popt-1.7.tar.gz -C /usr/src/
[root@smokeping-server ~]# cd /usr/src/popt-1.7/
[root@smokeping-server popt-1.7]# ./configure
[root@smokeping-server popt-1.7]# make
[root@smokeping-server popt-1.7]# make install
安装libidn软件
[root@smokeping-server ~]# wget -c http://pkgs.fedoraproject.org/repo/pkgs/libidn/libidn-1.26.tar.gz/7533d14fbbb6c026a1a9eaa2179ccb69/libidn-1.26.tar.gz
[root@smokeping-server ~]# tar zxvf libidn-1.26.tar.gz -C /usr/src/
[root@smokeping-server ~]# cd /usr/src/libidn-1.26/
[root@smokeping-server libidn-1.26]# ./configure
[root@smokeping-server libidn-1.26]# make
[root@smokeping-server libidn-1.26]# make install
安装echoping软件
[root@smokeping-server ~]# wget http://jaist.dl.sourceforge.net/project/echoping/echoping/6.0.2/echoping-6.0.2.tar.gz
root@smokeping-server ~]# tar zxvf echoping-6.0.2.tar.gz -C /usr/src/
[root@smokeping-server ~]# cd /usr/src/echoping-6.0.2/
[root@smokeping-server echoping-6.0.2]# ./configure
[root@smokeping-server echoping-6.0.2]# make
[root@smokeping-server echoping-6.0.2]# make install
安装FLORA
[root@smokeping-server ~]# wget -c http://search.cpan.org/CPAN/authors/id/F/FL/FLORA/FCGI-0.74.tar.gz
[root@smokeping-server ~]# tar zxvf FCGI-0.74.tar.gz -C /usr/src/
[root@smokeping-server ~]# cd /usr/src/FCGI-0.74/
[root@smokeping-server FCGI-0.74]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for FCGI
[root@smokeping-server FCGI-0.74]# make
[root@smokeping-server FCGI-0.74]# make install
安装Config-Crammar
[root@smokeping-server ~]# tar zxvf Config-Grammar-1.10.tar.gz -C /usr/src/
[root@smokeping-server ~]# cd /usr/src/Config-Grammar-1.10/
[root@smokeping-server Config-Grammar-1.10]# perl Makefile.PL
[root@smokeping-server Config-Grammar-1.10]# make
[root@smokeping-server Config-Grammar-1.10]# make install
安装Digest
[root@smokeping-server ~]# wget -c http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/Digest-HMAC-1.03.tar.gz
[root@smokeping-server ~]# tar zxvf Digest-HMAC-1.03.tar.gz -C /usr/src/
[root@smokeping-server ~]# cd /usr/src/Digest-HMAC-1.03/
[root@smokeping-server Digest-HMAC-1.03]# perl Makefile.PL
[root@smokeping-server Digest-HMAC-1.03]# make && make install
安装smokeping
[root@smokeping-server ~]# wget -c http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
[root@smokeping-server ~]# tar zxvf smokeping-2.6.9.tar.gz -C /usr/src/
[root@smokeping-server ~]# cd /usr/src/smokeping-2.6.9/
[root@smokeping-server smokeping-2.6.9]# ./configure --prefix=/usr/local/smokeping
PS:在这里执行“./configure~~~”之后,如果报错,则会提示相关内容如下,我们直接
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty,这条命令执行成功之后,再次执行“./configure~~~即可解决
[root@smokeping-server smokeping-2.6.9]# /usr/bin/gmake install
到此为止!我们这些软件包都安装完成,接下来,进行配置 并启动即可!
修改smokeping主配置文件
[root@smokeping-server smokeping-2.6.9]# cd /usr/local/smokeping/
[root@smokeping-server smokeping]# ls
bin etc htdocs lib share
[root@smokeping-server smokeping]# mkdir cache var data #在smokeping安装路径下创建三个目录
[root@smokeping-server smokeping]# cd /usr/local/smokeping/htdocs/
[root@smokeping-server htdocs]# cp smokeping.fcgi.dist smokeping.fcgi #复制作为备份
[root@smokeping-server htdocs]# ls
cropper smokeping.fcgi smokeping.fcgi.dist
[root@smokeping-server htdocs]# cd /usr/local/smokeping/etc/
[root@smokeping-server etc]# ls
basepage.html.dist config.dist examples smokemail.dist smokeping_secrets.dist tmail.dist
[root@smokeping-server etc]# cp config.dist config #拷贝配置文件做备份
[root@smokeping-server etc]# ln -s /usr/local/smokeping/cache/ /usr/local/smokeping/htdocs/cache
[root@smokeping-server etc]# chown -R apache:apache /usr/local/smokeping/
[root@smokeping-server etc]# chmod -R 755 /usr/local/smokeping/cache/ /usr/local/smokeping/var/ /usr/local/smokeping/data/
修改配置文件config
[root@smokeping-server etc]# sed -i 's#binary = /usr/sbin/fping#binary = /usr/local/sbin/fping#g' /usr/local/smokeping/etc/config
[root@smokeping-server etc]# sed -i 's#cgiurl = http://some.url/smokeping.cgi#cgiurl = http://192.168.2.1336/smokeping.cgi#g' config | grep cgiurl
[root@smokeping-server etc]# sed -i 's#step = 300#step = 60#g' /usr/local/smokeping/etc/config
[root@smokeping-server etc]# sed -i 's#pings = 20#pings = 60#g' /usr/local/smokeping/etc/config
修改httpd配置文件
[root@smokeping-server ~]#cat > /etc/httpd/conf.d/smokeping.conf <<EOF
NameVirtualHost *:80
<VirtualHost *:80>
ServerName 192.168.2.136
DocumentRoot /usr/local/smokeping/htdocs
ErrorLog logs/smokeping_error.log
CustomLog logs/smokeping_access.log common
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
Alias /cache "/usr/local/smokeping/cache"
Alias /cropper "/usr/local/smokeping/htdocs/cropper"
<Directory /usr/local/smokeping>
AllowOverride None
AddHandler cgi-script cgi fcgi
Options ExecCGI
Order allow,deny
Allow from all
AuthName "Smokeping Access"
AuthType Basic
AuthUserFile /usr/local/smokeping/etc/htpasswd.users
Require valid-user
Satisfy Any
</Directory>
</VirtualHost>
EOF
[root@smokeping-server etc]# htpasswd -c /usr/local/smokeping/etc/htpasswd.users smokepingadmin
[root@smokeping-server etc]# /etc/init.d/httpd start
[root@smokeping-server etc]# perl /usr/local/smokeping/bin/smokeping --logfile=/usr/local/smokeping/var/log/smokeping.log
[root@smokeping-server ~]# vim /etc/init.d/smokeping
[root@smokeping-server ~]# chmod +x /etc/init.d/smokeping
[root@smokeping-server ~]# ll /etc/init.d/smokeping
-rwxr-xr-x. 1 root root 2110 8月 6 16:44 /etc/init.d/smokeping