packages: nagios-plugin-check_mailman_qfiles/nagios-plugin-check_mailman_qf...

glen glen at pld-linux.org
Wed Aug 25 16:36:36 CEST 2010


Author: glen                         Date: Wed Aug 25 14:36:36 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- check also moderation queue in data dir

---- Files affected:
packages/nagios-plugin-check_mailman_qfiles:
   nagios-plugin-check_mailman_qfiles.spec (1.5 -> 1.6) , check-modqueue.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_mailman_qfiles/nagios-plugin-check_mailman_qfiles.spec
diff -u packages/nagios-plugin-check_mailman_qfiles/nagios-plugin-check_mailman_qfiles.spec:1.5 packages/nagios-plugin-check_mailman_qfiles/nagios-plugin-check_mailman_qfiles.spec:1.6
--- packages/nagios-plugin-check_mailman_qfiles/nagios-plugin-check_mailman_qfiles.spec:1.5	Mon Apr  5 21:04:03 2010
+++ packages/nagios-plugin-check_mailman_qfiles/nagios-plugin-check_mailman_qfiles.spec	Wed Aug 25 16:36:30 2010
@@ -4,11 +4,12 @@
 Summary:	Nagios plugin to check Mailman qfiles
 Name:		nagios-plugin-%{plugin}
 Version:	0.1
-Release:	2
+Release:	3
 License:	GPL
 Group:		Networking
 # Source0Download: http://exchange.nagios.org/components/com_mtree/attachment.php?link_id=1347&cf_id=24
 Source0:	%{plugin}.pl
+Patch0:	check-modqueue.patch
 URL:		http://exchange.nagios.org/directory/Plugins/Email-and-Groupware/Mailman/check_mailman_qfiles/details
 BuildRequires:	rpm-perlprov >= 4.1-13
 Requires:	nagios-common
@@ -28,6 +29,9 @@
 
 %prep
 %setup -qcT
+install -p %{SOURCE0} .
+%patch0 -p0
+
 cat > nagios.cfg <<'EOF'
 define command {
 	command_name    %{plugin}
@@ -38,7 +42,7 @@
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{plugindir}}
-install %{SOURCE0} $RPM_BUILD_ROOT%{plugindir}/%{plugin}
+install -p %{plugin}.pl $RPM_BUILD_ROOT%{plugindir}/%{plugin}
 cp -a nagios.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{plugin}.cfg
 
 %clean
@@ -55,6 +59,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.6  2010/08/25 14:36:30  glen
+- check also moderation queue in data dir
+
 Revision 1.5  2010/04/05 19:04:03  glen
 - use nagios-common instead of nagios-core; rel 2
 

================================================================
Index: packages/nagios-plugin-check_mailman_qfiles/check-modqueue.patch
diff -u /dev/null packages/nagios-plugin-check_mailman_qfiles/check-modqueue.patch:1.1
--- /dev/null	Wed Aug 25 16:36:36 2010
+++ packages/nagios-plugin-check_mailman_qfiles/check-modqueue.patch	Wed Aug 25 16:36:30 2010
@@ -0,0 +1,40 @@
+--- check_mailman_qfiles.pl	2009-08-04 08:34:39.246110511 +0300
++++ check_mailman_qfiles	2010-08-25 17:34:49.251923002 +0300
+@@ -13,6 +13,7 @@
+ use Getopt::Long;
+ 
+ my $qfiles_base = '/var/spool/mailman';
++my $qfiles_data = '/var/lib/mailman/data';
+ my %opts = (
+ 	warning => 5,   # 5 minutes
+ 	critical => 20, # 20 minutes
+@@ -54,6 +55,29 @@
+ 	}
+ }
+ 
++# check moderation queue
++my %modqueue;
++foreach (File::Find::Rule->file->name('heldmsg-*.pck')->in($qfiles_data)) {
++	if (my($list, $id) = /heldmsg-(.+)-(\d+)\.pck/) {
++		$modqueue{$list}++;
++	}
++}
++while (my($list, $count) = each %modqueue) {
++	if ($count > $opts{critical}) {
++		$problems{$list} = [ 'CRITICAL' ];
++		$problem_status = 'CRITICAL';
++	}
++	elsif ($count > $opts{warning}) {
++		$problems{$list} = [ 'WARNING' ];
++		$problem_status = 'WARNING' if ! $problem_status;;
++	}
++
++	if ($problems{$list}) {
++		$problems{$list}[1] = sprintf("%d moderation tasks", $count);
++	}
++}
++
++
+ if (! $problem_status) {
+ 	print "OK: all normal\n";
+ 	exit 0;
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_mailman_qfiles/nagios-plugin-check_mailman_qfiles.spec?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list