Module: check_mk
Branch: master
Commit: b470765f6120c9ec815dece95a7f2b4c41e902c1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b470765f6120c9…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Fri Sep 29 15:49:26 2017 +0200
5339 postfix_mailq_status: Now reports if PID file is not readable
Change-Id: I00e85f75cd1bcbd70812a3e7e2c0b02b8382fc57
---
.werks/5339 | 10 ++++++++++
agents/check_mk_agent.linux | 12 ++++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/.werks/5339 b/.werks/5339
new file mode 100644
index 0000000..217d13a
--- /dev/null
+++ b/.werks/5339
@@ -0,0 +1,10 @@
+Title: postfix_mailq_status: Now reports if PID file is not readable
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1506692807
+Class: feature
+
+
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 37c12de..a3b3518 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -660,11 +660,15 @@ if type postfix >/dev/null ; then
for i in $(ls -d /var/spool/postfix*)
do
if [ -e "$i/pid/master.pid" ]; then
- postfix_pid=$(cat $i/pid/master.pid | sed 's/ //g') # handle
possible spaces in output
- if readlink -- "/proc/$postfix_pid/exe" | grep -q
".*postfix/\(sbin/\)\?master.*"; then
- echo "$i:the Postfix mail system is
running:PID:$postfix_pid" | sed 's/\/var\/spool\///g'
+ if [ -r "$i/pid/master.pid" ]; then
+ postfix_pid=$(cat $i/pid/master.pid | sed 's/ //g') # handle
possible spaces in output
+ if readlink -- "/proc/$postfix_pid/exe" | grep -q
".*postfix/\(sbin/\)\?master.*"; then
+ echo "$i:the Postfix mail system is
running:PID:$postfix_pid" | sed 's/\/var\/spool\///g'
+ else
+ echo "$i:PID file exists but instance is not running!"
| sed 's/\/var\/spool\///g'
+ fi
else
- echo "$i:PID file exists but instance is not running!" |
sed 's/\/var\/spool\///g'
+ echo "$i:PID file exists but is not readable"
fi
else
echo "$i:the Postfix mail system is not running" | sed
's/\/var\/spool\///g'