一、Smokeping 介紹
Smokeping的開發者是Tobi Oetiker,同時也是rrdtool的開發者。而Smokeping在圖形顯示方面就有很大的優勢,也是一個不錯用的opensource
二、安裝設定 :
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
[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
[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
[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
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
配置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");
修改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
修改相關權限
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 啟動權限
5.2 httpd
6 如果顯然圖形有亂碼的話請安裝fonts-chinese