Module: check_mk
Branch: master
Commit: cd45ff86e1e13cfd3d8e129c49da1cff7654ff8f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cd45ff86e1e13c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 16:41:48 2011 +0100
three new checks for 3COM switches
---
ChangeLog | 3 ++
checkman/h3c_lanswitch_cpu | 30 +++++++++++++++++++++++++++
checkman/superstack3_sensors | 20 ++++++++++++++++++
checks/h3c_lanswitch_cpu | 33 ++++++++++++++++++++++++++++++
checks/h3c_lanswitch_sensors | 46 ++++++++++++++++++++++++++++++++++++++++++
checks/superstack3_sensors | 23 +++++++++++++++++++++
6 files changed, 155 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6b8edaa..9ade230 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,9 @@
of an ORACLE instances in the last 60 minutes.
* oracle_tablespaces: new check for monitoring size, state and autoextension
of ORACLE tablespaces.
+ * h3c_lanswitch_cpu: new check for monitoring CPU usage of H3C/HP/3COM switches
+ * h3c_lanswitch_sensors: new check for monitoring hardware sensors of H3C/HP/3COM switches
+ * superstack3_sensors: new check for monitoring hardware sensors of 3COM Superstack 3 switches
1.1.9i5:
Multisite:
diff --git a/checkman/h3c_lanswitch_cpu b/checkman/h3c_lanswitch_cpu
new file mode 100644
index 0000000..b7256a4
--- /dev/null
+++ b/checkman/h3c_lanswitch_cpu
@@ -0,0 +1,30 @@
+title: Check 3Com SuperStack 4 CPU Utilization
+agents: snmp
+author: Florian Heigl <fh(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This Check queries the CPU utilization for SuperStack 4 switches, either standalone or that of the CPUs of all units in the stack. Note these switches don't handle snmp well and you should lower the frequence of SNMP based checks with them.
+ The CPU usage ratio returned by the check is the average load of the last 60 seconds.
+
+
+inventory:
+ The check will add one service per Unit/CPU in a stack.
+
+[parameters]
+warning (int): the percentage of 1-minute average load at which the switch is considered too busy.
+
+critical (int): the percentage of 1-minute average load at which the switch is considered overloaded.
+
+
+[configuration]
+superstack4_cpu_default_levels (int, int): the warn and critical levels for the checkl.
+ They are set to default to 50% for "WARN" and 75% for "CRIT".
+
+
+item:
+ The CPU found by inventory (it's OID is a multiple of 65536 and will be divided to come to a sane value)
+
+
+perfdata:
+ It does not generate any performance data yet.
diff --git a/checkman/superstack3_sensors b/checkman/superstack3_sensors
new file mode 100644
index 0000000..65ead22
--- /dev/null
+++ b/checkman/superstack3_sensors
@@ -0,0 +1,20 @@
+title: Check 3Com SuperStack 3 Hardware / FRU sensors
+agents: snmp
+author: Florian Heigl <fh(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check queries the snmp sensors for internal and addon modules
+ of 3Com SuperStack 3 switches. It can notify you of a fan or add-on module failure.
+
+ It will generate OK status for any item that shows "operational" via SNMP, CRIT any that is in "failure" state and "warning" in all other states.
+
+
+item:
+ The description of the sensor as provided by the device.
+
+inventory:
+ One service is created for each item found in the switch.
+
+perfdata:
+ It does not generate any performance data as the info from the switches is just textual.
diff --git a/checks/h3c_lanswitch_cpu b/checks/h3c_lanswitch_cpu
new file mode 100644
index 0000000..5422d7a
--- /dev/null
+++ b/checks/h3c_lanswitch_cpu
@@ -0,0 +1,33 @@
+
+
+# Reasonably low warning and crit levels
+h3c_lanswitch_cpu_default_levels = (50, 75)
+
+
+def inventory_h3c_lanswitch_cpu(checkname, info):
+ return [ ( int(line[0]) / 65536 , "h3c_lanswitch_cpu_default_levels" ) for line in info ]
+
+def check_h3c_lanswitch_cpu(item, params, info):
+ warn, crit = params
+ for line in info:
+ unitid = int(line[0]) / 65536
+ if unitid == item:
+ util = int(line[1])
+ if util > crit:
+ return (2, "CRIT - Unit %d Utilization: %s%%" % (unitid, util) )
+ elif util > warn:
+ return (1, "WARN - Unit %d Utilization: %s%%" % (unitid, util) )
+ else:
+ return (0, "OK - Unit %d Utilization: %s%%" % (unitid, util) )
+ return (3, "UNKNOWN - Unit/CPU %s not found" % item)
+
+
+check_info["h3c_lanswitch_cpu"] = (check_h3c_lanswitch_cpu, "Unit CPU Util %s", 0, inventory_h3c_lanswitch_cpu )
+
+snmp_info["h3c_lanswitch_cpu"] = \
+ ( "1.3.6.1.4.1.43.45.1.6.1.1.1", [ OID_END, "3" ] )
+
+
+snmp_scan_functions["h3c_lanswitch_cpu"] = \
+ lambda oid: "3com superstack 4" in oid (".1.3.6.1.2.1.1.1.0").lower()
+# alternatively: 3Com Switch 8814
diff --git a/checks/h3c_lanswitch_sensors b/checks/h3c_lanswitch_sensors
new file mode 100644
index 0000000..4855f95
--- /dev/null
+++ b/checks/h3c_lanswitch_sensors
@@ -0,0 +1,46 @@
+def inventory_h3c_lanswitch_sensors(checkname, info):
+ return [ (h3c_lanswitch_genitem(line[0]), None) for line in info if line[1] in [ '1', '2'] ]
+
+
+
+def check_h3c_lanswitch_sensors(item, params, info):
+# the values are: active (1), deactive (2), not-install (3), unsupport (4)
+ for (endoid, status) in info:
+ if h3c_lanswitch_genitem(endoid) == item:
+ if status == "2":
+ return (2, "CRIT - Sensor %s status is %s" % (item, status))
+ elif status == "1":
+ return (0, "OK - Sensor %s status is %s" % (item, status))
+ else:
+ return (1, "WARN - Sensor % status is %s" % (item, status))
+ return (3, "UNKNOWN - Sensor %s not found" % item )
+
+
+check_info["h3c_lanswitch_sensors"] = (check_h3c_lanswitch_sensors, "%s", 0, inventory_h3c_lanswitch_sensors )
+
+def h3c_lanswitch_genitem(endoid):
+ deviceclass, one, id = endoid.split(".")
+# print ("%s %s %s" % (deviceclass, one, id))
+ if deviceclass == "1":
+ hwLswdev = "Fan"
+ else:
+ hwLswdev = "Powersupply"
+ unitid = int(id) / 65536
+ num = int(id) % 65536
+ return "Unit %d %s %d" % (unitid, hwLswdev, num)
+
+
+# mib: A3COM-HUAWEI-LswDEVM-MIB
+# fan table: A3COM-HUAWEI-OID-MIB::lswCommon.9.1.1.1.1.65536 = INTEGER: 65536
+# fan status: A3COM-HUAWEI-OID-MIB::lswCommon.9.1.1.1.2.65536 = INTEGER: 1
+# hwdevMPowerStatusTable ( hwDevMPowerNum, hwDevMPowerStatus )
+# hwdevMFanStatusTable
+#
+#
+# finally,just check fan status
+snmp_info["h3c_lanswitch_sensors"] = \
+ ( ".1.3.6.1.4.1.43.45.1.2.23.1.9.1", ["1.1", "2.1"], [ OID_END, "2" ] )
+
+
+snmp_scan_functions["h3c_lanswitch_sensors"] = \
+ lambda oid: "3com switch 5500" in oid (".1.3.6.1.2.1.1.1.0").lower()
diff --git a/checks/superstack3_sensors b/checks/superstack3_sensors
new file mode 100644
index 0000000..92013dd
--- /dev/null
+++ b/checks/superstack3_sensors
@@ -0,0 +1,23 @@
+def inventory_superstack3_sensors(checkname, info):
+ return [ (line[0], None) for line in info if line[1] != 'not present' ]
+
+def check_superstack3_sensors(item, params, info):
+ for name, state in info:
+ if name == item:
+ if state == "failure":
+ return (2, "CRIT - status is %s" % state )
+ elif state == "operational":
+ return (0, "OK - status is %s" % state )
+ else:
+ return (1, "WARN - status is %s" % state )
+ return (3, "UNKOWN - sensor not found")
+
+
+check_info["superstack3_sensors"] = (check_superstack3_sensors, "%s", 0, inventory_superstack3_sensors )
+
+snmp_info["superstack3_sensors"] = \
+ ( "1.3.6.1.4.1.43.43.1.1", [ "7", "10" ] )
+
+
+snmp_scan_functions["superstack3_sensors"] = \
+ lambda oid: "3com superstack 3" in oid (".1.3.6.1.2.1.1.1.0").lower()
Module: check_mk
Branch: master
Commit: 8fea0b424d30386faeb27194529a8774009fd89c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fea0b424d3038…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 16:44:24 2011 +0100
New windows plugins, not yet working
---
agents/windows/win_mpio.cmd | 10 ++++++++++
agents/windows/win_time.cmd | 19 +++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/agents/windows/win_mpio.cmd b/agents/windows/win_mpio.cmd
new file mode 100644
index 0000000..1f2eb74
--- /dev/null
+++ b/agents/windows/win_mpio.cmd
@@ -0,0 +1,10 @@
+# DO NOT USE YET!
+
+@echo off
+echo ^<^<^<win_mpio:sep^(44^)^>^>^>
+#wmic process get name,pagefileusage,virtualsize,workingsetsize,usermodetime,kernelmodetime /format:csv
+# MPIO_DSM_Path
+# wmuc MPIO_DSM_Path_V2 LIST
+
+
+# REM state speed
diff --git a/agents/windows/win_time.cmd b/agents/windows/win_time.cmd
new file mode 100644
index 0000000..f7c37dd
--- /dev/null
+++ b/agents/windows/win_time.cmd
@@ -0,0 +1,19 @@
+# DO NOT USE YET!
+
+@echo off
+
+REM ***
+REM Query Windows Time daemons
+REM Only Windows 2008 can give a useful status of the current win32time status.
+REM ***
+
+echo ^<^<^<win_time^>^>^>
+REM read in windows version
+ver
+
+REM by standard, just query the timeserver.
+net time /querysntp | findstr SNTP
+
+REM if we're on W2K8 it is possible to query the timeserver status
+REM otherwise this will fail.
+w32tm /query /status
Module: check_mk
Branch: master
Commit: d0eea518db41d2e20811e8de0428c44a65072d86
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d0eea518db41d2…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 09:28:04 2011 +0100
new PNP template for oracle_logswitches
---
pnp-rraconf/check_mk-oracle_logswitches.rra.cfg | 1 +
pnp-templates/check_mk-oracle_logswitches.php | 37 +++++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/pnp-rraconf/check_mk-oracle_logswitches.rra.cfg b/pnp-rraconf/check_mk-oracle_logswitches.rra.cfg
new file mode 120000
index 0000000..19dbf77
--- /dev/null
+++ b/pnp-rraconf/check_mk-oracle_logswitches.rra.cfg
@@ -0,0 +1 @@
+max.rra.cfg
\ No newline at end of file
diff --git a/pnp-templates/check_mk-oracle_logswitches.php b/pnp-templates/check_mk-oracle_logswitches.php
new file mode 100644
index 0000000..5d861e3
--- /dev/null
+++ b/pnp-templates/check_mk-oracle_logswitches.php
@@ -0,0 +1,37 @@
+<?php
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+$title = str_replace("_", " ", $servicedesc);
+$opt[1] = "--vertical-label 'log switches/h' -l0 -u $CRIT[1] --title \"$title\" ";
+
+$def[1] = "DEF:sessions=$RRDFILE[1]:$DS[1]:MAX ";
+$def[1] .= "AREA:sessions#4800ff: ";
+$def[1] .= "LINE:sessions#38008f: ";
+$def[1] .= "GPRINT:sessions:LAST:\"last\: %3.0lf\" ";
+$def[1] .= "GPRINT:sessions:AVERAGE:\"avg\: %3.0lf\" ";
+$def[1] .= "GPRINT:sessions:MAX:\"max\: %3.0lf\" ";
+$def[1] .= "HRULE:$WARN[1]#ffcf00:\"Warning at $WARN[1]\" ";
+$def[1] .= "HRULE:$CRIT[1]#ff0000:\"Critical at $CRIT[1]\" ";
+?>
Module: check_mk
Branch: master
Commit: 93e83baf0dd87143be0f3c171e46969b63fcb267
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=93e83baf0dd871…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 09:35:32 2011 +0100
Updated bug entries
---
.bugs/112 | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/.bugs/112 b/.bugs/112
new file mode 100644
index 0000000..dc0ba39
--- /dev/null
+++ b/.bugs/112
@@ -0,0 +1,10 @@
+Title: PNP-Links in Perf-O-Meter should be intelligent
+Component: multisite
+Benefit: 1
+State: open
+Cost: 1
+Date: 2011-01-28 09:34:33
+Class: cleanup
+
+If there is no PNP database the perfometer should not contain a hlink
+to PNP. We can use the same logic as in the intelligent PNP icon.
Module: check_mk
Branch: master
Commit: c73e1f218bd7dbfd08c7a83a803be5675b8f65e0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c73e1f218bd7db…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 09:42:58 2011 +0100
Updated bug entries
---
.bugs/113 | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/.bugs/113 b/.bugs/113
new file mode 100644
index 0000000..54d7495
--- /dev/null
+++ b/.bugs/113
@@ -0,0 +1,12 @@
+Title: Scale down PNP graphs to 50% as display option
+Component: multisite
+Benefit: 2
+State: open
+Cost: 1
+Date: 2011-01-28 09:41:38
+Class: feature
+
+We could introduce a display option for the PNP inline graphs, that
+scales down the graph by 25%, 50%, 66% or whatever percent, so that
+more graphs can be displayed on a one screen. The question is: can
+an <img> tag have a relative size option, like 50%?
Module: check_mk
Branch: master
Commit: 88d580b7f1b92053631069c623d43e98e731f04b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=88d580b7f1b920…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 10:18:32 2011 +0100
Fix bug 109: Nagios does not any longer inherit FDs from Apache
So a restart of Apache after a WATO reload is possible again
in OMD.
---
.bugs/109 | 11 ++++++++---
modules/check_mk.py | 17 ++++++++++++++++-
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/.bugs/109 b/.bugs/109
index 3540e9b..47e3e8d 100644
--- a/.bugs/109
+++ b/.bugs/109
@@ -1,10 +1,11 @@
Title: Restart of Nagios makes Nagios inherit TCP port
Component: wato
+State: done
+Class: bug
+Date: 2011-01-26 09:12:21
Benefit: 4
-State: open
Cost: 2
-Date: 2011-01-26 09:12:21
-Class: bug
+Fun: 0
If you restart Nagios via WATO, then Apache restarts Nagios
und the new Nagios process inherits the open files of Apache.
@@ -14,3 +15,7 @@ makes it impossible to restart apache later.
Solution unclear. Either user reload instead of restart or
try to explicitely close all filedescriptors after forking.
But how can we do that?
+
+2011-01-28 10:18:26: changed state open -> done
+Fixed in modules/check_mk.py. We close all filedescriptors from 3..256 before
+restarting Nagios.
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 755bc6e..208307b 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -3654,8 +3654,23 @@ def automation_delete_host(args):
os.system("rm -rf '%s'" % path)
def automation_restart():
+ # make sure, Nagios does not inherit any open
+ # filedescriptors. This really happens, e.g. if
+ # check_mk is called by WATO via Apache. Nagios inherits
+ # the open file where Apache is listening for incoming
+ # HTTP connections. Really.
+ os.closerange(3, 256)
+
+ class fake_file():
+ def write(self, stuff):
+ pass
+ def flush(self):
+ pass
+
+ # Deactivate stdout by introducing fake file without filedescriptor
old_stdout = sys.stdout
- sys.stdout = file('/dev/null', 'w')
+ sys.stdout = fake_file()
+
try:
if os.path.exists(nagios_objects_file):
backup_path = nagios_objects_file + ".save"