Module: check_mk
Branch: master
Commit: ea941369a518787ec4ba0a62de718fc451465114
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ea941369a51878…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Apr 30 10:03:16 2013 +0200
Linux agent: cups_queues: do not monitor non-local queues (thanks to Olaf Morgenstern)
---
ChangeLog | 1 +
agents/check_mk_agent.linux | 17 +++++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e9999ee..e771335 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -80,6 +80,7 @@
new global config option: timeout_plugins_total
* lnx_if in Linux agent: force deterministical order of network devices
* Linux agent: remove obsolete old <<<netif>>> and
<<<netctr>>> sections
+ * Linux agent: cups_queues: do not monitor non-local queues (thanks to Olaf
Morgenstern)
Notifications:
* notify.py: unique spoolfiles name no longer created with uuid
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 86fc62e..c9f38ef 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -350,10 +350,19 @@ fi
# Status of CUPS printer queues
if type lpstat > /dev/null 2>&1; then
if pgrep cups > /dev/null 2>&1; then
- echo '<<<cups_queues>>>'
- waitmax 3 lpstat -p
- echo '---'
- waitmax 3 lpstat -o|sort
+ WAITMAX="waitmax 3"
+ CPRINTCONF=/etc/cups/printers.conf
+ if [ -r "$CPRINTCONF" ] ; then
+ for PQ in $(lpstat -a | awk '{print $1}') ; do
+ grep -q -x -F "<Printer $PQ>" $CPRINTCONF &&
$WAITMAX lpstat -p $PQ
+ done
+ echo '---'
+ for PQ in $(lpstat -a | awk '{print $1}') ; do
+ grep -q -x -F "<Printer $PQ>" $CPRINTCONF &&
$WAITMAX lpstat -o $PQ
+ done
+ else
+ $WAITMAX lpstat -p ; echo '---' ; $WAITMAX lpstat -o | sort
+ fi
fi
fi