Nagios扩展Nrpe自动启动脚本

  • 内容
  • 评论
  • 相关

脚本下载地址:

下载 “nrpe自启动脚本.zip” nrpe自启动脚本.zip – 已下载126次 – 649 B

[shell]

#!/bin/sh
#
# Source function library
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/functions ]; then
. /etc/rc.d/functions
fi
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
NrpeBin=/usr/local/nagios/bin/nrpe
NrpeCfg=/usr/local/nagios/etc/nrpe.cfg
LockFile=/var/lock/subsys/nrpe
# See how we were called.
case "$1" in
start)
# Start daemons.
echo -n "Starting nrpe: "
daemon $NrpeBin -c $NrpeCfg -d
echo
touch $LockFile
;;
stop)
# Stop daemons.
echo -n "Shutting down nrpe: "
killproc nrpe
echo
rm -f $LockFile
;;
restart)
$0 stop
$0 start
;;
status)
status nrpe
;;
*)
echo "Usage: nrpe {start|stop|restart|status}"
exit 1
esac
exit 0

[/shell]

------------------------------------------------------
把以上代码做适当的修改后保存后

[shell]
# chkconfig --add nrpe
# chkconfig nrpe on
# service nrpe restart
[/shell]

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注