systemd support [release 2.15-3mamba;Sun Dec 27 2015]
This commit is contained in:
parent
c4e68e7c68
commit
7f3c04d77f
@ -4,7 +4,7 @@
|
||||
|
||||
Name: nagios-nrpe
|
||||
Version: 2.15
|
||||
Release: 2mamba
|
||||
Release: 3mamba
|
||||
Summary: Nagios Remote Plugin Executor (NRPE)
|
||||
Group: Network/Monitoring
|
||||
Vendor: openmamba
|
||||
@ -14,11 +14,16 @@ URL: http://www.nagios.org
|
||||
Source0: http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-%{version}/nrpe-%{version}.tar.gz
|
||||
Source1: nagios-nrpe.sysconfig
|
||||
Source2: nagios-commands-nrpe.cfg
|
||||
Source3: nrpe.service
|
||||
Source4: nrpe.socket
|
||||
Source5: nrpe.tmpfiles
|
||||
Source6: nrpe@.service
|
||||
Patch0: %{name}-2.13-initscript_add_reload.patch
|
||||
Patch1: %{name}-2.13-initscript_extra_options.patch
|
||||
Patch2: %{name}-2.13-include_nrpe_d_directory.patch
|
||||
Patch3: %{name}-2.13-initscript_return_codes.patch
|
||||
Patch4: %{name}-2.13-relocate_pid_file.patch
|
||||
Patch5: nrpe-2.15-rundir.patch
|
||||
License: GPL
|
||||
## AUTOBUILDREQ-BEGIN
|
||||
BuildRequires: glibc-devel
|
||||
@ -28,6 +33,7 @@ BuildRequires: libopenssl-devel
|
||||
Requires: initscripts
|
||||
Provides: nrpe = %{?epoch:%epoch:}%{version}-%{release}
|
||||
Requires: nagios-plugins
|
||||
%systemd_requires
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
|
||||
%description
|
||||
@ -50,6 +56,7 @@ The plugin then uses the output and return code from the plugin execution on the
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
|
||||
%build
|
||||
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
|
||||
@ -70,17 +77,27 @@ CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
|
||||
|
||||
%install
|
||||
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
|
||||
install -D -p -m 0755 init-script %{buildroot}/%{_initrddir}/nrpe
|
||||
#install -D -p -m 0755 init-script %{buildroot}/%{_initrddir}/nrpe
|
||||
install -D -p -m 0644 sample-config/nrpe.cfg %{buildroot}/%{_sysconfdir}/nagios/nrpe.cfg
|
||||
install -D -p -m 0755 src/nrpe %{buildroot}%{_sbindir}/nrpe
|
||||
install -D -p -m 0755 src/check_nrpe %{buildroot}%{_libdir}/nagios/plugins/check_nrpe
|
||||
install -D -p -m 0644 %{S:1} %{buildroot}/%{_sysconfdir}/sysconfig/nrpe
|
||||
|
||||
install -d %{buildroot}%{_sysconfdir}/nrpe.d
|
||||
install -d %{buildroot}%{_localstatedir}/run/nrpe
|
||||
|
||||
install -D -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/nagios/conf.d/commands-nrpe.cfg
|
||||
|
||||
install -D -m0644 %{SOURCE3} %{buildroot}%{_unitdir}/nrpe.service
|
||||
install -D -m0644 %{SOURCE4} %{buildroot}%{_unitdir}/nrpe.socket
|
||||
install -D -m0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/nrpe.conf
|
||||
install -D -m0644 %{SOURCE6} %{buildroot}%{_unitdir}/nrpe@.service
|
||||
|
||||
install -d %{buildroot}%{_sysconfdir}/sudoers.d
|
||||
cat > %{buildroot}%{_sysconfdir}/sudoers.d/nrpe << _EOF
|
||||
nrpe ALL=(root) NOPASSWD:%{_prefix}/lib/nagios/plugins/check_ide_smart
|
||||
nrpe ALL=(root) NOPASSWD:%{_prefix}/lib/nagios/plugins/check_disk
|
||||
_EOF
|
||||
|
||||
%clean
|
||||
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
|
||||
|
||||
@ -91,33 +108,33 @@ getent passwd %{nrpeuser} >/dev/null || \
|
||||
-r -g %{nrpegroup} -s /sbin/nologin %{nrpeuser} 2>/dev/null
|
||||
exit 0
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ]; then
|
||||
/sbin/service nrpe stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del nrpe
|
||||
fi
|
||||
exit 0
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add nrpe
|
||||
exit 0
|
||||
|
||||
%postun
|
||||
if [ "$1" -ge "1" ]; then
|
||||
/sbin/service nrpe condrestart >/dev/null 2>&1
|
||||
if [ $1 -ge 1 ]; then
|
||||
systemctl -q daemon-reload
|
||||
%tmpfiles_create nrpe.conf
|
||||
fi
|
||||
exit 0
|
||||
:
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
systemctl -q daemon-reload
|
||||
fi
|
||||
:
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_sbindir}/nrpe
|
||||
%{_initrddir}/nrpe
|
||||
%{_sysconfdir}/sudoers.d/nrpe
|
||||
%config(noreplace) %{_sysconfdir}/nagios/nrpe.cfg
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/nrpe
|
||||
%{_sbindir}/nrpe
|
||||
%dir %{_sysconfdir}/nagios
|
||||
%dir %{_sysconfdir}/nrpe.d
|
||||
%dir %attr(775, %{nrpeuser}, %{nrpegroup}) %{_localstatedir}/run/nrpe
|
||||
%doc LEGAL README README.SSL SECURITY docs/NRPE.pdf
|
||||
%{_unitdir}/nrpe.service
|
||||
%{_unitdir}/nrpe.socket
|
||||
%{_unitdir}/nrpe@.service
|
||||
%{_tmpfilesdir}/nrpe.conf
|
||||
%doc LEGAL
|
||||
#%doc README README.SSL SECURITY docs/NRPE.pdf
|
||||
|
||||
%files -n nagios-plugins-nrpe
|
||||
%defattr(-,root,root,-)
|
||||
@ -125,6 +142,9 @@ exit 0
|
||||
%{_libdir}/nagios/plugins/check_nrpe
|
||||
|
||||
%changelog
|
||||
* Sun Dec 27 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.15-3mamba
|
||||
- systemd support
|
||||
|
||||
* Wed May 07 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 2.15-2mamba
|
||||
- require nagios-plugins
|
||||
- install a default nrpe command configuration for nagios
|
||||
|
12
nrpe-2.15-rundir.patch
Normal file
12
nrpe-2.15-rundir.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nru nrpe-2.15.orig/sample-config/nrpe.cfg.in nrpe-2.15/sample-config/nrpe.cfg.in
|
||||
--- nrpe-2.15.orig/sample-config/nrpe.cfg.in 2015-12-27 12:52:52.736007937 +0100
|
||||
+++ nrpe-2.15/sample-config/nrpe.cfg.in 2015-12-27 12:54:57.440985520 +0100
|
||||
@@ -23,7 +23,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=/var/run/nrpe/nrpe.pid
|
||||
+pid_file=/run/nrpe/nrpe.pid
|
||||
|
||||
|
||||
|
13
nrpe.service
Normal file
13
nrpe.service
Normal file
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Daemon to answer plugin requests from Nagios on remote hosts
|
||||
After=network.target
|
||||
Requires=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=nrpe
|
||||
Group=nrpe
|
||||
ExecStart=/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
9
nrpe.socket
Normal file
9
nrpe.socket
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=NRPE Socket for Per-Connection Servers
|
||||
|
||||
[Socket]
|
||||
ListenStream=5666
|
||||
Accept=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
1
nrpe.tmpfiles
Normal file
1
nrpe.tmpfiles
Normal file
@ -0,0 +1 @@
|
||||
d /run/nrpe 0755 nrpe nrpe -
|
8
nrpe@.service
Normal file
8
nrpe@.service
Normal file
@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=NRPE Per-Connection Server
|
||||
|
||||
[Service]
|
||||
ExecStart=-/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg --inetd
|
||||
User=nrpe
|
||||
Group=nrpe
|
||||
StandardInput=socket
|
Loading…
Reference in New Issue
Block a user