一、Smokeping 介紹
Smokeping的開發者是Tobi Oetiker,同時也是rrdtool的開發者。而Smokeping在圖形顯示方面就有很大的優勢,也是一個不錯用的opensource
二、系統配置 :
Centos 5.6
rrdtool-1.4.5
fping
CGI-SpeedyCGI-2.22
libwww-perl-6.02
smokeping-2.4.2
三、安裝設定 :
1.安裝相關套件
由於Smokeping是用perl所寫的程序,所以是不需要安裝。也正因為是用perl所寫,因此需要使用到一些工具像是rrdtool、fping、libwww-perl等,以及perl的module。都是需要先安裝好,當Smokeping服務啟動時會自動簡查所需要的程序是否都安裝完成。
1.1相關套件
[root@localhost ~]# yum -y install gcc gcc-c++ libxml* pango* httpd* perl* freetype-devel zlib-devel libpng-devel libart_lgpl-devel apr-util-devel apr-devel |
1.2 安裝rrdtool (http://oss.oetiker.ch/rrdtool)
[root@localhost ~]# yum -y install libart_lgpl-devel zlib-devel libpng-devel freetype-devel cairo-devel libxml2-devel pango-devel dejavu-lgc-fonts* pango* freetype* [root@localhost ~]# cd /opt/ [root@localhost ~]# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz [root@localhost ~]# tar -zxvpf rrdtool-1.4.5.tar.gz [root@localhost ~]# cd rrdtool-1.4.5 [root@localhost ~]# ./configure -prefix=/usr/local/ [root@localhost ~]# make [root@localhost ~]# make install [root@localhost ~]# whereis rrdtool rrdtool: /usr/local/bin/rrdtool #安裝完成後的路徑 |
1.3 安裝fping (http://fping.sourceforge.net)
[root@localhost ~]# cd /opt/ [root@localhost ~]# wget http://fping.sourceforge.net/download/fping.tar.gz [root@localhost ~]# tar -zxvpf fping.tar.gz [root@localhost ~]# cd fping-2.4b2_to [root@localhost ~]# ./configure [root@localhost ~]# make [root@localhost ~]# make install [root@localhost ~]# whereis fping fping: /usr/local/sbin/fping |
1.4 安裝CGI-SpeedyCGI
(http://www.cpan.org/modules/by-authors/id/H/HO/HORROCKS)
[root@localhost ~]# cd /opt/ [root@localhost ~]# wget http://www.cpan.org/modules/by-authors/id/H/HO/HORROCKS/CGI-SpeedyCGI-2.22.tar.gz [root@localhost ~]# tar -zxvpf CGI-SpeedyCGI-2.22.tar.gz [root@localhost ~]# cd CGI-SpeedyCGI-2.22 [root@localhost ~]# perl Makefile.PL Optional mod_speedycgi support. Mod_speedycgi increases performance under Apache by avoiding the fork/exec overhead associated with each request under normal SpeedyCGI. However, it requires a working copy of "apxs" in your path, Apache with mod_so support, and additional Apache configuration. Compile mod_speedycgi (default no)? no [root@localhost ~]# make [root@localhost ~]# make install |
1.5安裝Perl modules libwww-perl
[root@localhost ~]# cd /opt/ [root@localhost ~]# wget http://cpan.cdpa.nsysu.edu.tw/authors/id/G/GA/GAAS/libwww-perl-6.02.tar.gz [root@localhost ~]# tar -zxvpf libwww-perl-6.02.tar.gz [root@localhost ~]# cd libwww-perl-6.02 [root@localhost ~]# perl Makefile.PL [root@localhost ~]# make [root@localhost ~]# make install |
2. 配置Smokeping
[root@localhost ~]# cd /opt/ [root@localhost ~]# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.4.2.tar.gz [root@localhost ~]# tar -zxvpf smokeping-2.4.2.tar.gz [root@localhost ~]# mv smokeping-2.4.2 /usr/local/smokeping |
2.1 新增cache和data資料夾
[root@localhost ~]# mkdir -p /usr/local/smokeping/cache [root@localhost ~]# mkdir -p /usr/local/smokeping/data |
2.2 修改smokeping (請把白色的改為黃色)
[root@localhost ~]# cp /usr/local/smokeping/bin/smokeping.dist /usr/local/smokeping/bin/smokeping [root@localhost ~]# vim /usr/local/smokeping/bin/smokeping use lib qw(/usr/pack/rrdtool-1.3.0-rp/lib/perl); use lib qw(/usr/lib/perl5); use lib qw(lib); use lib qw(/usr/local/smokeping/lib); Smokeping::main("etc/config.dist"); Smokeping::main("/usr/local/smokeping/etc/config"); |
2.3 修改config (請把白色的改為黃色)
[root@localhost ~]# cp /usr/local/smokeping/etc/config.dist /usr/local/smokeping/etc/config [root@localhost ~]# vim /usr/local/smokeping/etc/config imgcache = /home/oetiker/public_html/smokeping-ms/cache imgcache = /usr/local/smokeping/cache imgurl = cache imgurl = http://本機IP/cache datadir = /tmp/smokeping-ms/data datadir = /usr/local/smokeping/data piddir = /tmp/smokeping-ms/var piddir = /usr/local/smokeping/data cgiurl = http://some.url/smokeping.cgi cgiurl = http://本機IP/smokeping smokemail = /home/oetiker/checkouts/smokeping/trunk/software/etc/smokemail.dist smokemail = /usr/local/smokeping/etc/smokemail.dist tmail = /home/oetiker/checkouts/smokeping/trunk/software/etc/tmail.dist tmail = /usr/local/smokeping/etc/tmail.dist template = /home/oetiker/checkouts/smokeping/trunk/software/etc/basepage.html.dist template = /usr/local/smokeping/etc/basepage.html.dist binary = /usr/sbin/fping binary = /usr/local/sbin/fping secrets=/home/oetiker/checkouts/smokeping/trunk/software/etc/smokeping_secrets.dist secrets=/usr/local/smokeping/etc/smokeping_secrets.dist |
2.4 修改smokeping.cgi (請把白色的改為黃色)
[root@localhost ~]# cp /usr/local/smokeping/htdocs/smokeping.cgi.dist /usr/local/smokeping/htdocs/smokeping [root@localhost ~]# vim /usr/local/smokeping/htdocs/smokeping use lib qw(/usr/pack/rrdtool-1.3.0-rp/lib/perl); use lib qw(/usr/lib/perl5/); use lib qw(/home/oetiker/checkouts/smokeping/trunk/software/lib); use lib qw(/usr/local/smokeping/lib); Smokeping::cgi("/home/oetiker/checkouts/smokeping/trunk/software/etc/config.dist"); Smokeping::cgi("/usr/local/smokeping/etc/config"); |
3. 修改httpd.conf
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf #在httpd.conf裡的最下面加入以下 ScriptAlias /smokeping "/usr/local/smokeping/htdocs/smokeping" alias /cache "/usr/local/smokeping/cache" <Directory "/usr/local/smokeping/htdocs"> AllowOverride None AddHandler cgi-script cgi Options ExecCGI </Directory> |
4. 修改相關權限
4.1 修改smokeping_secrets.dist 權限為400
[root@localhost ~]# chmod 400 /usr/local/smokeping/etc/smokeping_secrets.dist |
4.2修改Smokeping 資料夾權限為apache
[root@localhost ~]# chown -R apache.apache /usr/local/smokeping |
4.3修改Smokeping 啟動權限
[root@localhost ~]# chmod 755 /usr/local/smokeping/bin/smokeping |
5. 啟動 停止 重啟服務
5.1 smokeping
#啟動smokeping [root@localhost ~]# /usr/local/smokeping/bin/smokeping start #重新啟動smokeping [root@localhost ~]#/usr/local/smokeping/bin/smokeping --restart#直接運行一次看是否有錯 [root@localhost ~]# /usr/local/smokeping/bin/smokeping --debug #確認smokeping的smokeping設定檔是否有問題 [root@localhost ~]# /usr/local/smokeping/bin/smokeping --check #設定開機自動開啟服務 [root@localhost ~]# vi /etc/rc.d/rc.local /usr/local/smokeping/bin/smokeping start #加入此行 #查看服務是否有起來 [root@localhost ~]# ps -ef|grep smokeping |
如果在啟動smokeping服務時出現類似此錯誤時「Can't locate RRDs.pm in @INC…」
請參考此篇「smokeping Can't locate RRDs.pm in @INC 錯誤處理」
5.2 httpd
[root@localhost ~]# /etc/init.d/httpd start #啟動網頁服務httpd [root@localhost ~]# chkconfig httpd on #開機自動啟動 |
有關config和Alerts設定說明。可以參考「smokeping 新增監控與警報設定」
6.訪問網頁
http://ip或網址/smokeping
看到以下畫面表示正常沒問題。
以下畫面為smokeping的相關截圖
6.1 如果顯然圖形有亂碼的話請安裝fonts-chinese
[root@localhost ~]# yum -y install fonts-chinese |
評論
此文章尚無評論。