環境:CentOS 5.6 x86-64版本 smokeping:2.4.2
相關路徑:
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/RRDs(32位元)
_______________________________________________________________
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/RRDs(64位元)
/usr/local/smokeping/lib
/usr/local/smokeping/etc/config
_______________________________________________________________
↓安裝必要元件↓
先做更新
yum update -y
此處需注意,下載的版本為32還是64位元,請先連回原網站尋找「http://apt.sw.be/redhat/e15/en」
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm (64位元)
yum install httpd -y
yum install rrdtool -y
yum install fping -y
yum install echoping -y
yum install httping -y
yum install curl -y
yum install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI -y
===============================================
↓接著安裝smokeping元件,以下為官網
http://oss.oetiker.ch/smokeping/
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.4.2.tar.gz
tar zxvf smokeping-2.4.2.tar.gz
mv smokeping-2.4.2 /usr/local/smokeping
cd /usr/local/smokeping
===============================================
cd bin/
cp smokeping.dist smokeping
cd ../htdocs/
cp smokeping.cgi.dist smokeping.cgi
cp tr.cgi.dist tr.cgi
cd ../etc/
cp config.dist config
cp basepage.html.dist basepage.html
cp smokemail.dist smokemail
cp tmail.dist tmail
cp smokeping_secrets.dist smokeping_secrets
chmod 600 /usr/local/smokeping/etc/smokeping_secrets
===============================================
接著修改bin下的smokeping執行檔,更換下面三列數值:
數值路徑皆有不同,都先需要至目錄下查看路徑是否正確
以下為例先尋找是否有相關路徑
vi /usr/local/smokeping/bin/smokeping
#!/usr/bin/perl -w
# -*-perl-*-
use lib qw(/usr/pack/rrdtool-1.3.0-rp/lib/perl);
use lib qw(lib);
use strict;
use warnings;
use Smokeping 2.004002;
Smokeping::main("etc/config.dist");
===============================================
#!/usr/bin/perl -w
# -*-perl-*-
use lib qw(/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/RRDs);
use lib qw(/usr/local/smokeping/lib);
use strict;
use warnings;
use Smokeping 2.004002;
Smokeping::main("/usr/local/smokeping/etc/config");
===============================================
下一步驟,修改「htdocs」底下的「smokeping.cgi」的檔案
vi /usr/local/smokeping/htdocs/smokeping.cgi
#!/usr/bin/speedy
# -*-perl-*-
use strict;
use warnings;
use lib qw(/usr/pack/rrdtool-1.3.0-rp/lib/perl);
use lib qw(/home/oetiker/checkouts/smokeping/trunk/software/lib);
use CGI::Carp qw(fatalsToBrowser);
use Smokeping 2.004002;
Smokeping::cgi("/home/oetiker/checkouts/smokeping/trunk/software/etc/config.dist");
=head1 NAME
===============================================
#!/usr/bin/speedy
# -*-perl-*-
use strict;
use warnings;
use lib qw(/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/RRDs);
use lib qw(/usr/local/smokeping/lib);
use CGI::Carp qw(fatalsToBrowser);
use Smokeping 2.004002;
Smokeping::cgi("/usr/local/smokeping/etc/config");
=head1 NAME
=============================================
下一步驟:修改htdocs底下的「tr.cgi」檔案
cd /usr/local/smokeping/htdocs
vi /usr/local/smokeping/htdocs/tr.cgi
!/usr/sepp/bin/speedy-5.8.8 -w
use strict;
use lib qw(/home/oposs/smokeping/software/lib);
use lib qw(perl);
=============================================
#!/usr/bin/speedy -w
use strict;
use lib qw(/usr/local/smokeping/lib);
use lib qw(perl);
=============================================
接著建立相關資料夾檔案
mkdir -p /var/www/html/smokeping/img /var/www/html/smokeping/script/ /usr/local/smokeping/data /usr/local/smokeping/var
變更檔案擁有者
chown -R apache:apache /var/www/html/smokeping/img
=============================================
接著將相對應資料夾做同步/var/www/html/smokeping底下
ln -s /usr/local/smokeping/htdocs/cropper /var/www/html/smokeping/cropper
ln -s /usr/local/smokeping/htdocs/resource /var/www/html/smokeping/resource
ln -s /usr/local/smokeping/htdocs/script/Tr.js /var/www/html/smokeping/script/Tr.js
ln -s /usr/local/smokeping/htdocs/smokeping.cgi /var/www/html/smokeping/smokeping.cgi
ln -s /usr/local/smokeping/htdocs/tr.cgi /var/www/html/smokeping/tr.cgi
修改traceroute 權限
chmod 4775 /bin/traceroute
=============================================
接著修改網頁首頁底下的資訊
vi /etc/httpd/conf/httpd.conf
找到以下行列,並進行取代動作
約略位置778行
change > #AddHandler cgi-script .cgi
to > AddHandler cgi-script .cgi
↑將「#」字號拿掉」
約略位置 320行
Under <Directory “/var/www/html”>
change > Options Indexes FollowSymLinks
to > Options Indexes FollowSymLinks ExecCGI
↑代表使用CGI做網頁使用
=============================================
接著更改SMOKEPING網頁
.menuactive
{ font-size: 10px;
font-family: sans-serif;
}
↑將以上字型改為12px
</STYLE>
<script src="cropper/lib/prototype.js" type="text/javascript"></script>
<script src="cropper/lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
<script src="cropper/cropper.js" type="text/javascript"></script>
<script src="cropper/smokeping-zoom.js" type="text/javascript"></script>
更改成以下四行
<script src="/smokeping/cropper/lib/prototype.js" type="text/javascript"></script>
<script src="/smokeping/cropper/lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
<script src="/smokeping/cropper/cropper.js" type="text/javascript"></script>
<script src="/smokeping/cropper/smokeping-zoom.js" type="text/javascript"></script>
</HEAD>
<BODY bgcolor="white">
<TABLE border="0" cellpadding="10" cellspacing="0">
<TR>
<TD align="left" width="130" valign="top">
<P></P>
<P><B>SmokePing Targets:</B> </P>
將width更改為25%
</HEAD>
<BODY bgcolor="white">
<TABLE border="0" cellpadding="10" cellspacing="0">
<TR>
<TD align="left" width="25%" valign="top">
<P></P>
<P><B>SmokePing Targets:</B> </P>
=============================================
將tr.html 做資料夾同步
ln -s /usr/local/smokeping/htdocs/tr.html /var/www/html/smokeping/tr.html
=============================================
最後更改smokeping設定檔
vi /usr/local/smokeping/etc/config
owner = Peter Random
contact = some@address.nowhere
mailhost = my.mail.host
sendmail = /usr/lib/sendmail
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed ... this is not
# good for images.
imgcache = /home/oetiker/public_html/smokeping-ms/cache
imgurl = cache
datadir = /tmp/smokeping-ms/data
piddir = /tmp/smokeping-ms/var
cgiurl = http://some.url/smokeping.cgi
smokemail = /home/oetiker/checkouts/smokeping/trunk/software/etc/smokemail.dist
tmail = /home/oetiker/checkouts/smokeping/trunk/software/etc/tmail.dist
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no
=============================================
owner = your name
contact = your e-mail address
mailhost = localhost
sendmail = /usr/sbin/sendmail
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed ... this is not
# good for images.
imgcache = /var/www/html/smokeping/img
imgurl = http://x.x.x.x/smokeping/img
datadir = /usr/local/smokeping/data
piddir = /usr/local/smokeping/var
cgiurl = http://x.x.x.x/cgi-bin/smokeping.cgi
smokemail = /usr/local/smokeping/etc/smokemail
tmail = /usr/local/smokeping/etc/tmail
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no
=============================================
約為50行左右
template = /home/oetiker/checkouts/smokeping/trunk/software/etc/basepage.html.dist
template = /usr/local/smokeping/etc/basepage.html
約為110左右
106 + FPing
107
108 binary = /usr/sbin/fping
109
110 *** Slaves ***
111 secrets=/home/oetiker/checkouts/smokeping/trunk/software/etc/smokeping_secrets.dist
112 +boomer
113 display_name=boomer
114 color=0000ff
更改為以下檔案
106 + FPing
107
108 binary = /usr/sbin/fping
109
110 *** Slaves ***
111 secrets=/usr/local/smokeping/etc/smokeping_secrets
112 +boomer
113 display_name=boomer
114 color=0000ff
=============================================
由於使用cgi-bin的關係,因此要將/usr/local/smokepinb/htdocs/底下的smokeping.cgi複製到/var/www/cgi-bin
cd /usr/local/smokeping/htdocs
cp smokeping.cgi /var/www/cgi-bin
建立腳本
touch /etc/init.d/smokeping
最後建立一個script,將以下資料貼上
vi /etc/init.d/smokeping
=============================================
#!/bin/bash
#
# chkconfig: 2345 80 05
# Description: Smokeping init.d script
# Get function from functions library
. /etc/init.d/functions
# Start the service Smokeping
start() {
echo -n "Starting Smokeping: "
/usr/local/smokeping/bin/smokeping >/dev/null 2>&1
### Create the lock file ###
touch /var/lock/subsys/smokeping
success $"Smokeping startup"
echo
}
# Restart the service Smokeping
stop() {
echo -n "Stopping Smokeping: "
kill -9 `ps ax | grep "/usr/local/smokeping/bin/smokeping" | grep -v grep | awk '{ print $1 }'` >/dev/null 2>&1 && killall speedy_backend
### Now, delete the lock file ###
rm -f /var/lock/subsys/smokeping
success $"Smokeping shutdown"
echo
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status Smokeping
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
=============================================
再給予適當權限
chmod 755 /etc/init.d/smokeping
chkconfig httpd on
chkconfig smokeping on
service httpd restart
service smokeping restart
最後關閉apache 測試網頁
cat > /var/www/html/index.html
=============================================
留言列表