Module: check_mk
Branch: master
Commit: f0b850bbb846ab9f775ade85a0754f691de215a1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f0b850bbb846ab…
Author: Florian Heigl <floh(a)Klappstuhl.(none)>
Date: Fri Feb 25 09:50:29 2011 +0100
This version should correctly handle all devices handled in the h3clanSw mib.
---
checks/h3c_lanswitch_cpu | 95 +++++++++++++++++++++++++++++++++++++++-------
1 files changed, 81 insertions(+), 14 deletions(-)
diff --git a/checks/h3c_lanswitch_cpu b/checks/h3c_lanswitch_cpu
index 5422d7a..7a5e6c6 100644
--- a/checks/h3c_lanswitch_cpu
+++ b/checks/h3c_lanswitch_cpu
@@ -1,33 +1,100 @@
+#!/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.
+# Florian Heigl <fh(a)mathias-kettner.de>
+# check for switches using H3C lanswitch MIB
+#
+#
+# on standalone switches (SS500-EL, etc) we will get stats per cpu.
+#SNMPv2-SMI::enterprises.43.45.1.6.1.1.1.3.1 = Gauge32: 11
+# the id for the CPU will be "65536". The unit Id display will show '1'.
+#
+# on multi-unit stacks (SS5500-EL, etc) we will get stats per cpu in each switch.
+# the table id for the CPU is (unitId*65536)+0.
+#SNMPv2-SMI::enterprises.43.45.1.6.1.1.1.3.65536 = Gauge32: 11
+#
+# on multi-slot switches (SS8800 etc) we will get stats for each card.
+#SNMPv2-SMI::enterprises.43.45.1.6.1.1.1.3.0 = Gauge32: 11
+#[...]
+#SNMPv2-SMI::enterprises.43.45.1.6.1.1.1.3.12 = Gauge32: 16
+#SNMPv2-SMI::enterprises.43.45.1.6.1.1.1.3.13 = Gauge32: 16
# 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 ]
+ return [ (h3c_lanswitch_cpu_genitem(line[0]), "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) )
+ if h3c_lanswitch_cpu_genitem(line[0]) == item:
+ util = int(line[1])
+ infotext = (" - average usage was %d%% over last 5 minutes." % util)
+ perfdata = [ ( "Usage", util, warn, crit, 0) ]
+
+ if util > crit:
+ return (2, "CRIT" + infotext, perfdata)
+ elif util > warn:
+ return (1, "WARN" + infotext, perfdata)
+ else:
+ return (0, "OK" + infotext, perfdata)
return (3, "UNKNOWN - Unit/CPU %s not found" % item)
+# decide switch class here (stacked or standalone/modular) and make a check item for it.
+def h3c_lanswitch_cpu_genitem(item):
+ cpuid = int(item)
+# if we have a cpuid lower than 512 it is not hashed with a unit ID
+ if cpuid < 256:
+ switchid = 1
+ cputype = "Slot"
+ cpunum = cpuid
+# othwise, if above 64k it is a known stackable switch
+ elif cpuid >= 65536:
+ switchid = cpuid / 65536
+ cputype = "CPU"
+ cpunum = cpuid % 65536
+# if we end up here 3com has added another hash method.
+ else:
+ switchid = 1
+ cputype = "Unknown"
+ cpunum = cpuid
+ return ("Switch %d %s %d" % (switchid, cputype, cpunum))
+
-check_info["h3c_lanswitch_cpu"] = (check_h3c_lanswitch_cpu, "Unit CPU Util %s", 0, inventory_h3c_lanswitch_cpu )
+check_info["h3c_lanswitch_cpu"] = (check_h3c_lanswitch_cpu, "CPU Load %s", 1, inventory_h3c_lanswitch_cpu )
+# get only the 5-min average load.
snmp_info["h3c_lanswitch_cpu"] = \
( "1.3.6.1.4.1.43.45.1.6.1.1.1", [ OID_END, "3" ] )
-
+# just a rough match that will handle most devices.
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
+ lambda oid: oid (".1.3.6.1.2.1.1.1.0").lower().startswith('3com s')
+
+
+
Module: check_mk
Branch: master
Commit: 86195fe7c3c362388e3c63239a6dce62e9657356
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=86195fe7c3c362…
Author: Florian Heigl <floh(a)Klappstuhl.(none)>
Date: Fri Feb 25 09:55:13 2011 +0100
backend for new windows checks
---
agents/windows/plugins/windows_multipath.vbs | 25 +++++++++++++++++++++++++
agents/windows/plugins/windows_time.bat | 25 +++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/agents/windows/plugins/windows_multipath.vbs b/agents/windows/plugins/windows_multipath.vbs
new file mode 100644
index 0000000..9cae99b
--- /dev/null
+++ b/agents/windows/plugins/windows_multipath.vbs
@@ -0,0 +1,25 @@
+' MPIO_PATH_INFORMATION.vbs
+' VBS WMI MPIO
+' Author: Torsten Haake
+' Date: 2011-02-15
+' -----------------------------------------------'
+Option Explicit
+Dim objWMIService, objItem, colItems, strComputer
+
+' On Error Resume Next
+strComputer = "."
+
+# added for check_mk parsing (fh(a)mathias-ketter.de)
+Wscript.Echo "<<<windows_multipath>>>"
+
+' WMI connection to Root WMI
+Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
+Set colItems = objWMIService.ExecQuery("Select * from
+MPIO_PATH_INFORMATION")
+
+For Each objItem in colItems
+ Wscript.Echo objItem.NumberPaths
+Next
+
+WSCript.Quit
+
diff --git a/agents/windows/plugins/windows_time.bat b/agents/windows/plugins/windows_time.bat
new file mode 100644
index 0000000..bd349be
--- /dev/null
+++ b/agents/windows/plugins/windows_time.bat
@@ -0,0 +1,25 @@
+@echo off
+
+REM Windows time checks
+REM <fh(a)mathias-kettner.de>
+REM
+REM
+
+REM Win2008
+set W2K8 = "Microsoft Windows [Version 6.0.6002]"
+
+
+echo "<<<windows_time>>>"
+
+REM only w2k8 / vista /win7 are able to report ntp status.
+if ver = "%W2K8%" w32tm /query /status
+
+REM win2003 can _test_ the ntp server using w32tm /once, but we don't want
+REM to test EVERY minute, it takes a few seconds and will hammer the NTP server.
+REM I very much recommend to monitor for w32time errors in eventlog instead.
+
+REM all others since W2K can at least report their primary SNTP or NTP server
+REM the MS-supplied timeserver is usually blocked in corporate networks, but
+REM windows will default to it.
+net time /querysntp
+
Module: check_mk
Branch: master
Commit: 633a40421ba7690488bda176e675fa19ae255798
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=633a40421ba769…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 25 10:47:48 2011 +0100
Small updates for coding guidelines
---
README.writing_checks | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/README.writing_checks b/README.writing_checks
index 8eefdb2..feaffd1 100644
--- a/README.writing_checks
+++ b/README.writing_checks
@@ -1,5 +1,23 @@
This file will help you to write *good* checks for Check_MK.
+Code styling:
+* Use four spaces for intending your code. Just don't use tab chars.
+ And if you relly can't life without tabs set the tab width to 8 spaces.
+
+Manpages:
+*
+
+Performance data:
+* All performance data checks need to provide a pnp template
+
+* pnp rra configuration
+
+SNMP based checks:
+* Only use numeric OIDs in your checks. Name based OIDs rely on MIB files
+ and the check won't work when the MIB files are not in place.
+
+* Scan function:
+
Agent based checks:
* Put sample output snippets of the agent as comments into
Module: check_mk
Branch: master
Commit: 73c5cb21e557cc91389be75ecd199665feef8392
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=73c5cb21e557cc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 25 09:58:44 2011 +0100
Correctly handling check includes now
---
doc/helpers/validate_checks | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/doc/helpers/validate_checks b/doc/helpers/validate_checks
index 7dd074d..2e13261 100755
--- a/doc/helpers/validate_checks
+++ b/doc/helpers/validate_checks
@@ -64,7 +64,9 @@ execfile('check_mk')
__name__ = '__main__'
def get_checks():
- return [ l for l in os.listdir('checks') if not l.startswith('.') ]
+ files = os.listdir('checks')
+ return [ f for f in files if f.endswith(".include") and not f.startswith('.') ] + \
+ [ f for f in files if not f.endswith(".include") and not f.startswith('.') ]
def check_has_perfdata(check):
return check_info[check][2] == 1
Module: check_mk
Branch: master
Commit: 748eb700a216d82889dc065444da97d6743312aa
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=748eb700a216d8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Feb 25 09:43:01 2011 +0100
Updated bug entries
---
.bugs/132 | 10 +++++++---
.bugs/156 | 10 ++++++++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/.bugs/132 b/.bugs/132
index 9e001fe..96353ba 100644
--- a/.bugs/132
+++ b/.bugs/132
@@ -1,12 +1,16 @@
Title: WATO misses some Windows services
Component: wato
+State: done
+Class: bug
+Date: 2011-02-13 18:31:09
Benefit: 3
-State: open
Cost: 1
-Date: 2011-02-13 18:31:09
-Class: bug
+Fun: 0
It seems that WATO is dropping some service when inventorizing
Windows hosts. Of course the problem is not Windows-related. But
it seems that services containing special characters, like ':'
could make the difference.
+
+2011-02-25 09:37:31: changed state open -> done
+Should be fixed now. Was du to colons in service descriptions.
diff --git a/.bugs/156 b/.bugs/156
new file mode 100644
index 0000000..cc73eae
--- /dev/null
+++ b/.bugs/156
@@ -0,0 +1,10 @@
+Title: Complete missing SNMP scan functions
+Component: checks
+Benefit: 5
+State: open
+Cost: 3
+Date: 2011-02-25 09:42:02
+Class: cleanup
+
+A couple of checks still have no SNMP scan function. This must
+be fixed before 1.1.10.