Module: check_mk
Branch: master
Commit: c6c784a3962c8c8fb16285108ca76e5956976177
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c6c784a3962c8c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Feb 22 18:51:43 2012 +0100
postfix_mailq: handle alternative agent output
---
ChangeLog | 1 +
checks/postfix_mailq | 21 ++++++++++++++++++---
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 60b24ed..1196ce3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,7 @@
output from agent now.
* ntp: do not check 'when' anymore since it can produce false
alarms.
+ * postfix_mailq: handle output with 'Total requests:' in last line
Multisite:
* Added several missing localization strings
diff --git a/checks/postfix_mailq b/checks/postfix_mailq
index 661112e..986ab06 100644
--- a/checks/postfix_mailq
+++ b/checks/postfix_mailq
@@ -51,6 +51,16 @@
# lm(a)larsmichelsen.com
#
# -- 1 Kbytes in 1 Request.
+#
+# Yet another one (I believe, this is from sendmail, though:)
+# <<<postfix_mailq>>>
+# 8BITMIME (Deferred: Connection refused by
mail.gargl.com.)
+# <franz(a)gargle.com>
+# q1L4ovDO002485 3176 Tue Feb 21 05:50 MAILER-DAEMON
+# (Deferred: 451 Try again later)
+# <wrdlpfrmpft(a)karl-valentin.com>
+# Total requests: 2
+#
# WARN num, CRIT num
postfix_mailq_default_levels = (10, 20)
@@ -73,9 +83,14 @@ def check_postfix_mailq(item, params, info):
if " ".join(line[-2:]) == 'is empty':
return (0, 'OK - The mailqueue is empty ', [ ('length', 0,
params[0], params[1]),
('size', '0')
])
- elif line[0] == '--':
- size = postfix_mailq_to_bytes(float(line[1]), line[2])
- len = int(line[4])
+ elif line[0] == '--' or line[0:2] == [ 'Total',
'requests:']:
+ if line[0] == '--':
+ size = postfix_mailq_to_bytes(float(line[1]), line[2])
+ len = int(line[4])
+ else:
+ size = 0
+ len = int(line[2])
+
perfdata = [ ('length', len, params[0], params[1]),
('size', '%d' % size) ]