Imported Upstream version 3.0.1

This commit is contained in:
Mario Fetka
2017-05-04 11:53:58 +02:00
parent 1efb03f433
commit 76f2f414ed
82 changed files with 17250 additions and 10654 deletions

90
startup/bsd-init.in Normal file
View File

@@ -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

47
startup/debian-init.in Normal file
View File

@@ -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

5
startup/default-inetd.in Normal file
View File

@@ -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

157
startup/default-init.in Normal file
View File

@@ -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

View File

@@ -0,0 +1,23 @@
[Unit]
Description=Nagios Remote Program 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
ExecStopPost=/bin/rm -f @piddir@/nrpe.pid
TimeoutStopSec=60
User=@nrpe_user@
Group=@nrpe_group@
PrivateTmp=true
OOMScoreAdjust=-500

View File

@@ -0,0 +1,16 @@
[Unit]
Description=Nagios Remote Program 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

12
startup/default-socket.in Normal file
View File

@@ -0,0 +1,12 @@
[Unit]
Description=Nagios Remote Program Executor
Documentation=http://www.nagios.org/documentation
Before=nrpe.service
Conflicts=nrpe.service
[Socket]
ListenStream=@nrpe_port@
Accept=yes
[Install]
WantedBy=sockets.target

15
startup/default-xinetd.in Normal file
View File

@@ -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
log_on_failure += USERID
}

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nagios.nrpe</string>
<key>UserName</key>
<string>@nrpe_user@</string>
<key>GroupName</key>
<string>@nrpe_group@</string>
<key>Program</key>
<string>@sbindir@/nrpe</string>
<key>ProgramArguments</key>
<array>
<string>nrpe</string>
<string>-c</string>
<string>@pkgsysconfdir@/nrpe.cfg</string>
<string>-i</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>5666</string>
<key>SockType</key>
<string>stream</string>
<key>SockFamily</key>
<string>IPv4</string>
</dict>
</dict>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
<key>ProcessType</key>
<string>Background</string>
</dict>
</plist>

32
startup/mac-init.plist.in Normal file
View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nagios.nrpe</string>
<key>UserName</key>
<string>@nrpe_user@</string>
<key>GroupName</key>
<string>@nrpe_group@</string>
<key>Program</key>
<string>@sbindir@/nrpe</string>
<key>ProgramArguments</key>
<array>
<string>nrpe</string>
<string>-c</string>
<string>@pkgsysconfdir@/nrpe.cfg</string>
<string>-f</string>
</array>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
<key>NetworkState</key>
<true/>
</dict>
<key>RunAtLoad</key>
<true/>
<key>ProcessType</key>
<string>Background</string>
</dict>
</plist>

35
startup/newbsd-init.in Normal file
View File

@@ -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"

18
startup/openbsd-init.in Normal file
View File

@@ -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"

7
startup/openrc-conf.in Normal file
View File

@@ -0,0 +1,7 @@
# /etc/conf.d/nrpe : config file for /etc/init.d/nrpe
# Configuration file - default is @sysconfdir@/nrpe.cfg
NRPE_CFG="@pgksysconfdir@/nrpe.cfg"
# Any additional nrpe options (-n -4 -6)
NRPE_OPTS=""

49
startup/openrc-init.in Normal file
View File

@@ -0,0 +1,49 @@
#!/sbin/runscript
#
# 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
opts="reload"
# extra_started_commands="reload" use this if OpenRC >= 0.9.4
NRPE_BIN="@sbindir@/nrpe"
NRPE_PID="@piddir@/nrpe.pid"
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 $PID_FILE \
-- -c $NRPE_CFG -f $NRPE_OPTS
eend $?
}
stop() {
ebegin "Stopping nrpe"
start-stop-daemon --stop --exec $NRPE_BIN --pidfile $PID_FILE
eend $?
}
reload() {
ebegin "Reloading nrpe"
start-stop-daemon --stop --oknodo --exec $NRPE_BIN \
--pidfile $PID_FILE --signal HUP
eend $?
}

View File

@@ -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

View File

