Module: check_mk
Branch: master
Commit: 6a95d3df16ad2223c26bde073e325029619407ce
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6a95d3df16ad22…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 27 15:48:54 2016 +0100
#3034 FIX cups_queues: Fixed bug when no user name available for a print job
---
.werks/3034 | 9 +++++++++
ChangeLog | 1 +
checks/cups_queues | 12 ++++--------
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/.werks/3034 b/.werks/3034
new file mode 100644
index 0000000..5c3e9bb
--- /dev/null
+++ b/.werks/3034
@@ -0,0 +1,9 @@
+Title: cups_queues: Fixed bug when no user name available for a print job
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453906110
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 5d9abbf..b128181 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -227,6 +227,7 @@
* 2983 FIX: netapp_api_disk: fixed exception when disks were not included in the
raid...
* 2971 FIX: heartbeat_crm: Is now compatible with more forms of crm_mon output
formats
* 2972 FIX: df: Filesystem trends: Outputting less senseless time left in case of
nearly 0 growth
+ * 3034 FIX: cups_queues: Fixed bug when no user name available for a print job
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checks/cups_queues b/checks/cups_queues
index d5131c7..b561269 100644
--- a/checks/cups_queues
+++ b/checks/cups_queues
@@ -82,20 +82,16 @@ def check_cups_queues(item, params, info):
elif line[0].startswith(item+'-'):
# This is a queue item count the number of items and check the max age
numJobs += 1
- # Try to parse different time formats
- # Handle case where user names contain spaces
- # zam19-113565 Sebastian Hirschdobler 3561472 Fri Jul 31 12:58:01 2015
- time_parts = line[3:]
- while saveint(time_parts[0]) > 35:
- time_parts = time_parts[1:]
-
- timestring = ' '.join(time_parts)
+ # Try to parse different time formats. TODO: Couldn't we run the lpr
command
+ # with some environment var to fixate the date format?
try:
# Tue Jun 29 09:05:54 2010
+ timestring = ' '.join(line[-5:])
parsed = time.strptime(timestring, '%a %b %d %H:%M:%S %Y')
except:
# Thu 29 Aug 2013 12:41:42 AM CEST
+ timestring = ' '.join(line[-7:])
parsed = time.strptime(timestring, '%a %d %b %Y %H:%M:%S %p %Z')
dt = time.mktime(parsed)