nrpe(nagios客户端)系统开机自启动脚本

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
	
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值