From 305857535615c13098272b678a72000b021a7fc3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 13:05:42 +0200 Subject: Adding upstream version 4.0.3. Signed-off-by: Daniel Baumann --- startup/bsd-init.in | 90 ++++++++++++++++++++++++ startup/debian-init.in | 47 +++++++++++++ startup/default-inetd.in | 5 ++ startup/default-init.in | 157 ++++++++++++++++++++++++++++++++++++++++++ startup/default-service.in | 24 +++++++ startup/default-socket-svc.in | 16 +++++ startup/default-socket.in | 12 ++++ startup/default-xinetd.in | 15 ++++ startup/gentoo-init.in | 49 +++++++++++++ startup/mac-inetd.plist.in | 40 +++++++++++ startup/mac-init.plist.in | 32 +++++++++ startup/newbsd-init.in | 35 ++++++++++ startup/openbsd-init.in | 18 +++++ startup/openrc-conf.in | 7 ++ startup/openrc-init.in | 21 ++++++ startup/rh-upstart-init.in | 17 +++++ startup/solaris-inetd.xml.in | 90 ++++++++++++++++++++++++ startup/solaris-init.xml.in | 143 ++++++++++++++++++++++++++++++++++++++ startup/tmpfile.conf.in | 2 + startup/upstart-init.in | 19 +++++ 20 files changed, 839 insertions(+) create mode 100644 startup/bsd-init.in create mode 100644 startup/debian-init.in create mode 100644 startup/default-inetd.in create mode 100644 startup/default-init.in create mode 100644 startup/default-service.in create mode 100644 startup/default-socket-svc.in create mode 100644 startup/default-socket.in create mode 100644 startup/default-xinetd.in create mode 100644 startup/gentoo-init.in create mode 100644 startup/mac-inetd.plist.in create mode 100644 startup/mac-init.plist.in create mode 100644 startup/newbsd-init.in create mode 100644 startup/openbsd-init.in create mode 100644 startup/openrc-conf.in create mode 100644 startup/openrc-init.in create mode 100644 startup/rh-upstart-init.in create mode 100644 startup/solaris-inetd.xml.in create mode 100644 startup/solaris-init.xml.in create mode 100644 startup/tmpfile.conf.in create mode 100644 startup/upstart-init.in (limited to 'startup') diff --git a/startup/bsd-init.in b/startup/bsd-init.in new file mode 100644 index 0000000..96551ae --- /dev/null +++ b/startup/bsd-init.in @@ -0,0 +1,90 @@ +#!/bin/sh + +# Start/stop/restart/reload nrpe +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team + +NRPE_BIN=@sbindir@/nrpe +NRPE_CFG=@pkgsysconfdir@/nrpe.cfg +PID_DIR=@piddir@ +PID_FILE=@piddir@/nrpe.pid + +# Start nrpe +nrpe_start() { + echo -n "Starting nrpe daemon: $NRPE_BIN - " + if [ ! -d "$PID_DIR" ]; then + mkdir -p "$PID_DIR" + fi + $NRPE_BIN -c $NRPE_CFG -d + if [ $? = 0 ]; then + echo "started" + else + echo "failed" + fi +} + +# Stop nrpe +nrpe_stop() { + echo -n "Stopping nrpe daemon - " + if [ -r "$PID_FILE" ]; then + kill $(cat "$PID_FILE") + else + killall nrpe + fi + if [ $? = 0 ]; then + echo "stopped" + else + echo "failed" + fi +} + +# Restart nrpe +nrpe_restart() { + nrpe_stop + sleep 1 + nrpe_start +} + +# Reload nrpe +nrpe_reload() { + echo -n "Reloading nrpe daemon - " + if [ -r "$PID_FILE" ]; then + kill -HUP $(cat "$PID_FILE") + else + killall -HUP nrpe + fi + if [ $? = 0 ]; then + echo "reloaded" + else + echo "failed" + fi +} + +# nrpe status +nrpe_status() { + if ps -C nrpe >/dev/null; then + echo "nrpe is running." + else + echo "nrpe is stopped." + fi +} + +case "$1" in +'start') + nrpe_start + ;; +'stop') + nrpe_stop + ;; +'restart') + nrpe_restart + ;; +'reload') + nrpe_reload + ;; +'status') + nrpe_status + ;; +*) + echo "Usage $0 start|stop|restart|reload|status" + ;; +esac diff --git a/startup/debian-init.in b/startup/debian-init.in new file mode 100644 index 0000000..47341a5 --- /dev/null +++ b/startup/debian-init.in @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# Start/stop the nrpe daemon. + +NRPE_BIN=@sbindir@/nrpe +NRPE_CFG=@pkgsysconfdir@/nrpe.cfg +PID_FILE=@piddir@/nrpe.pid + +test -x $NRPE_BIN || exit 0 + +case "$1" in + +start) + echo -n "Starting nagios remote plugin daemon: nrpe" + start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NRPE_BIN -- -c $NRPE_CFG -d + echo "." + ;; + +stop) + echo -n "Stopping nagios remote plugin daemon: nrpe" + start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NRPE_BIN + echo "." + ;; + +restart|force-reload) + echo -n "Restarting nagios remote plugin daemon: nrpe" + start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NRPE_BIN + start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NRPE_BIN -- -c $NRPE_CFG -d + echo "." + ;; + +reload) + echo -n "Reloading configuration files for nagios remote plugin daemon: nrpe" + test -f $PID_FILE || exit 0 + test -x /bin/kill && /bin/kill -HUP `cat $PID_FILE` + echo "." + ;; + +*) + echo "Usage: $0 start|stop|restart|reload|force-reload" + exit 1 + ;; +esac + +exit 0 diff --git a/startup/default-inetd.in b/startup/default-inetd.in new file mode 100644 index 0000000..04837c9 --- /dev/null +++ b/startup/default-inetd.in @@ -0,0 +1,5 @@ +# +# Enable the following entry to enable the nrpe daemon +#nrpe stream tcp nowait @nrpe_user@ @sbindir@/nrpe nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd +# Enable the following entry if the nrpe daemon didn't link with libwrap +#nrpe stream tcp nowait @nrpe_user@ /usr/sbin/tcpd @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd diff --git a/startup/default-init.in b/startup/default-init.in new file mode 100644 index 0000000..b0f02a2 --- /dev/null +++ b/startup/default-init.in @@ -0,0 +1,157 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# chkconfig: - 80 30 +# description: Starts and stops the Nagios Remote Plugin Executor \ +# so a remote nagios server can run plugins on this host +# +### BEGIN INIT INFO +# Provides: nrpe +# Required-Start: $local_fs $remote_fs $time +# Required-Stop: $local_fs $remote_fs +# Should-Start: $syslog $network +# Should-Stop: $syslog $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Starts and stops the Nagios Remote Plugin Executor +# Description: Starts and stops the Nagios Remote Plugin Executor +# so a remote nagios server can run plugins on this host +### END INIT INFO + + +NRPE_BIN=@sbindir@/nrpe +NRPE_CFG=@pkgsysconfdir@/nrpe.cfg +LOCK_DIR=@subsyslockdir@ +LOCK_FILE=@subsyslockfile@ +PID_FILE=@piddir@/nrpe.pid + +test -x $NRPE_BIN || exit 5 + +RETVAL=0 +_set_rc (){ return; } + +# Default these commands/functions to RedHat/CentOS etc. values +MSG_CMD="echo -n" +START_CMD="daemon --pidfile $PID_FILE" +TERM_CMD="killproc -p $PID_FILE $NRPE_BIN -TERM" +HUP_CMD="killproc -p $PID_FILE $NRPE_BIN -HUP" +PRT_STAT="echo" +STAT_MSG="echo -n Checking for nrpe daemon... " +STAT_CMD="status nrpe" +EXIT_CMD="exit" + + +# Source the function library +if [ -f /etc/rc.status ]; then + + . /etc/rc.status + + _set_rc (){ return $RETVAL; } + + # Set these commands/functions to SuSE etc. values + START_CMD="startproc -p $PID_FILE" + TERM_CMD="killproc -p $PID_FILE -TERM $NRPE_BIN" + HUP_CMD="killproc -p $PID_FILE -HUP $NRPE_BIN" + PRT_STAT="rc_status -v -r" + STAT_CMD="checkproc -p $PID_FILE $NRPE_BIN" + EXIT_CMD="rc_exit" + rc_reset + +elif [ -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 /lib/lsb/init-functions ]; then + + . /lib/lsb/init-functions + + MSG_CMD="log_daemon_msg" + START_CMD="start_daemon -p $PID_FILE" + PRT_STAT="log_end_msg" + STAT_MSG= + STAT_CMD="status_of_proc -p $PID_FILE $NRPE_BIN nrpe" + +elif [ -f /etc/rc.d/functions ]; then + + . /etc/rc.d/functions + +fi + + +# See how we were called. +case "$1" in + +start) + # Start daemons. + $MSG_CMD "Starting nrpe " + $START_CMD $NRPE_BIN -c $NRPE_CFG -d + RETVAL=$? + if test "$PRT_STAT" = log_end_msg; then + $PRT_STAT $RETVAL + else + _set_rc; $PRT_STAT + fi + if [ $RETVAL = 0 ]; then + [ -d $LOCK_DIR ] && touch $LOCK_FILE || true + fi + ;; + +stop) + # Stop daemons. + $MSG_CMD "Shutting down nrpe " + $TERM_CMD + RETVAL=$? + if test "$PRT_STAT" = log_end_msg; then + $PRT_STAT $RETVAL + else + _set_rc; $PRT_STAT + fi + if [ $RETVAL = 0 ]; then + [ -d $LOCK_DIR ] && rm -f $LOCK_FILE + fi + ;; + +restart|force-reload) + $0 stop + $0 start + RETVAL=$? + ;; + +reload) + $MSG_CMD "Reloading nrpe " + $HUP_CMD + RETVAL=$? + if test "$PRT_STAT" = log_end_msg; then + $PRT_STAT $RETVAL + else + _set_rc; $PRT_STAT + fi + ;; + +try-restart|condrestart) + $STAT_CMD || exit 0 + $0 stop + $0 start + RETVAL=$? + ;; + +status) + $STAT_MSG + $STAT_CMD + RETVAL=$? + if test "$PRT_STAT" != log_end_msg; then + _set_rc; $PRT_STAT + fi + ;; + +*) + echo "Usage: nrpe {start|stop|restart|reload|try-restart|condrestart|status}" + exit 1 +esac + +$EXIT_CMD $RETVAL diff --git a/startup/default-service.in b/startup/default-service.in new file mode 100644 index 0000000..b6c6063 --- /dev/null +++ b/startup/default-service.in @@ -0,0 +1,24 @@ +[Unit] +Description=Nagios Remote Plugin Executor +Documentation=http://www.nagios.org/documentation +After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target +Before=getty@tty1.service plymouth-quit.service xdm.service +Conflicts=nrpe.socket + +[Install] +WantedBy=multi-user.target + +[Service] +Type=simple +Restart=on-abort +PIDFile=@piddir@/nrpe.pid +RuntimeDirectory=nrpe +RuntimeDirectoryMode=0755 +ExecStart=@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f +ExecReload=/bin/kill -HUP $MAINPID +ExecStopPost=/bin/rm -f @piddir@/nrpe.pid +TimeoutStopSec=60 +User=@nrpe_user@ +Group=@nrpe_group@ +PrivateTmp=true +OOMScoreAdjust=-500 diff --git a/startup/default-socket-svc.in b/startup/default-socket-svc.in new file mode 100644 index 0000000..7e6acac --- /dev/null +++ b/startup/default-socket-svc.in @@ -0,0 +1,16 @@ +[Unit] +Description=Nagios Remote Plugin Executor +Documentation=http://www.nagios.org/documentation +After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target + +[Service] +Restart=on-failure +ExecStart=@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd +KillMode=process +User=@nrpe_user@ +Group=@nrpe_group@ +PrivateTmp=true +OOMScoreAdjust=-500 + +[Install] +WantedBy=multi-user.target diff --git a/startup/default-socket.in b/startup/default-socket.in new file mode 100644 index 0000000..0921fe8 --- /dev/null +++ b/startup/default-socket.in @@ -0,0 +1,12 @@ +[Unit] +Description=Nagios Remote Plugin Executor +Documentation=http://www.nagios.org/documentation +Before=nrpe.service +Conflicts=nrpe.service + +[Socket] +ListenStream=@nrpe_port@ +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/startup/default-xinetd.in b/startup/default-xinetd.in new file mode 100644 index 0000000..eaeacf4 --- /dev/null +++ b/startup/default-xinetd.in @@ -0,0 +1,15 @@ +# default: off +# description: NRPE (Nagios Remote Plugin Executor) +service nrpe +{ + disable = yes + socket_type = stream + port = @nrpe_port@ + wait = no + user = @nrpe_user@ + group = @nrpe_group@ + server = @sbindir@/nrpe + server_args = -c @pkgsysconfdir@/nrpe.cfg --inetd + only_from = 127.0.0.1 ::1 + log_on_success = +} diff --git a/startup/gentoo-init.in b/startup/gentoo-init.in new file mode 100644 index 0000000..c7adc55 --- /dev/null +++ b/startup/gentoo-init.in @@ -0,0 +1,49 @@ +#!/sbin/openrc-run +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# Start/stop the nrpe daemon. +# +# Goes in /etc/init.d - Config is in /etc/conf.d/nrpe + +extra_started_commands="reload" + +NRPE_BIN="@sbindir@/nrpe" +NRPE_PID="@piddir@/nrpe.pid" +NRPE_CFG=@pkgsysconfdir@/nrpe.cfg + +depend() { + use logger dns net localmount netmount nfsmount +} + +checkconfig() { + # Make sure the config file exists + if [ ! -f $NRPE_CFG ]; then + eerror "You need to setup $NRPE_CFG." + return 1 + fi + return 0 +} + +start() { + checkconfig || return 1 + ebegin "Starting nrpe" + # Make sure we have a sane current directory + cd / + start-stop-daemon --start --exec $NRPE_BIN --pidfile $NRPE_PID \ + --background -- -c $NRPE_CFG -f $NRPE_OPTS + eend $? +} + +stop() { + ebegin "Stopping nrpe" + start-stop-daemon --stop --exec $NRPE_BIN --pidfile $NRPE_PID + eend $? +} + +reload() { + ebegin "Reloading nrpe" + start-stop-daemon --stop --oknodo --exec $NRPE_BIN \ + --pidfile $NRPE_PID --signal HUP + eend $? +} diff --git a/startup/mac-inetd.plist.in b/startup/mac-inetd.plist.in new file mode 100644 index 0000000..45197ea --- /dev/null +++ b/startup/mac-inetd.plist.in @@ -0,0 +1,40 @@ + + + + + Label + org.nagios.nrpe + UserName + @nrpe_user@ + GroupName + @nrpe_group@ + Program + @sbindir@/nrpe + ProgramArguments + + nrpe + -c + @pkgsysconfdir@/nrpe.cfg + -i + + Sockets + + Listeners + + SockServiceName + 5666 + SockType + stream + SockFamily + IPv4 + + + inetdCompatibility + + Wait + + + ProcessType + Background + + diff --git a/startup/mac-init.plist.in b/startup/mac-init.plist.in new file mode 100644 index 0000000..f51c498 --- /dev/null +++ b/startup/mac-init.plist.in @@ -0,0 +1,32 @@ + + + + + Label + org.nagios.nrpe + UserName + @nrpe_user@ + GroupName + @nrpe_group@ + Program + @sbindir@/nrpe + ProgramArguments + + nrpe + -c + @pkgsysconfdir@/nrpe.cfg + -f + + KeepAlive + + SuccessfulExit + + NetworkState + + + RunAtLoad + + ProcessType + Background + + diff --git a/startup/newbsd-init.in b/startup/newbsd-init.in new file mode 100644 index 0000000..aa4ed45 --- /dev/null +++ b/startup/newbsd-init.in @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# PROVIDE: nrpe +# REQUIRE: DAEMON +# KEYWORD: shutdown + +. /etc/rc.subr + +: ${nrpe@bsd_enable@:="NO"} +: ${nrpe_configfile:="@pkgsysconfdir@/nrpe.cfg"} + +name=nrpe +command="@sbindir@/nrpe" +command_args="-c $nrpe_configfile -d" +pidfile="@piddir@/nrpe.pid" +extra_commands=reload +sig_reload=HUP +rcvar=nrpe@bsd_enable@ +load_rc_config "$name" +required_files="$nrpe_configfile" +sig_reload=HUP + +start_precmd=nrpe_prestart + +nrpe_prestart() +{ + [ -n "$nrpe_pidfile" ] && + warn "No longer necessary to set nrpe_pidfile in rc.conf[.local]" + + install -d -o @nrpe_user@ ${pidfile%/*} +} + +run_rc_command "$1" diff --git a/startup/openbsd-init.in b/startup/openbsd-init.in new file mode 100644 index 0000000..1713646 --- /dev/null +++ b/startup/openbsd-init.in @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# + +daemon="@sbindir@/nrpe" + +. /etc/rc.d/rc.subr + +rc_pre() { + install -d -o @nrpe_user@ ${pidfile%/*} +} + +rc_reload() { + pkill -HUP -xf "${pexp}" +} + +rc_cmd "$1" diff --git a/startup/openrc-conf.in b/startup/openrc-conf.in new file mode 100644 index 0000000..1e6bd84 --- /dev/null +++ b/startup/openrc-conf.in @@ -0,0 +1,7 @@ +# /etc/conf.d/nrpe : config file for /etc/init.d/nrpe + +# The configuration file to use. +NRPE_CFG="@sysconfdir@/nrpe.cfg" + +# Any additional options (e.g. -n -4 -6) to pass to the nrpe daemon. +NRPE_OPTS="" diff --git a/startup/openrc-init.in b/startup/openrc-init.in new file mode 100644 index 0000000..c123c95 --- /dev/null +++ b/startup/openrc-init.in @@ -0,0 +1,21 @@ +#!/sbin/openrc-run +# +# Copyright (c) 2017 Nagios(R) Core(TM) Development Team +# + +# Supply a default value for NRPE_CFG in case the corresponding +# conf.d file is not installed. +: ${NRPE_CFG:="@sysconfdir@/nrpe.cfg"} + +command="@sbindir@/nrpe" +command_args="--config=${NRPE_CFG} ${NRPE_OPTS}" +command_args_background="--daemon" +description="Nagios Remote Plugin Executor (NRPE) daemon" +extra_started_commands="reload" +pidfile="@piddir@/${RC_SVCNAME}.pid" + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + start-stop-daemon --signal HUP --pidfile "${pidfile}" + eend $? +} diff --git a/startup/rh-upstart-init.in b/startup/rh-upstart-init.in new file mode 100644 index 0000000..58bf3b5 --- /dev/null +++ b/startup/rh-upstart-init.in @@ -0,0 +1,17 @@ +# nrpe - the Nagios Remote Plugin Executor +# +# nrpe is a program that runs plugins on this host +# and reports the results back to a nagios server +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team + +description "the Nagios Remote Plugin Executor" + +oom -10 + +start on started network +stop on runlevel [!2345] + +respawn + +exec @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f diff --git a/startup/solaris-inetd.xml.in b/startup/solaris-inetd.xml.in new file mode 100644 index 0000000..85a0a5b --- /dev/null +++ b/startup/solaris-inetd.xml.in @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/startup/solaris-init.xml.in b/startup/solaris-init.xml.in new file mode 100644 index 0000000..e4ff84c --- /dev/null +++ b/startup/solaris-init.xml.in @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/startup/tmpfile.conf.in b/startup/tmpfile.conf.in new file mode 100644 index 0000000..9db7ca6 --- /dev/null +++ b/startup/tmpfile.conf.in @@ -0,0 +1,2 @@ +#Type Path Mode UID GID Age Argument +d @piddir@ 0755 @nrpe_user@ @nrpe_group@ - - diff --git a/startup/upstart-init.in b/startup/upstart-init.in new file mode 100644 index 0000000..ec16d7d --- /dev/null +++ b/startup/upstart-init.in @@ -0,0 +1,19 @@ +# nrpe - the Nagios Remote Plugin Executor +# +# nrpe is a program that runs plugins on this host +# and reports the results back to a nagios server +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team + +description "the Nagios Remote Plugin Executor" + +oom score -800 +setgid @nrpe_group@ +setuid @nrpe_user@ + +start on (local-filesystems and net-device-up IFACE!=lo) +stop on runlevel [!2345] + +respawn + +exec @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f -- cgit v1.2.3