nagios插件nrpe自启动脚本

说明:
nagios通过nrpe进程监控,被监控端需要开启nrpe传送被监控数据给nagios。原来被监控端都是通过/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d这样的方式。但不好管理,现在添加nrpe自启动脚本。具体脚本如下

nrpe自启动脚本:

#!/bin/bash
# chkconfig: 2345 88 12
# description: NRPE DAEMON
NRPE=/usr/local/nagios/bin/nrpe
NRPECONF=/usr/local/nagios/etc/nrpe.cfg

case "$1" in
        start)
                echo -n "Staring NRPE daemon...."
                $NRPE -c $NRPECONF -d
                echo "done.."
                ;;
        stop)
                echo -n "Stopping NRPE daemon...."
                pkill -u nagios nrpe
                echo "done.."
                ;;
        restart)
                $0  stop
                sleep 1
                $0 start
                ;;
        *)
                echo "Usage: $0 start|stop|restart"
        esac
exit 0

发表评论

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