]> git.pld-linux.org Git - packages/cacti-template-nagiostats.git/commitdiff
- replace poller with shell version of the script
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 13 Dec 2010 08:47:11 +0000 (08:47 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    cacti-template-nagiostats.spec -> 1.4
    check_nagios.sh -> 1.1

cacti-template-nagiostats.spec
check_nagios.sh [new file with mode: 0644]

index fa434ff15da7a05450fdcaf30a62fc13223ecd53..ce7b585bfc571e4c75026da085fdd37d87522b24 100644 (file)
@@ -4,12 +4,13 @@
 Summary:       Nagios Statistics - Cacti scripts and templates
 Name:          cacti-template-%{template}
 Version:       0.1
-Release:       0.5
+Release:       0.6
 License:       GPL v2
 Group:         Applications/WWW
 Source0:       http://forums.cacti.net/download/file.php?id=18185#/nacti.tar.gz
 # Source0-md5: 758d07f15a58c845169b3359bce837c5
 Source1:       cacti_host_template_nagios_statistics.xml
+Source2:       check_nagios.sh
 Patch0:                pld.patch
 URL:           http://forums.cacti.net/about33806.html
 BuildRequires: rpmbuild(macros) >= 1.554
@@ -33,11 +34,13 @@ Template for Cacti - Nagios statistics.
 %setup -qc
 %patch0 -p1
 cp -a %{SOURCE1} .
+cp -a %{SOURCE2} .
+%{__sed} -i -e 's,check_nagios.pl,check_nagios.sh,' *
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{nagioscgidir}}
-install -p check_nagios.pl $RPM_BUILD_ROOT%{scriptsdir}
+install -p check_nagios.sh $RPM_BUILD_ROOT%{scriptsdir}
 install -p mrtgstats.cgi $RPM_BUILD_ROOT%{nagioscgidir}
 
 cp -a *.xml $RPM_BUILD_ROOT%{resourcedir}
@@ -57,7 +60,7 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(644,root,root,755)
 %doc README
-%attr(755,root,root) %{scriptsdir}/check_nagios.pl
+%attr(755,root,root) %{scriptsdir}/check_nagios.sh
 %{resourcedir}/*.xml
 
 # nagios-cacti-nagiostats
diff --git a/check_nagios.sh b/check_nagios.sh
new file mode 100644 (file)
index 0000000..90712ad
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# vim:ft=sh
+# enable for debugging:
+set -x
+exec 2>>/tmp/nagios-cacti.log
+#exec 1>&2
+
+url="$1"
+type="$2"
+user="$3"
+password="$4"
+
+# Remove trailing slash if needed
+url="${url%/}"
+
+# pass user and password conditionally.
+# this way we can even have passwords in them.
+# retry only once with timeout of 30s
+wget -t 1 -T 30 --no-check-certificate -q -O- ${user:+--user="$user" --password="$password"} "$url/mrtgstats.cgi?type=$type"
+echo $? >&2
This page took 0.096935 seconds and 4 git commands to generate.