Module: check_mk
Branch: master
Commit: aa0567e515a57646175348bacaccd50918278e50
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=aa0567e515a576…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 21 08:22:44 2011 +0100
canon_pages: Added new check for monitoring processed pages on canon
printer/multi-function devices
---
checkman/canon_pages | 18 ++++++++++++
checks/canon_pages | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/checkman/canon_pages b/checkman/canon_pages
new file mode 100644
index 0000000..103b4b7
--- /dev/null
+++ b/checkman/canon_pages
@@ -0,0 +1,18 @@
+title: Monitors printed/scanned pages in canon printers
+agents: snmp
+author: Lars Michelsen <lm(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check reads the number of printed pages separated by paper format and
+ colored or black/white print jobs. If supported by the device the check also
+ monitors the number of scanned pages.
+
+ This check can be used with all printer supporting the {CANON-MIB}
+ (.1.3.6.1.4.1.1602.1.11).
+
+perfdata:
+ The number of processed pages. The label is {count} for all services.
+
+inventory:
+ One service is being created for each measure point
diff --git a/checks/canon_pages b/checks/canon_pages
new file mode 100644
index 0000000..48d2cec
--- /dev/null
+++ b/checks/canon_pages
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+# Author: Lars Michelsen <lm(a)mathias-kettner.de>de>, 2011-03-16
+
+# [[['301', '28495']], [['112', '24']], [['113',
'14880']], [['122', '146']], [['123', '15870']],
[['501', '3761']], [['101', '30920']]]
+
+canon_pages_map = {
+ '101': 'total',
+ '112': 'b/w A3',
+ '113': 'b/w A4',
+ '122': 'color A3',
+ '123': 'color A4',
+ '301': 'print total',
+ '501': 'scan',
+}
+
+def inventory_canon_pages(checkname, info):
+ inventory = []
+ for data in info:
+ if data:
+ inventory.append((canon_pages_map.get(data[0][0],
+ 'unknown-%s' % data[0][0]), None))
+ return inventory
+
+def check_canon_pages(item, params, info):
+ for data in info:
+ if not data or not data[0]:
+ continue
+ index, value = data[0]
+ if canon_pages_map.get(index, 'unknown-'+index) == item:
+ return (0, 'OK - Current count: %s' % value, [('count',
value)])
+
+ return (3, 'UNKNOWN - Item not found in SNMP')
+
+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, 101 ]), # count total
+ ( ".1.3.6.1.4.1.1602.1.11.1.3.1.4", [ OID_END, 112 ]), # count b/w A3
+ ( ".1.3.6.1.4.1.1602.1.11.1.3.1.4", [ OID_END, 113 ]), # count b/w A4
+ ( ".1.3.6.1.4.1.1602.1.11.1.3.1.4", [ OID_END, 122 ]), # count color A3
+ ( ".1.3.6.1.4.1.1602.1.11.1.3.1.4", [ OID_END, 123 ]), # count color A4
+ ( ".1.3.6.1.4.1.1602.1.11.1.3.1.4", [ OID_END, 301 ]), # print total
+ ( ".1.3.6.1.4.1.1602.1.11.1.3.1.4", [ OID_END, 501 ]), # scan
+]
+
+snmp_scan_functions['canon_pages'] = lambda oid:
oid("1.3.6.1.4.1.1602.1.1.1.1.0") != None