@@ -0,0 +1,90 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
Copyright (c) 2016 Nagios(R) Core(TM) Development Team
-->
<service_bundle type='manifest' name='NGOS:nrpe'>
<service
name='network/nagios/nrpe'
type='service'
version='1'>
<restarter>
<service_fmri value='svc:/network/inetd:default' />
</restarter>
<dependency name='config_data'
grouping='require_all'
restart_on='restart'
type='path'>
<service_fmri
value='file://localhost@sysconfdir@/nrpe.cfg' />
</dependency>
<exec_method
type='method'
name='inetd_start'
exec='@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -i'
timeout_seconds='0'>
<method_context>
<method_credential user='@nrpe_user@' group='@nrpe_group@'/>
</method_context>
</exec_method>
<exec_method
type='method'
name='inetd_offline'
exec=':kill_process'
timeout_seconds='0'/>
<exec_method
type='method'
name='inetd_disable'
exec=':kill'
timeout_seconds='0'/>
<property_group name='inetd' type='framework'>
<stability value='Evolving' />
<propval name='name' type='astring' value='nrpe' />
<propval name='endpoint_type' type='astring' value='stream' />
<propval name='proto' type='astring' value='tcp' />
<propval name='wait' type='boolean' value='false' />
<propval name='isrpc' type='boolean' value='false' />
</property_group>
<property_group name='general' type='framework'>
<propval name='enabled'
type='boolean'
value='false'/>
<propval name='action_authorization'
type='astring'
value='solaris.smf.manage.nrpe'/>
<propval name='value_authorization'
type='astring'
value='solaris.smf.manage.nrpe'/>
</property_group>
<instance name='default' enabled='false' />
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang="C">NRPE daemon</loctext>
</common_name>
<description>
<loctext xml:lang="C">
Nagios Remote Plugin Executor daemon
</loctext>
</description>
<documentation>
<doc_link name='nagios.org' uri='http://www.nagios.org' />
</documentation>
</template>
</service>
</service_bundle>

143
startup/solaris-init.xml.in Normal file
View File

@@ -0,0 +1,143 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
Copyright (c) 2016 Nagios(R) Core(TM) Development Team
-->
<service_bundle type='manifest' name='NGOS:nrpe'>
<service
name='network/nagios/nrpe'
type='service'
version='1'>
<single_instance />
<dependency
name='fs-local'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>
<dependency
name='autofs'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/filesystem/autofs' />
</dependency>
<dependency
name='net-loopback'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/loopback' />
</dependency>
<dependency
name='net-physical'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/physical' />
</dependency>
<dependency
name='cryptosvc'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/cryptosvc' />
</dependency>
<dependency
name='utmp'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/utmp' />
</dependency>
<dependency
name='config_data'
grouping='require_all'
restart_on='restart'
type='path'>
<service_fmri
value='file://localhost@sysconfdir@/nrpe.cfg' />
</dependency>
<dependency
name='system-log'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/system-log' />
</dependency>
<dependent
name='nrpe_multi-user-server'
grouping='optional_all'
restart_on='none'>
<service_fmri value='svc:/milestone/multi-user-server'/>
</dependent>
<exec_method
type='method'
name='start'
exec='@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -d'
timeout_seconds='5'>
<method_context>
<method_credential user='@nrpe_user@' group='@nrpe_group@'/>
</method_context>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='60'/>
<exec_method
type='method'
name='refresh'
exec=':hup'
timeout_seconds='60'/>
<property_group name='startd' type='framework'>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<property_group name='general' type='framework'>
<propval name='enabled' type='boolean' value='false'/>
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.nrpe'/>
<propval name='value_authorization' type='astring'
value='solaris.smf.manage.nrpe'/>
</property_group>
<instance name='default' enabled='false' />
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang="C">NRPE daemon</loctext>
</common_name>
<description>
<loctext xml:lang="C">
Nagios Remote Plugin Executor daemon
</loctext>
</description>
<documentation>
<doc_link name='nagios.org' uri='http://www.nagios.org' />
</documentation>
</template>
</service>
</service_bundle>

2
startup/tmpfile.conf.in Normal file
View File

@@ -0,0 +1,2 @@
#Type Path Mode UID GID Age Argument
d @piddir@ 0755 @nrpe_user@ @nrpe_group@ - -

19
startup/upstart-init.in Normal file
View File

@@ -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