Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
server:monitoring
nrpe
nrpe.init
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File nrpe.init of Package nrpe
#!/bin/bash # # Copyright (c) 2010 SUSE Linux Products GmbH # Authors: Lars Vogdt (2010-2012) # # /etc/init.d/nrpe # and its symbolic link # /usr/sbin/rcnrpe # ### BEGIN INIT INFO # Provides: nagios-nrpe # Required-Start: $remote_fs $syslog $network # Should-Start: cron # Required-Stop: $remote_fs $syslog # Should-Stop: cron # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: NRPE Nagios Remote Plugin Executor # Description: Start NRPE to allow remote execution of # Nagios plugins. ### END INIT INFO NRPE_BIN="/usr/sbin/nrpe" NRPE_CONFIG="/etc/nrpe.cfg" DEFAULT_PIDFILE="/var/run/nrpe/nrpe.pid" test -x $NRPE_BIN || { echo "$NRPE_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } test -r $NRPE_CONFIG || { echo "$NRPE_CONFIG not existing"; if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; } function get_value() { if [ -n "$2" ]; then set -- `grep ^$1 "$2" | sed 's@=@ @' | tr -d '[:cntrl:]'` else set -- `grep ^$1 "$NRPE_CONFIG" | sed 's@=@ @' | tr -d '[:cntrl:]'` fi shift # remove first ARG => search-string echo $* } # Shell functions sourced from /etc/rc.status: . /etc/rc.status # Reset status of this service rc_reset case "$1" in start) echo -n "Starting Nagios NRPE " pid_file="$(get_value pid_file)" nrpe_group="$(get_value nrpe_group)" nrpe_user="$(get_value nrpe_user)" : ${pid_file=:=$DEFAULT_PIDFILE} : ${nrpe_group:=nagios} : ${nrpe_user:=nagios} if [ -z "$pid_file" ]; then PIDDIR=$(dirname $pid_file) else PIDDIR=$(dirname $DEFAULT_PIDFILE) fi case "$PIDDIR" in /var/run) if [ x"$nrpe_user" != x"root" ]; then DATESTRING=$(date +"%Y%m%d") mv -f "$NRPE_CONFIG" "$NRPE_CONFIG-$DATESTRING" sed -e "s|^pid_file.*|pid_file=$DEFAULT_PIDFILE|g" "$NRPE_CONFIG-$DATESTRING" > "$NRPE_CONFIG" /bin/logger -t rcnrpe "Configured $pid_file in $NRPE_CONFIG moved to $DEFAULT_PIDFILE. Backup is $NRPE_CONFIG-$DATESTRING" echo echo "Configured $pid_file in $NRPE_CONFIG moved to $DEFAULT_PIDFILE. Backup is $NRPE_CONFIG-$DATESTRING" test -f "$pid_file" && rm "$pid_file" install -d -m755 -o$nrpe_user -g$nrpe_group $(dirname "$DEFAULT_PIDFILE") else test -d "$PIDDIR" || mkdir -p "$PIDDIR" fi ;; *) test -d $(dirname "$DEFAULT_PIDFILE") || install -d -m755 -o$nrpe_user -g$nrpe_group $(dirname "$DEFAULT_PIDFILE") ;; esac /sbin/startproc $NRPE_BIN -c $NRPE_CONFIG -d rc_status -v ;; stop) echo -n "Shutting down Nagios NRPE " /sbin/killproc -TERM $NRPE_BIN rc_status -v ;; try-restart|condrestart) if test "$1" = "condrestart"; then echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" fi $0 status if test $? = 0; then $0 restart else rc_reset # Not running is not a failure. fi rc_status ;; restart) $0 stop $0 start rc_status ;; reload|force-reload) echo -n "Reload service Nagios NRPE " /sbin/killproc -HUP $NRPE_BIN rc_status -v ;; status) echo -n "Checking for service Nagios NRPE " /sbin/checkproc $NRPE_BIN rc_status -v ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" exit 1 ;; esac rc_exit
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor