1、修改163源,并添加rrdtool源:
- cd /etc/yum.repos.d/
- mv CentOS-Base.repo CentOS-Base.repo.bak
- wget http://mirrors.163.com/.help/CentOS-Base-163.repo
- mv CentOS-Base-163.repo CentOS-Base.repo
- echo >> CentOS-Base.repo < "EOF"
- [dag]
- name=Dag RPM Repository for Red Hat Enterprise Linux
- baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
- gpgcheck=1
- gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
- enabled=1
- EOF
- /usr/bin/yum makecache
2、安装Apache:
- yum –y install openssl*
- tar jxvf httpd-2.2.21.tar.bz2
- cd httpd-2.2.21
- ./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --enable-rewrite --enable-deflate
- make && make install
3、安装rrdtool相关:
- yum -y install libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel rrdtool*
4、安装cgilib:
- wget http://down1.chinaunix.net/distfiles/cgilib-0.5.tar.gz
- tar zxvf cgilib-0.5.tar.gz
- cd cgilib-0.5
- make
- cp libcgi.a /usr/local/lib
- cp cgi.h /usr/include
5、安装fping:
- wget http://fping.sourceforge.net/download/fping.tar.gz
- tar zxvf fping.tar.gz
- cd fping-2.4b2_to
- ./configure
- make
- make check
- make install
6、安装echoping:
- wget http://jaist.dl.sourceforge.net/project/echoping/echoping/6.0.0/echoping-6.0.0.tar.gz
- tar zxvf echoping-6.0.0.tar.gz
- cd echoping-6.0.0
- ./configure --without-libidn
- make
- make install
7、安装FCGI:
- wget http://cpan.communilink.net/authors/id/F/FL/FLORA/FCGI-0.74.tar.gz
- tar zxvf FCGI-0.74.tar.gz
- cd cd FCGI-0.74
- perl Makefile.PL
- make && make install
8、安装Apache Dso 扩展:
- wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
- tar zxvf mod_fastcgi-2.4.6.tar.gz
- cd mod_fastcgi-2.4.6
- /usr/local/apache2/bin/apxs -o mod_fastcgi.so -c *.c
- /usr/local/apache2/bin/apxs -i -a -n fastcgi .libs/mod_fastcgi.so
- 修改apache配置文件 :确认有如下一行,没有则添加
- LoadModule fastcgi_module modules/mod_fastcgi.so
9、安装Smokeping:
- wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.6.tar.gz
- tar zxvf tar zxvf smokeping-2.6.6.tar.gz
- cd smokeping-2.6.6
- ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
- ./configure --prefix=/usr/local/smokeping
- gmake install
10、Smokeping配置:
- vi /usr/local/smokeping/bin/smokeping
- 第八行:use lib qw(); # PERL5LIB
- 修改为:use lib qw(/usr/lib/perl5);
- cd /usr/local/smokeping/htdocs
- mv smokeping.fcgi.dist smokeping.fcgi
- cd ../etc
- cp config.dist config
- owner =
- contact =
- mailhost =
- 上面这三个填写联系人,先随便弄弄
- cgiurl = http://192.168.1.101/smokeping.cgi
- 这段是Smokeping的网站地址
- + FPing
- binary = /usr/local/sbin/fping
- 这里修改为本机的FPing的地址
- 创建存放数据文件的目录:
- mkdir /usr/local/smokeping/data /usr/local/smokeping/var /usr/local/smokeping/cache
- chown -R daemon.daemon smokeping/
- chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
- touch /var/log/smokeping.log
- chown daemon.daemon /var/log/smokeping.log
- 启动smokeping
- perl /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log
- 最后Apache加入一个虚拟目录:
- 最后加入
- 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
- Require valid-user
- </Directory>
11、添加被监控机:
- *** Targets ***
- probe = FPing
- menu = Top
- title = Network Latency Grapher
- remark = Welcome to the SmokePing website of xxx Company. \
- Here you will learn all about the latency of our network.
- + lihuipeng
- menu= lihuipeng
- title = lihuipeng
- #parents = owner:/Test/James location:/
- ++ test1
- menu = 192.168.1.102
- title =192.168.1.102
- host = 192.168.1.102
然后重启Smokeping!~
本文转自运维笔记博客51CTO博客,原文链接http://blog.51cto.com/lihuipeng/1040575如需转载请自行联系原作者
lihuipeng