new(pkg): build the nrpe daemon as nrpe4 (#4931)
This commit is contained in:
parent
c245c41041
commit
058620c545
|
@ -20,7 +20,7 @@ jobs:
|
|||
get-environment:
|
||||
uses: ./.github/workflows/get-environment.yml
|
||||
with:
|
||||
version_file: nrpe/packaging/centreon-nrpe3-daemon.yaml
|
||||
version_file: nrpe/packaging/centreon-nrpe4-daemon.yaml
|
||||
|
||||
package:
|
||||
needs: [get-environment]
|
||||
|
@ -59,7 +59,7 @@ jobs:
|
|||
|
||||
- name: Download nrpe sources
|
||||
run: |
|
||||
curl -Lo - "https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-${{ needs.get-environment.outputs.version }}/nrpe-${{ needs.get-environment.outputs.version }}.tar.gz" | tar zxpf -
|
||||
curl -sLo - "https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-${{ needs.get-environment.outputs.version }}/nrpe-${{ needs.get-environment.outputs.version }}.tar.gz" | tar zxpf -
|
||||
mv nrpe-${{ needs.get-environment.outputs.version }} nrpe-src
|
||||
shell: bash
|
||||
|
||||
|
@ -67,7 +67,7 @@ jobs:
|
|||
run: |
|
||||
cd nrpe-src
|
||||
|
||||
patch -p1 < ../nrpe/packaging/files/nrpe3_add_centreon_cmd.patch
|
||||
patch -p1 < ../nrpe/packaging/files/nrpe4_add_centreon_cmd.patch
|
||||
|
||||
if [ "${{ matrix.package_extension }}" = "deb" ]; then
|
||||
NAGIOS_PLUGINS_PATH="/usr/lib/nagios/plugins"
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
name: "centreon-nrpe4-daemon"
|
||||
arch: "amd64"
|
||||
platform: "linux"
|
||||
version_schema: "none"
|
||||
version: "4.1.0"
|
||||
release: "${RELEASE}${DIST}"
|
||||
section: "default"
|
||||
priority: "optional"
|
||||
maintainer: "Centreon <contact@centreon.com>"
|
||||
description: |
|
||||
The centreon-nrpe packages contains the Nagios Remote Plug-ins Executor.
|
||||
Daemon which can execute predefined commands on the remote host.
|
||||
Commit: @COMMIT_HASH@
|
||||
vendor: "Centreon"
|
||||
homepage: "https://centreon.com"
|
||||
license: "GPLv2+"
|
||||
|
||||
contents:
|
||||
- src: "../../nrpe-src/src/nrpe"
|
||||
dst: "/usr/sbin/centreon-nrpe4"
|
||||
|
||||
- src: "../../nrpe-src/sample-config/nrpe.cfg"
|
||||
dst: "/etc/nrpe/centreon-nrpe4.cfg"
|
||||
type: config|noreplace
|
||||
file_info:
|
||||
mode: 0644
|
||||
|
||||
- src: "files/nrpe4.sysconfig"
|
||||
dst: "/etc/sysconfig/centreon-nrpe4"
|
||||
packager: rpm
|
||||
file_info:
|
||||
mode: 0644
|
||||
- src: "files/nrpe4.sysconfig"
|
||||
dst: "/etc/default/centreon-nrpe4"
|
||||
packager: deb
|
||||
file_info:
|
||||
mode: 0644
|
||||
|
||||
- src: "files/nrpe4.rpm.service"
|
||||
dst: "/lib/systemd/system/centreon-nrpe4.service"
|
||||
packager: rpm
|
||||
file_info:
|
||||
mode: 0644
|
||||
- src: "files/nrpe4.deb.service"
|
||||
dst: "/lib/systemd/system/centreon-nrpe4.service"
|
||||
packager: deb
|
||||
file_info:
|
||||
mode: 0644
|
||||
|
||||
- dst: "/var/log/nrpe"
|
||||
type: dir
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: centreon-engine
|
||||
group: centreon-engine
|
||||
|
||||
- dst: "/var/log/nrpe/centplugins"
|
||||
type: dir
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: centreon-engine
|
||||
group: centreon-engine
|
||||
|
||||
scripts:
|
||||
preinstall: ./scripts/centreon-nrpe4-daemon-preinstall.sh
|
||||
postinstall: ./scripts/centreon-nrpe4-daemon-postinstall.sh
|
||||
preremove: ./scripts/centreon-nrpe4-daemon-preremove.sh
|
||||
|
||||
overrides:
|
||||
rpm:
|
||||
replaces:
|
||||
- centreon-nrpe4-daemon-debuginfo
|
||||
- centreon-nrpe4-daemon-debugsource
|
||||
conflicts:
|
||||
- centreon-nrpe4-daemon-debuginfo
|
||||
- centreon-nrpe4-daemon-debugsource
|
||||
provides:
|
||||
- centreon-nrpe4-daemon-debuginfo
|
||||
- centreon-nrpe4-daemon-debugsource
|
||||
deb:
|
||||
replaces:
|
||||
- centreon-nrpe4-daemon-dbgsym
|
||||
conflicts:
|
||||
- centreon-nrpe4-daemon-dbgsym
|
||||
provides:
|
||||
- centreon-nrpe4-daemon-dbgsym
|
||||
|
||||
rpm:
|
||||
summary: Nagios Remote Plugins Execution daemon
|
||||
signature:
|
||||
key_file: ${RPM_SIGNING_KEY_FILE}
|
||||
key_id: ${RPM_SIGNING_KEY_ID}
|
|
@ -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
|
||||
Requires=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=centreon-engine
|
||||
Group=centreon-engine
|
||||
EnvironmentFile=/etc/default/centreon-nrpe4
|
||||
ExecStart=/usr/sbin/centreon-nrpe4 -c /etc/nrpe/centreon-nrpe4.cfg -d $NRPE_OPT
|
||||
Restart=on-abort
|
||||
PIDFile=/var/log/nrpe/nrpe4.pid
|
||||
ExecStopPost=/bin/rm -f /var/log/nrpe/nrpe4.pid
|
||||
TimeoutStopSec=60
|
||||
PrivateTmp=false
|
||||
OOMScoreAdjust=-500
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -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
|
||||
Requires=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=centreon-engine
|
||||
Group=centreon-engine
|
||||
EnvironmentFile=/etc/sysconfig/centreon-nrpe4
|
||||
ExecStart=/usr/sbin/centreon-nrpe4 -c /etc/nrpe/centreon-nrpe4.cfg -d $NRPE_OPT
|
||||
Restart=on-abort
|
||||
PIDFile=/var/log/nrpe/nrpe4.pid
|
||||
ExecStopPost=/bin/rm -f /var/log/nrpe/nrpe4.pid
|
||||
TimeoutStopSec=60
|
||||
PrivateTmp=false
|
||||
OOMScoreAdjust=-500
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,2 @@
|
|||
# specify additional command line arguments for nrpe
|
||||
NRPE_OPT=""
|
|
@ -0,0 +1,29 @@
|
|||
--- a/sample-config/nrpe.cfg.in 2018-09-14 13:40:08.496324915 +0200
|
||||
+++ b/sample-config/nrpe.cfg.in 2018-09-14 13:47:57.624296953 +0200
|
||||
@@ -40,7 +40,7 @@
|
||||
# number. The file is only written if the NRPE daemon is started by the root
|
||||
# user and is running in standalone mode.
|
||||
|
||||
-pid_file=@piddir@/nrpe.pid
|
||||
+pid_file=@piddir@/nrpe4.pid
|
||||
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
#
|
||||
# Values: 0=do not allow arguments, 1=allow command arguments
|
||||
|
||||
-dont_blame_nrpe=0
|
||||
+dont_blame_nrpe=1
|
||||
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@
|
||||
command[check_hda1]=@pluginsdir@/check_disk -w 20% -c 10% -p /dev/hda1
|
||||
command[check_zombie_procs]=@pluginsdir@/check_procs -w 5 -c 10 -s Z
|
||||
command[check_total_procs]=@pluginsdir@/check_procs -w 150 -c 200
|
||||
-
|
||||
+command[check_centreon_plugins]=/usr/lib/centreon/plugins/centreon_linux_local.pl --plugin=$ARG1$ --mode=$ARG2$ $ARG3$
|
||||
|
||||
# The following examples allow user-supplied arguments and can
|
||||
# only be used if the NRPE daemon was compiled with support for
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
startNrpeDaemon() {
|
||||
systemctl daemon-reload ||:
|
||||
systemctl unmask centreon-nrpe4.service ||:
|
||||
systemctl preset centreon-nrpe4.service ||:
|
||||
systemctl enable centreon-nrpe4.service ||:
|
||||
systemctl restart centreon-nrpe4.service ||:
|
||||
}
|
||||
|
||||
action="$1"
|
||||
if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
||||
# Alpine linux does not pass args, and deb passes $1=configure
|
||||
action="install"
|
||||
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
|
||||
# deb passes $1=configure $2=<current version>
|
||||
action="upgrade"
|
||||
fi
|
||||
|
||||
case "$action" in
|
||||
"1" | "install")
|
||||
startNrpeDaemon
|
||||
;;
|
||||
"2" | "upgrade")
|
||||
startNrpeDaemon
|
||||
;;
|
||||
*)
|
||||
# $1 == version being installed
|
||||
startNrpeDaemon
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
getent group centreon-engine > /dev/null 2>&1 || groupadd -r centreon-engine
|
||||
getent passwd centreon-engine > /dev/null 2>&1 || useradd -g centreon-engine --shell /bin/bash -m -d /var/lib/centreon-engine -r centreon-engine > /dev/null 2>&1 ||:
|
||||
mkdir -p /var/lib/centreon/centplugins/
|
||||
chown centreon-engine: /var/lib/centreon/centplugins/
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
systemctl stop centreon-nrpe4.service ||:
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"dependencies": [
|
||||
"libdatetime-perl",
|
||||
"libxml-libxml-perl",
|
||||
"net-tools",
|
||||
"quota"
|
||||
]
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
"dependencies": [
|
||||
"net-tools",
|
||||
"quota",
|
||||
"lsof",
|
||||
"perl(Data::Dumper)",
|
||||
"perl(Pod::Parser)",
|
||||
"perl(DateTime)",
|
||||
"perl(Digest::MD5)",
|
||||
"perl(NetAddr::IP)"
|
||||
"perl(NetAddr::IP)",
|
||||
"perl(Pod::Parser)",
|
||||
"perl(XML::LibXML)"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue