[packages/nagios-plugin-check_scan: 2/5] add state dir
glen
glen at pld-linux.org
Mon Jun 8 14:18:36 CEST 2015
commit f870cc691e4b8b142573847f5f1913b2170859c6
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Mon Jun 8 15:13:55 2015 +0300
add state dir
nagios-plugin-check_scan.spec | 10 +++++---
pld.patch | 58 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 3 deletions(-)
---
diff --git a/nagios-plugin-check_scan.spec b/nagios-plugin-check_scan.spec
index 0d66032..66c948c 100644
--- a/nagios-plugin-check_scan.spec
+++ b/nagios-plugin-check_scan.spec
@@ -7,17 +7,19 @@ License: GPL v2+
Group: Networking
Source0: http://www.altsec.info/check_scan.sh
# Source0-md5: 8e79becb95012c2aedf0b9c68373f928
+Patch0: pld.patch
URL: http://www.altsec.info/check_scan.html
-Requires: nagios-common
+Requires: coreutils
Requires: grep
+Requires: nagios-common
Requires: nmap
-Requires: coreutils
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _sysconfdir /etc/nagios/plugins
%define nrpeddir /etc/nagios/nrpe.d
%define plugindir %{_prefix}/lib/nagios/plugins
+%define statedir /var/lib/nagios/check_scan
%description
A nmap scanner plugin for Nagios
@@ -35,10 +37,11 @@ root.
%prep
%setup -qcT
cp -p %{SOURCE0} %{plugin}
+%patch0 -p1
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{plugindir}}
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{plugindir},%{statedir}}
install -p %{plugin} $RPM_BUILD_ROOT%{plugindir}/%{plugin}
%clean
@@ -47,3 +50,4 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%attr(755,root,root) %{plugindir}/%{plugin}
+%dir %attr(770,root,nagios) %{statedir}
diff --git a/pld.patch b/pld.patch
new file mode 100644
index 0000000..ee60ab0
--- /dev/null
+++ b/pld.patch
@@ -0,0 +1,58 @@
+--- nagios-plugin-check_scan/check_scan~ 2015-06-08 15:10:59.829649097 +0300
++++ nagios-plugin-check_scan/check_scan 2015-06-08 15:11:24.537599653 +0300
+@@ -60,11 +60,20 @@
+ # 3. incorporate critical port lists
+ #
+ # - - - - - - - - SET THESE VARIABLES - - - - - - - - - - - -
+-BASEDIR=/etc/nagios/scancheck #where to keep everything
+- #must be nagios user writable
+-NMAPPATH=/usr/bin #where is nmap
++# where to keep everything
++# must be nagios user writable
++BASEDIR=/var/lib/nagios/check_scan
++# where is nmap
++NMAPPATH=/usr/bin
+ #------------------------------------------------------------
+
++# constants from utils.sh
++STATE_OK=0
++STATE_WARNING=1
++STATE_CRITICAL=2
++STATE_UNKNOWN=3
++STATE_DEPENDENT=4
++
+ #note... to run manually, you have to supply a dummy
+ #argument 1, since the ip address is arg2
+
+@@ -73,7 +82,7 @@
+ if [ ! "$IP" ]; then
+
+ echo "No IP address supplied"
+- exit 0
++ exit $STATE_UNKNOWN
+
+ fi
+
+@@ -130,19 +139,19 @@
+
+ /bin/cat $SCANDIR/$IP > $SCANDIR/$IP.base
+ echo "Initial scan"
+- exit 0
++ exit $STATE_OK
+
+ fi
+
+ if [ $CHANGED -eq 1 ]; then
+
+ echo "Scan $SCANTIME: NEW $DIFFSTR"
+- exit 1
++ exit $STATE_WARNING
+
+ else
+
+ echo "$SCANTIME: no change"
+- exit 0
++ exit $STATE_OK
+
+ fi
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/nagios-plugin-check_scan.git/commitdiff/ddb074f73a0d022d05cfc8307552149cf2e713f5
More information about the pld-cvs-commit
mailing list