3.4启动smokeping
(1)编写smokeping启动脚本: 赋予可执行权限,并放在/etc/init.d目录下
[root@smokeping ~]# vim /etc/init.d/smokeping
#!/bin/bash
PIDFILE=/usr/local/smokeping/var/smokeping.pid
SMOKEPING=/usr/local/smokeping/bin/smokeping
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
echo "$0 $ARG: smokeping could not be stopped"
ERROR=3
fi
else
echo "$0 $ARG: smokeping not running"
ERROR=4
fi
;;
restart)
if [ $RUNNING -eq 1 ] ; then
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
echo "$0 $ARG: smokeping restarted with strace debug in /tmp/strace_smokeping"
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
echo "$0 $ARG: smokeping started with strace debug in /tmp/strace_smokeping"
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
start - start smokeping
stop - stop smokeping
restart - restart smokeping if running or start if not running
status - show status if smokeping is running or not
help - this screen
EOF
;;
esac
done
exit $ERROR
[root@smokeping ~]# chmod +x /etc/init.d/smokeping
[root@smokeping ~]# ll /etc/init.d/smokeping
-rwxr-xr-x 1 root root 2109 Jun 16 16:52 /etc/init.d/smokeping
(2)检查smokeping配置文件:
[root@smokeping ~]# /usr/local/smokeping/bin/smokeping --check
Configuration file '/usr/local/smokeping/etc/config' syntax OK.
(3)启动smokeping:(无法启动)
[root@smokeping ~]# service smokeping start
ERROR: slave 'boomer' is not defined in the '*** Slaves ***' section!
/etc/init.d/smokeping start: smokeping could not be started
出现错误à将在后面解决…
(4)配置apache /conf/httpd.conf
[root@smokeping ~]# vim /etc/httpd/conf/httpd.conf
Alias /smokeping/ "/usr/local/smokeping/htdocs/"
Alias /cache/ "/usr/local/smokeping/cache/"
Options FollowSymLinks ExecCGI
AllowOverride None
AddHandler cgi-script cgi
Order allow,deny
Allow from all
[root@smokeping ~]# service httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for smokeping.
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
[root@smokeping ~]#
(5)测试。修改完后重启apache,在浏览器输入
失败。。。待续。。。