资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

nagios客户端nrped服务方式启动脚本

1、平时配置nagios客户端nrped启动最常用的就是在/etc/rc.local文件配置:

成都创新互联公司从2013年创立,是专业互联网技术服务公司,拥有项目做网站、网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元邻水做网站,已为上家服务,为邻水各地企业和个人服务,联系电话:18980820575

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

2、但是还有更好的方式(这样方便使用脚本启动或者关闭):

在/etc/init.d目录下创建nrped脚本文件,并执行 chmod +x /etc/init.d/nrped 赋予执行权限

chkconfig --add nrped 或执行直接执行chkconfig nrped on 来添加为服务启动

nrped 脚本文件内容(这个脚本不是我写的):

#!/bin/sh

#

#  Created 2000-01-03 by jaclu@grm.se

#

# nrpe          This shell script takes care of starting and stopping

#               nrpe.

#

# chkconfig: 2345 80 30

# description: nrpe is a daemon for a remote nagios server, \

#              running nagios plugins on this host.

# processname: nrpe

# config: /usr/local/nagios/etc/nrpe.cfg

# 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

        exit $?

        ;;

  *)

        echo "Usage: nrpe {start|stop|restart|status}"

        exit 1

esac

exit 0


分享题目:nagios客户端nrped服务方式启动脚本
路径分享:http://cdkjz.cn/article/gigecj.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220