useradd -s /sbin/nologon apache
安装软件包
tar xf apr-1.4.2.tar.bz2
cd apr-1.4.2
./configure --prefix=/usr/local/apr
make
make install
tar xf apr-util-1.3.10.tar.gz
cd apr-util-1.3.10
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install
tar xf httpd-2.2.17.tar.bz2
cd httpd-2.2.17
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make
make install
tar xf rrdtool-1.4.3.tar.gz
cd rrdtool-1.4.3
sed -i 's/setlocale(LC_NUMERIC, "C")/setlocale(LC_NUMERIC, "zh_CN.UTF-8")/g' src/rrd_graph.c
./configure --prefix=/usr/local/rrdtool
make
make install
tar xf smokeping-2.4.2.tar.gz
mv smokeping-2.4.2 /usr/local/smokeping
mkdir /usr/local/smokeping/{cache,var}
sed -i 's/^User daemon/User apache/1;s/^Group daemon/Group apache/1' /usr/local/apache/conf/httpd.conf
将下列内容添加到/usr/local/apache/conf/httpd.conf中,使smokeping与apache相关联。
Alias /smokeping/ "/usr/local/smokeping/"
AllowOverride None
AddHandler cgi-script cgi
Options ExecCGI
Order allow,deny
Allow from all
DirectoryIndex smokeping.cgi
owner = apache
contact = kylin@7oyx.com
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 = /usr/local/smokeping/cache
imgurl = ../cache
datadir = /usr/local/smokeping/var
piddir = /usr/local/smokeping/var
cgiurl = http://ip/smokeping/htdocs/smokeping.cgi
smokemail = /usr/local/smokeping/etc/smokemail.dist
tmail = /usr/local/smokeping/etc/tmail.dist
*** Probes ***
+ FPing
binary = /usr/sbin/fping
以下添加相关监控内容(如要显示中文在title后面敲入中文即可):
+ WT
menu= WT
title = WT
alerts = someloss
++ WangTong-1
menu = WangTong-1
title = 网通-1_192.168.0.11
host = 192.168.0.11
...
.....
[size=+0]1、 etc/init.d/下编辑一个smokeping的文件
#!/bin/sh
#
# Description: start/stop script for smokeping
# Autor: Michel Tokic
#
# the path to your PID file
PIDFILE=/usr/local/smokeping/var/smokeping.pid
# path to smokeping script
SMOKEPING=/usr/local/smokeping/bin/smokeping.dist
ERROR=0
RUNNING=0
ARGV="$@"
if [ "x$ARGV" = "x" ] ; then
ARGS=help
fi
for ARG in $@ $ARGS
do
if [ -f $PIDFILE ] ; then
PID=`cat $PIDFILE`
if kill -0 $PID 2>/dev/null ; then
# smokeping is running
RUNNING=1
else
# smokeping not running but PID file exists => delete PID file
rm -f $PIDFILE
RUNNING=0
fi
else
# smokeping (no pid file) not running
RUNNING=0
fi
case $ARG in
start)
if [ $RUNNING -eq 0 ] ; then
if $SMOKEPING > /dev/null; then
echo "$0 $ARG: smokeping started"
else
echo "$0 $ARG: smokeping could not be started"
ERROR=1
fi
else
echo "$0 $ARG: smokeping is running with PID $PID"
ERROR=2
fi
;;
stop)
if [ $RUNNING -eq 1 ] ; then
if kill $PID ; then
echo "$0 $ARG: smokeping ($PID) stopped"
rm $PIDFILE
else
fi
else
echo "$0 $ARG: smokeping not running"
ERROR=4
fi
;;
if $SMOKEPING --restart > /dev/null; then
echo "$0 $ARG: smokeping restarted"
else
echo "$0 $ARG: smokeping could not be started"
ERROR=5
fi
else
$0 start
fi
;;
strace_debug)
rm -f /tmp/strace_smokeping
if [ $RUNNING -eq 1 ] ; then
if strace -o/tmp/strace_smokeping $SMOKEPING --restart >/dev/null; then
else
echo "$0 $ARG: smokeping strace debug could not be started"
ERROR=6
fi
else
if strace -o/tmp/strace_smokeping $SMOKEPING >/dev/null; then
else
echo "$0 $ARG: smokeping strace debug could not be started"
ERROR=7
fi
fi
;;
status)
if [ $RUNNING -eq 1 ] ; then
echo "$0 $ARG: smokeping is running with PID ($PID)"
else
echo "$0 $ARG: smokeping is not running"
fi
;;
*)
echo "usage: $0 (start|stop|restart|status|strace_debug|help)"
cat