Linux下构建Smokeping网络监控平台(2)

2.3安装Fping和Echoping
[root@smokeping bin]# cd /root/smokeping/
[root@smokeping smokeping]# tar -zxvf fping.tar.gz -C /usr/local/src/
[root@smokeping smokeping]# cd /usr/local/src/fping-2.4b2_to/
[root@smokeping fping-2.4b2_to]# ./configure
[root@smokeping fping-2.4b2_to]# make && make install
[root@smokeping fping-2.4b2_to]# ln -s /usr/local/fping/sbin/fping /usr/sbin/fping
[root@smokeping fping-2.4b2_to]#cd /root/smokeping/
[root@smokeping smokeping]#tar -zxvf echoping-6.0.2.tar.gz -C /usr/local/src/
[root@smokeping smokeping]#cd /usr/local/src/echoping-6.0.2
[root@smokeping echoping-6.0.2]# ./configure
[root@smokeping echoping-6.0.2]# make && make install
2.4 安装cgilib和SpeedyCGI
[root@smokeping echoping-6.0.2]# cd /root/smokeping/
[root@smokeping smokeping]# tar -zxvf cgilib-0.5.tar.gz -C /usr/local/src/
[root@smokeping smokeping]# cd /usr/local/src/cgilib-0.5/
[root@smokeping cgilib-0.5]# ls
cgi.5           cgiGetCookies.3    cgiRedirect.3   cookies.txt
cgi.c           cgiGetValue.3      cgiSetHeader.3  CREDITS
cgiDebug.3      cgiGetVariables.3  cgiSetType.3    jumpto.c
cgiFree.3       cgi.h              cgitest.c       Makefile
cgiFreeList.3   cgiHeader.3        CHANGES         readme
cgiGetCookie.3  cgiInit.3          cookies.c
[root@smokeping cgilib-0.5]#
[root@smokeping cgilib-0.5]# make
[root@smokeping cgilib-0.5]# cp libcgi.a /usr/local/lib
[root@smokeping cgilib-0.5]# cp cgi.h /usr/include/
[root@smokeping cgilib-0.5]# cd /root/smokeping/
[root@smokeping smokeping]# tar -zxvf CGI-SpeedyCGI-2.22.tar.gz -C /usr/local/src/
[root@smokeping smokeping]# cd /usr/local/src/CGI-SpeedyCGI-2.22/
[root@smokeping CGI-SpeedyCGI-2.22]# ls
COPYING   Makefile.PL  contrib  mod_speedycgi   speedy_backend  util
Changes   README       docs     mod_speedycgi2  speedy_dump
MANIFEST  README.html  lib      speedy          src
[root@smokeping CGI-SpeedyCGI-2.22]# perl Makefile.PL
[root@smokeping CGI-SpeedyCGI-2.22]# make
[root@smokeping CGI-SpeedyCGI-2.22]# make install
2.5 安装Perl模块
以下全是Smokeping 需要的perl 模块。
[root@smokeping CGI-SpeedyCGI-2.22]# cd
[root@smokeping ~]# yum install -y perl-libwww-perl perl-IO-Socket-SSL perl-Net-Telnet perl-Socket6 perl-Net-DNS perl-LDAP perl-libwww-perl perl-IO-Socket-SSL
2.6 安装Smokeping
[root@smokeping ~]# cd /root/smokeping/
[root@smokeping smokeping]# tar -zxvf smokeping-2.4.2.tar.gz -C /usr/local/src/
[root@smokeping smokeping]#mv /usr/local/src/smokeping-2.4.2/ /usr/local/smokeping
三. Smokeping 初始化配置
3.1修改smokeping相关文件名
在smokeping的子目录中会发现很多“*.dist”命名的文件,这些文件使用的时候请将其改名为“*”并进行配置
[root@smokeping ~]# cd /usr/local/smokeping/
[root@smokeping smokeping]# ls
[root@smokeping smokeping]# cp -a bin/smokeping.dist bin/smokeping
[root@smokeping smokeping]# cp -a htdocs/smokeping.cgi.dist htdocs/smokeping.cgi
[root@smokeping smokeping]# cp -a etc/config.dist etc/config
3.2建立相关目录
接着建立三个目录用于保存smokeping的数据等,如下所示:
[root@smokeping ~]# mkdir /usr/local/smokeping/data
[root@smokeping ~]# mkdir /usr/local/smokeping/var
[root@smokeping ~]# mkdir /usr/local/smokeping/cache
[root@smokeping ~]# yum install -y httpd
[root@smokeping ~]# chown -R apache.apache /usr/local/smokeping
3.3修改配置文件
(1)/usr/local/smokeping/etc/config (somkeping配置基本都在这个文件上)
*** General ***
owner    = xjzhujunjie
contact  = xjzhujunjie@
mailhost = my.mail.host
sendmail = /usr/lib/sendmail

imgcache = /usr/local/smokeping/cache
imgurl   = cache
datadir  = /usr/local/smokeping/data
piddir  = /usr/local/smokeping/var
cgiurl   = = /usr/local/smokeping/etc/smokemail.dist
tmail = /usr/local/smokeping/etc/tmail.dist
*** Presentation ***
template = /usr/local/smokeping/etc/basepage.html.dist
+ charts
+ FPing
binary = /usr/sbin/fping##修改为实际路径
binary = /usr/local/sbin/fping
把#*** Slaves ***下的所有东西注释掉,这里暂时不采用master/slave模式。
#*** Slaves ***
#secrets=/home/oetiker/checkouts/smokeping/trunk/software/etc/smokeping_secrets.dist
#+boomer
#display_name=boomer
#color=0000ff
#+slave2
#display_name=another
#color=00ff00
在Targets下添加监控节点,其中Multi也就是在一张图里画多个监测点的数值:
+ Telecom
menu= TeleCom
title = 21ViaNet(China)Telecom
++ xjzhujunjie
menu = xjzhujunjie
title = xjzhujunjie-server
host = 192.168.101.82
++ JiLin
menu = JiLin
title = JiLin_219.149.194.1
host = 219.149.194.1
++ TeleComMulti
menu = TeleMulti
title = 21ViaNet(China) Telecom Network
host = /Telecom/HeiLJ /Telecom/JiLin
(2)/usr/local/smokeping/htdocs/smokeping.cgi注意修改如下内容即可
[root@smokeping ~]# vim /usr/local/smokeping/htdocs/smokeping.cgi
use lib qw(/usr/local/rrdtool/lib/perl);
use lib qw(/usr/local/smokeping/lib);

Smokeping::cgi("/usr/local/smokeping/etc/config");
(3)/usr/local/smokeping/bin/smokeping注意修改如下内容即可:
use lib qw(/usr/local/rrdtool/lib/perl);
use lib qw(/usr/local/smokeping/lib);

Smokeping::main("/usr/local/smokeping/etc/config");

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3e723762f05304a6467df38a3d64aa45.html