Module: check_mk
Branch: master
Commit: df64712f7c67d976e9a23a904df7c7c4f6b7af12
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=df64712f7c67d9…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Wed Jul 18 10:59:16 2018 +0200
6122 zebra_model, zebra_printer_status: new checks for zebra printers
Change-Id: Ib61e0bbbf864a3c077d89359360e0c71ae97367d
---
.werks/6122 | 10 ++++++
checkman/zebra_model | 10 ++++++
checkman/zebra_printer_status | 11 ++++++
checks/zebra_model | 79 +++++++++++++++++++++++++++++++++++++++++++
checks/zebra_printer_status | 54 +++++++++++++++++++++++++++++
5 files changed, 164 insertions(+)
diff --git a/.werks/6122 b/.werks/6122
new file mode 100644
index 0000000..feff0ae
--- /dev/null
+++ b/.werks/6122
@@ -0,0 +1,10 @@
+Title: zebra_model, zebra_printer_status: new checks for zebra printers
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1531904294
+Class: feature
+
+
diff --git a/checkman/zebra_model b/checkman/zebra_model
new file mode 100644
index 0000000..603c544
--- /dev/null
+++ b/checkman/zebra_model
@@ -0,0 +1,10 @@
+title: Zebra Model
+agents: snmp
+catalog: hw/printer
+license: GPL
+distribution: check_mk
+description:
+ This checks shows the model, serial number and firmware version of Zebra printers. The
status of the service is always {OK}.
+
+inventory:
+ One check per device is created.
diff --git a/checkman/zebra_printer_status b/checkman/zebra_printer_status
new file mode 100644
index 0000000..4be2b7b
--- /dev/null
+++ b/checkman/zebra_printer_status
@@ -0,0 +1,11 @@
+title: Zebra Printer Status
+agents: snmp
+catalog: hw/printer
+license: GPL
+distribution: check_mk
+description:
+ This checks shows the printer status of a Zebra printer. If a printer is offline the
status of the check
+ is {CRITICAL}, if the printer is online, printing or warming up the status is {OK}.
+
+inventory:
+ One check per device is created.
diff --git a/checks/zebra_model b/checks/zebra_model
new file mode 100644
index 0000000..2694318
--- /dev/null
+++ b/checks/zebra_model
@@ -0,0 +1,79 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2018 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-
+# tails. 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.
+
+
+def inventory_zebra_model(info):
+ if info[0] != [] or info[1] != [] or info[2] != []:
+ return [(None, {})]
+
+
+def check_zebra_model(_no_item, _no_params, info):
+ model, serial, release = None, None, None
+
+ if info[0]:
+ model, serial, release, serial_maybe = info[0][0]
+ if not serial:
+ serial = serial_maybe
+
+ if not model:
+ model = info[2][0][0]
+
+ if not release:
+ release = info[1][0][0]
+
+ yield 0, "Zebra model: %s" % model
+
+ if serial:
+ yield 0, "Serial number: %s" % serial
+
+ if release:
+ yield 0, "Firmware release: %s" % release
+
+
+check_info["zebra_model"] = {
+ "check_function":
+ check_zebra_model,
+ "inventory_function":
+ inventory_zebra_model,
+ "service_description":
+ "Zebra Printer Model",
+ "snmp_info": [
+ (
+ ".1.3.6.1.4.1.10642",
+ ["1.1.0", "200.19.5.0", "1.2.0",
"1.9.0"],
+ ),
+ (
+ ".1.3.6.1.4.1.683.1.9",
+ ["0"],
+ ),
+ (
+ ".1.3.6.1.4.1.683.6.2.3.2.1.15",
+ ["1"],
+ ),
+ ],
+ "snmp_scan_function":
+ lambda oid: "zebra" in oid(".1.3.6.1.2.1.1.1.0").lower()
+}
diff --git a/checks/zebra_printer_status b/checks/zebra_printer_status
new file mode 100644
index 0000000..6e60b92
--- /dev/null
+++ b/checks/zebra_printer_status
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2018 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-
+# tails. 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.
+
+
+def inventory_zebra_printer_status(info):
+ if info[0][0]:
+ return [(None, {})]
+
+
+def check_zebra_printer_status(item, params, info):
+ zebra_status = saveint(info[0][0])
+
+ if zebra_status == 3:
+ return 0, "Printer is online and ready for the next print job"
+ elif zebra_status == 4:
+ return 0, "Printer is printing"
+ elif zebra_status == 5:
+ return 0, "Printer is warming up"
+ elif zebra_status == 1:
+ return 2, "Printer is offline"
+ else:
+ return 3, "Unknown printer status"
+
+
+check_info["zebra_printer_status"] = {
+ "check_function": check_zebra_printer_status,
+ "inventory_function": inventory_zebra_printer_status,
+ "service_description": "Zebra Printer Status",
+ "snmp_info": (".1.3.6.1.2.1.25.3.5.1.1", ["1"]),
+ "snmp_scan_function": lambda oid: "zebra" in
oid(".1.3.6.1.2.1.1.1.0").lower()
+}