Module: check_mk
Branch: master
Commit: 67d7cf697cc4440ac875ddcb3a4f9ec63149cf64
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=67d7cf697cc444…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 17 11:55:31 2013 +0100
Add: mailman_lists - New check to gather statistics of mailman mailinglists
---
.bugs/757 | 2 +-
ChangeLog | 1 +
agents/plugins/mailman_lists | 30 ++++++++++++++++++++++++++++++
checkman/mailman_lists | 16 ++++++++++++++++
checks/mailman_lists | 42 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 90 insertions(+), 1 deletions(-)
diff --git a/.bugs/757 b/.bugs/757
index d647c09..da907dd 100644
--- a/.bugs/757
+++ b/.bugs/757
@@ -2,7 +2,7 @@ Title: Compilation of livecheck with dietlibc broken on SLES11SP1/2
Component: livecheck
State: open
Date: 2012-05-25 10:28:46
-Targetversion: 1.2.2
+Targetversion: future
Class: nastiness
Generally we should enable compiling livecheck with dietlibc in
diff --git a/ChangeLog b/ChangeLog
index 3936fd7..40ed03c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
* Add: fileinfo is now supported by the solaris agent. Thanks to Daniel Roettgermann
* Logwatch: unknown eventlog level ('u') from windows agent treated as
warning
* FIX: logwatch_ec: Added state undefined as priority
+ * Add: mailman_lists - New check to gather statistics of mailman mailinglists
Multisite:
* FIX: Fixed rendering of dashboard globes in opera
diff --git a/agents/plugins/mailman_lists b/agents/plugins/mailman_lists
new file mode 100755
index 0000000..9371082
--- /dev/null
+++ b/agents/plugins/mailman_lists
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+# encoding: utf-8
+# This Check_MK-Agent plugin gathers information about mailinglists hosted
+# by the local mailman instance.
+
+# Needed if you have located your mailman python modules not in default
+# python module paths
+import sys
+sys.path.append("/usr/local/mailman")
+
+# Set to True to filter out all "hidden" mailinglists
+only_advertised = True
+
+from Mailman import Utils, MailList
+
+# 1. list memberships
+print '<<<mailman_lists>>>'
+total_members = set([])
+for name in sorted(Utils.list_names()):
+ mlist = MailList.MailList(name, lock=0)
+ if only_advertised and not mlist.advertised:
+ continue
+
+ rmembers = mlist.getRegularMemberKeys()
+ dmembers = mlist.getDigestMemberKeys()
+ members = rmembers + dmembers
+ total_members.update(members)
+
+ print '%s %d' % (name, len(members))
+print 'TOTAL %d' % len(total_members)
diff --git a/checkman/mailman_lists b/checkman/mailman_lists
new file mode 100644
index 0000000..73252d3
--- /dev/null
+++ b/checkman/mailman_lists
@@ -0,0 +1,16 @@
+title: Monitor mailinglist statistics of Mailman
+agents: linux
+author: Lars Michelsen <lm(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check gathers statistics of Mailinglists hosted with Mailman.
+ Currently the check monitors only the number of subscribed members
+ but might be extended by other statistic information.
+
+ To make this check work, you have to install the mailman_lists
+ agent plugin on your the host running mailman.
+
+inventory:
+ Each mailinglist results in one service. The service is named by
+ the internal name of the mailinglist
diff --git a/checks/mailman_lists b/checks/mailman_lists
new file mode 100644
index 0000000..a3dee84
--- /dev/null
+++ b/checks/mailman_lists
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+def inventory_mailman_lists(info):
+ return [ (i[0], None) for i in info ]
+
+def check_mailman_lists(item, params, info):
+ for line in info:
+ name, num_members = line[0], saveint(line[1])
+ if name == item:
+ return (0, 'OK - %d members subcribed' % (num_members),
[('count', num_members)])
+ return (3, 'UNKNOWN - List could not be found in agent output')
+
+check_info["mailman_lists"] = {
+ "check_function" : check_mailman_lists,
+ "inventory_function" : inventory_mailman_lists,
+ "service_description" : "Mailinglist %s",
+ "has_perfdata" : True,
+}