Module: check_mk
Branch: master
Commit: 1324eafed9e40230d0f9e3ea29fd53b11289eb75
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1324eafed9e402…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Dec 3 16:25:22 2014 +0100
#1567 postfix_mailq: speedup in Linux agent for large mail queues
Instead of the <tt>mailq</tt> command we now use <tt>du</tt> and
<tt>wc</tt> in order to count
the number and size o requests. This is substantially faster, since
<tt>mailq</tt> needs
to open every single mail file. Thanks to Max Matslovfa.
---
.werks/1567 | 11 +++++++++++
ChangeLog | 1 +
agents/check_mk_agent.linux | 4 +++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/.werks/1567 b/.werks/1567
new file mode 100644
index 0000000..a4f8424
--- /dev/null
+++ b/.werks/1567
@@ -0,0 +1,11 @@
+Title: postfix_mailq: speedup in Linux agent for large mail queues
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417620214
+Class: feature
+
+Instead of the <tt>mailq</tt> command we now use <tt>du</tt> and
<tt>wc</tt> in order to count
+the number and size o requests. This is substantially faster, since
<tt>mailq</tt> needs
+to open every single mail file. Thanks to Max Matslovfa.
diff --git a/ChangeLog b/ChangeLog
index 916c011..cf6f8d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,7 @@
NOTE: Please refer to the migration notes!
* 1592 AIX: New Plugin to monitor errpt in logwatch style...
* 1565 mem.win: set default levels for page file to 80%/90%
+ * 1567 postfix_mailq: speedup in Linux agent for large mail queues...
* 1478 FIX: kernel.util, statgrab_cpu: fix computation of utilization...
* 1480 FIX: brocade_vdx_status: disable check on some devices that do not support
it...
* 1485 FIX: dell_om_disks, dell_om_esmlog, dell_om_mem, dell_om_processors,
dell_om_sensors: detect more devices...
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index c734bb1..51b425b 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -503,7 +503,9 @@ fi
# but it could be used to get the timestamp of the last message.
if type mailq >/dev/null 2>&1 && [ -x /usr/sbin/postfix ] &&
getent passwd postfix >/dev/null 2>&1; then
echo '<<<postfix_mailq>>>'
- mailq | tail -n 6
+ echo -- \
+ $(du -kd0 $(postconf -h queue_directory)/deferred | awk '{print $1 }')
Kbytes in \
+ $(find $(postconf -h queue_directory)/deferred/. ! -name '?' -print | wc
-l) Requests.
elif [ -x /usr/sbin/ssmtp ] ; then
echo '<<<postfix_mailq>>>'
mailq 2>&1 | sed 's/^[^:]*: \(.*\)/\1/' | tail -n 6