Module: check_mk
Branch: master
Commit: 675be85495632e8280d49972032fb6781556793a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=675be85495632e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Aug 14 16:49:05 2014 +0200
#1006 printer_pages: add Perf-O-Meter and PNP template
---
.werks/1006 | 9 +++++++++
ChangeLog | 1 +
checks/canon_pages | 16 +++++++++-------
checks/printer_pages | 2 +-
web/plugins/perfometer/check_mk.py | 7 +++++++
5 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/.werks/1006 b/.werks/1006
new file mode 100644
index 0000000..e8adc7c
--- /dev/null
+++ b/.werks/1006
@@ -0,0 +1,9 @@
+Title: printer_pages: add Perf-O-Meter and PNP template
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1408027731
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 1a8592e..455cfaa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,7 @@
NOTE: Please refer to the migration notes!
* 1174 rms200_temp: New Temperature check for RMS200 Devices
* 1175 dell_idrac_disks: New Check for Harddisks using Dell iDrac
+ * 1006 printer_pages: add Perf-O-Meter and PNP template
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checks/canon_pages b/checks/canon_pages
index 17b1cea..2e2af46 100644
--- a/checks/canon_pages
+++ b/checks/canon_pages
@@ -49,14 +49,16 @@ def check_canon_pages(item, _no_params, info):
return (3, "unknown counter type %s" % item)
for endoid, value in info:
if endoid == canon_pages_map[item]:
- return (0, 'Current count: %s' % value, [('count',
int(value))])
+ return (0, '%s pages printed' % value, [('count',
int(value))])
return (3, 'Item not found in SNMP data')
+check_info["canon_pages"] = {
+ 'check_function': check_canon_pages,
+ 'inventory_function': inventory_canon_pages,
+ 'service_description': 'Pages %s',
+ 'has_perfdata': True,
+ 'snmp_info': ( ".1.3.6.1.4.1.1602.1.11.1.3.1.4", [
OID_END, "" ]),
+ 'snmp_scan_function': lambda oid:
oid(".1.3.6.1.4.1.1602.1.1.1.1.0") != None
+}
-check_info['canon_pages'] = (check_canon_pages, "Pages %s", 1,
inventory_canon_pages)
-
-snmp_info['canon_pages'] = \
- ( ".1.3.6.1.4.1.1602.1.11.1.3.1.4", [ OID_END, "" ])
-
-snmp_scan_functions['canon_pages'] = lambda oid:
oid(".1.3.6.1.4.1.1602.1.1.1.1.0") != None
diff --git a/checks/printer_pages b/checks/printer_pages
index 81d21bc..809cf6f 100644
--- a/checks/printer_pages
+++ b/checks/printer_pages
@@ -29,7 +29,7 @@ def inventory_printer_pages(info):
def check_printer_pages(_no_item, _no_params, info):
pages = saveint(info[0][0])
- infotext = "%d Pages printed" % pages
+ infotext = "%d pages printed" % pages
perfdata = [ ( "pages", pages ) ]
return (0, "%s" % infotext, perfdata)
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 856ba19..f33f983 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -731,6 +731,13 @@ def perfometer_check_mk_printer_supply(row, check_command,
perf_data):
perfometers["check_mk-printer_supply"] = perfometer_check_mk_printer_supply
perfometers["check_mk-printer_supply_ricon"] =
perfometer_check_mk_printer_supply
+def perfometer_printer_pages(row, check_command, perf_data):
+ color = "#909090"
+ return "%d" % int(perf_data[0][1]), perfometer_logarithmic(perf_data[0][1],
50000, 6, color)
+
+perfometers["check_mk-printer_pages"] = perfometer_printer_pages
+perfometers["check_mk-canon_pages"] = perfometer_printer_pages
+
def perfometer_msx_queues(row, check_command, perf_data):
length = int(perf_data[0][1])
state = row["service_state"]