1、nrpe(nagios客户端)系统开机自启动脚本:
#!/bin/bash
#chkconfig: - 60 98
#description: This shell script is used to control nrpe(nagios's client) service===>{start|stop|status|restart} the nrpe.
#scriptname: /etc/init.d/nrped
#explain: my nrpe's prefix path is "/usr/local/nagios"
#
#There are some commands below:
#chmod u+x /etc/init.d/nrped
#chkconfig --add nrped
#chkconfig nrped off
#
#cat >>/etc/rc.local<<EOF
#
##This shell script is used to control nrpe(nagios's client) service===>{start|stop|status|restart} the nrpe.
#/etc/init.d/nrped start
#
#EOF
#
#author:freeflybird
#blog:https://blog.youkuaiyun.com/CPPCPPCPPCPP
[ $UID -ne 0 ] && {
echo "You must use the \"root\" user to operation nrpe!"
exit 1
}
[ -f /etc/init.d/functions ] && . /etc/init.d/functions
workdirPrefix=/usr/local
if [ ! -d $workdirPrefix ];then
mkdir -p $workdirPrefix || {
echo "Unknown ERROR!Anyway,this directory \"$workdirPrefix\" does not exist!"
exit 1
}
fi
nrpeBin=$workdirPrefix/nagios/bin/nrpe
nrpeCfg=$workdirPrefix/nagios/etc/nrpe.cfg
statusnrpeCmd="ps -ef|grep 'nrpe.cfg'|grep -v grep"
#state value of return
RETVAL=0
actionInfo(){
#arg1:execute status ago a statement

本文介绍了如何设置NRPE(Nagios客户端)在Linux系统上实现开机自启动,包括自启动脚本的配置和执行效果。
最低0.47元/天 解锁文章
696

被折叠的 条评论
为什么被折叠?



