Module: check_mk
Branch: master
Commit: 0d62558694c9d4ff52e8163a5855638e75e9db42
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0d62558694c9d4…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Aug 14 17:07:55 2014 +0200
printer_input, printer_output: fixed precompile and default levels for output
---
checks/printer_input | 47 ++++++++++++++++++++++++++++
checks/{printer_io => printer_io.include} | 48 ++++-------------------------
checks/printer_output | 47 ++++++++++++++++++++++++++++
3 files changed, 100 insertions(+), 42 deletions(-)
diff --git a/checks/printer_input b/checks/printer_input
new file mode 100644
index 0000000..e20b867
--- /dev/null
+++ b/checks/printer_input
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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.
+
+check_info["printer_input"] = {
+ 'inventory_function': inventory_printer_io,
+ 'check_function': lambda item, params, info: check_printer_io(item,
params, info, 'input'),
+ 'service_description': 'Input %s',
+ 'has_perfdata': False,
+ 'snmp_info': (
+ '.1.3.6.1.2.1.43.8.2.1', [
+ '13', # Printer-MIB::prtInputName
+ '18', # Printer-MIB::prtInputDescription
+ '11', # Printer-MIB::prtInputStatus
+ '8', # Printer-MIB::prtInputCapacityUnit
+ '9', # Printer-MIB::prtInputMaxCapacity
+ '10', # Printer-MIB::prtInputCurrentLevel
+ ]
+ ),
+ 'snmp_scan_function': \
+ lambda oid: oid(".1.3.6.1.2.1.43.11.1.1.6.1.1") != None,
+ 'group': 'printer_input',
+ 'default_levels_variable': 'printer_input_default_levels',
+ 'includes': [ 'printer_io.include' ],
+}
diff --git a/checks/printer_io b/checks/printer_io.include
similarity index 73%
rename from checks/printer_io
rename to checks/printer_io.include
index 162f68c..43c7a92 100644
--- a/checks/printer_io
+++ b/checks/printer_io.include
@@ -56,10 +56,14 @@ printer_io_states = {
64: (0, 'Transitioning to intended state'),
}
-factory_settings['printer_io_default_levels'] = {
+factory_settings['printer_default_levels'] = {
'capacity_levels': (0.0, 0.0),
}
+factory_settings['printer_output_default_levels'] = {
+ 'capacity_levels': (100.0, 100.0),
+}
+
def inventory_printer_io(info):
for line in info:
snmp_status = saveint(line[2])
@@ -115,6 +119,7 @@ def check_printer_io(item, params, info, what):
else: # output
warn, crit = params['capacity_levels'] # percentage
levels
+ print warn, crit
if crit != None and level_perc >= crit:
state = 2
levels_txt = ' (>= %0.2f)' % crit
@@ -125,44 +130,3 @@ def check_printer_io(item, params, info, what):
yield state, 'Capacity: %s of %s %s %s%s' % \
(level_txt, capacity_max, capacity_unit, how, levels_txt)
-check_info["printer_input"] = {
- 'inventory_function': inventory_printer_io,
- 'check_function': lambda item, params, info: check_printer_io(item,
params, info, 'input'),
- 'service_description': 'Input %s',
- 'has_perfdata': False,
- 'snmp_info': (
- '.1.3.6.1.2.1.43.8.2.1', [
- '13', # Printer-MIB::prtInputName
- '18', # Printer-MIB::prtInputDescription
- '11', # Printer-MIB::prtInputStatus
- '8', # Printer-MIB::prtInputCapacityUnit
- '9', # Printer-MIB::prtInputMaxCapacity
- '10', # Printer-MIB::prtInputCurrentLevel
- ]
- ),
- 'snmp_scan_function': \
- lambda oid: oid(".1.3.6.1.2.1.43.11.1.1.6.1.1") != None,
- 'group': 'printer_input',
- 'default_levels_variable': 'printer_io_default_levels',
-}
-
-check_info["printer_output"] = {
- 'inventory_function': inventory_printer_io,
- 'check_function': lambda item, params, info: check_printer_io(item,
params, info, 'output'),
- 'service_description': 'Output %s',
- 'has_perfdata': False,
- 'snmp_info': (
- '.1.3.6.1.2.1.43.9.2.1', [
- '7', # Printer-MIB::prtOutputName
- '12', # Printer-MIB::prtOutputDescription
- '6', # Printer-MIB::prtOutputStatus
- '3', # Printer-MIB::prtOutputCapacityUnit
- '4', # Printer-MIB::prtOutputMaxCapacity
- '5', # Printer-MIB::prtOutputRemainingCapacity
- ]
- ),
- 'snmp_scan_function': \
- lambda oid: oid(".1.3.6.1.2.1.43.11.1.1.6.1.1") != None,
- 'group': 'printer_output',
- 'default_levels_variable': 'printer_io_default_levels',
-}
diff --git a/checks/printer_output b/checks/printer_output
new file mode 100644
index 0000000..9fea20a
--- /dev/null
+++ b/checks/printer_output
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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.
+
+check_info["printer_output"] = {
+ 'inventory_function': inventory_printer_io,
+ 'check_function': lambda item, params, info: check_printer_io(item,
params, info, 'output'),
+ 'service_description': 'Output %s',
+ 'has_perfdata': False,
+ 'snmp_info': (
+ '.1.3.6.1.2.1.43.9.2.1', [
+ '7', # Printer-MIB::prtOutputName
+ '12', # Printer-MIB::prtOutputDescription
+ '6', # Printer-MIB::prtOutputStatus
+ '3', # Printer-MIB::prtOutputCapacityUnit
+ '4', # Printer-MIB::prtOutputMaxCapacity
+ '5', # Printer-MIB::prtOutputRemainingCapacity
+ ]
+ ),
+ 'snmp_scan_function': \
+ lambda oid: oid(".1.3.6.1.2.1.43.11.1.1.6.1.1") != None,
+ 'group': 'printer_output',
+ 'default_levels_variable': 'printer_output_default_levels',
+ 'includes': [ 'printer_io.include' ],
+}