为了方面大家直接复制命令,冷博客把原文重新排版,把一些#号去掉了 :)
而且这套方法经过冷博客在真机实验的,现在还在运行。
我们在下一篇要谈谈关于perl报错的问题。
开始了~
Installing Smokeping on CentOS 5.5
yum update
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
安装httpd
yum install httpd
安装探针
yum install rrdtool
yum install fping
yum install echoping
yum install curl
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
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.4.1.tar.gz
tar zxvf smokeping-2.4.1.tar.gz
mv smokeping-2.4.1 /opt/smokeping
cd /opt/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 /opt/smokeping/etc/smokeping_secrets
vim /opt/smokeping/bin/smokeping
Replace this:
!/usr/sepp/bin/perl-5.8.4 -wWith This:
-*-perl-*-
use lib qw(/usr/pack/rrdtool-1.2.23-mo/lib/perl);
use lib qw(lib);
use Smokeping 2.004000;
Smokeping::main("etc/config.dist");
!/usr/bin/perl -wReplace this:
-*-perl-*-
use lib qw(/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/RRDs/);
use lib qw(/opt/smokeping/lib);
use Smokeping 2.004000;
Smokeping::main("/opt/smokeping/etc/config");
vim /opt/smokeping/htdocs/smokeping.cgi
!/usr/sepp/bin/speedy -wWith this:
-*-perl-*-
use lib qw(/usr/pack/rrdtool-1.0.33-to/lib/perl);
use lib qw(/home/oetiker/data/projects/AADJ-smokeping/dist/lib);
use CGI::Carp qw(fatalsToBrowser);
use Smokeping 2.004000;
Smokeping::cgi("/home/oetiker/data/projects/AADJ-smokeping/dist/etc/config");
!/usr/bin/speedy -w
-*-perl-*-
use lib qw(/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/RRDs);
use lib qw(/opt/smokeping/lib);
use CGI::Carp qw(fatalsToBrowser);
use Smokeping 2.004000;
Smokeping::cgi("/opt/smokeping/etc/config");
cd /opt/smokeping/htdocs
vim /opt/smokeping/htdocs/tr.cgi
Change this:
!/usr/sepp/bin/speedy-5.8.8 -wTo this:
use strict;
use lib qw(/home/oposs/smokeping/software/lib);
use lib qw(perl);
!/usr/bin/speedy -w
use strict;
use lib qw(/opt/smokeping/lib);
use lib qw(perl);
mkdir -p /var/www/html/smokeping/img /var/www/html/smokeping/script/ /opt/smokeping/data /opt/smokeping/var
chown -R apache:apache /var/www/html/smokeping/img
ln -s /opt/smokeping/htdocs/cropper /var/www/html/smokeping/cropper
ln -s /opt/smokeping/htdocs/resource /var/www/html/smokeping/resource
ln -s /opt/smokeping/htdocs/script/Tr.js /var/www/html/smokeping/script/Tr.js
ln -s /opt/smokeping/htdocs/smokeping.cgi /var/www/html/smokeping/smokeping.cgi
ln -s /opt/smokeping/htdocs/tr.cgi /var/www/html/smokeping/tr.cgi
chmod 4775 /bin/traceroute
vim /etc/httpd/conf/httpd.conf
change > AddHandler cgi-script .cgi
to > AddHandler cgi-script .cgi
Under
change> Options Indexes FollowSymLinks
to > Options Indexes FollowSymLinks ExecCGI
vim /opt/smokeping/etc/basepage.html
Change this:
To this:
vim /opt/smokeping/htdocs/tr.html
Change this:
To this:
SmokeTrace
ln -s /opt/smokeping/htdocs/tr.html /var/www/html/smokeping/tr.html
SmokeTrace
Lets create a basic Config file for Smokeping to get started:
vim /opt/smokeping/etc/config
冷博客按:这个配置文件中,需要把how2centos改成你的地址,还有最后检测的地址那里也要换。
*** General ***Lets create a service startup script for Smokeping
owner = Peter Random
contact = some@address.nowhere
mailhost = my.mail.host
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://www.how2centos.com/smokeping/img
datadir = /opt/smokeping/data
piddir = /opt/smokeping/var
cgiurl = http://www.how2centos.com/smokeping/smokeping.cgi
smokemail = /opt/smokeping/etc/smokemail
tmail = /opt/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
*** Alerts ***
to = alertee@address.somewhere
from = smokealert@company.xy
+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row
*** Database ***
step = 300
pings = 20
# consfn mrhb steps total
AVERAGE 0.5 1 1008
AVERAGE 0.5 12 4320
MIN 0.5 12 4320
MAX 0.5 12 4320
AVERAGE 0.5 144 720
MAX 0.5 144 720
MIN 0.5 144 720
*** Presentation ***
template = /opt/smokeping/etc/basepage.html
+ charts
menu = Charts
title = The most interesting destinations
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
++ max
sorter = Max(entries=>5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
++ loss
sorter = Loss(entries=>5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
++ median
sorter = Median(entries=>5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
+ overview
width = 600
height = 50
range = 10h
+ detail
width = 600
height = 200
unison_tolerance = 2
"Last 3 Hours" 3h
"Last 30 Hours" 30h
"Last 10 Days" 10d
"Last 400 Days" 400d
#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location
*** Probes ***
+ FPing
binary = /usr/sbin/fping
*** Targets ***
menuextra = onclick="window.open(this.href,this.target, \
‘width=800,height=500,toolbar=no,location=no,status=no,scrollbars=no’); \
return false;">(TR)
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.
+ hosts
menu= Targets
++ How2CentOS
menu = How2CentOS.com
title = How2CentOS.com
alerts = someloss
host = www.how2centos.com
++ CentOS
menu = CentOS.org
title = CentOS.org
alerts = someloss
host = www.centos.org
vim /etc/init.d/smokeping
#!/bin/bash
#
# chkconfig: 2345 80 05
# Description: Smokeping init.d script
# Hacked by : How2CentOS – http://www.how2centos.com # Get function from functions library./etc/init.d/functions
# Start the service Smokepingstart() {
echo -n "Starting Smokeping: "
/opt/smokeping/bin/smokeping>/dev/null2>&1
### Create the lock file ###
touch /var/lock/subsys/smokeping
success $"Smokeping startup"
echo
} # Restart the service Smokepingstop() {
echo -n "Stopping Smokeping: "
kill -9 `psax| grep "/opt/smokeping/bin/smokeping" | grep -v grep | awk ‘{ print $1 }’` >/dev/null2>&1
### Now, delete the lock file ###
rm -f /var/lock/subsys/smokeping
success $"Smokeping shutdown"
echo
} ### main logic ###
case "$1" instart)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
Finally lets add Apache and Smokeping to startup and get them started:
# chkconfig smokeping on
# chkconfig httpd on
# service smokeping start
Starting Smokeping: [ OK ]
# service httpd start
Starting httpd: [ OK ]
Now browse to your new installed Smokeping and Smoketrace installation
没有评论:
发表评论