Module: check_mk
Branch: master
Commit: 348115cd369688eaabc12d8cd4f7e5853f591a51
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=348115cd369688…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 22 15:20:02 2011 +0100
Updated changelog
---
ChangeLog | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e75f9ff..ac432de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,7 +48,7 @@
* windows_update: Added check to monitor windows update states on windows
clients. The check monitors the number of pending updates and checks if
a reboot is needed after updates have been installed.
- * Linux mk_oracle: Updated tablespace query to use 'used blocks' instead of 'user blocks'
+ * FIX: Linux mk_oracle: Updated tablespace query to use 'used blocks' instead of 'user blocks'
1.1.10:
Module: check_mk
Branch: master
Commit: 08f606812078876843c328a7b1e7da885a14fb77
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=08f60681207887…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 22 12:57:47 2011 +0100
Added srem1_sensors check
---
checkman/strem1_sensors | 35 +++++++++++++++
checks/strem1_sensors | 108 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+), 0 deletions(-)
diff --git a/checkman/strem1_sensors b/checkman/strem1_sensors
new file mode 100644
index 0000000..f2f8b0b
--- /dev/null
+++ b/checkman/strem1_sensors
@@ -0,0 +1,35 @@
+title: Checks temperature,humidity,wetness on sensatronic em1 devices
+agents: snmp
+author: Lars Michelsen <lm(a)mathias-kettner.de>
+license: GPL
+distribution:
+description:
+ This check monitors the data gathered by the sensors sensors attached
+ to a Sensatronic EM1 device. The device needs to support the {SENSATRONICS-EM1} MIB.
+
+item:
+ Each sensor which returns a value different than -999.9 results in one service. The item
+ containts the group name and the sensor type.
+
+perfdata:
+ Depends on the sensor type. In case of temperature the service outputs a perfdata value
+ {temperature} and the current value, warn, crit in the provided measure unit. In case of
+ humidity the check returns a perfdata value {humindity} with the percentage value.
+
+inventory:
+ All available sensors are automatically inventorized.
+
+examples:
+ # set default levels for all sensors
+ strem1_temp_defaultlevels = (28, 32)
+ strem1_humidity_defaultlevels = (None, None)
+ strem1_wetness_defaultlevels = (None, None)
+
+[parameters]
+warning (int): minimum value leading to a WARNING state
+critical (int): mimimum value leading to a CRITICAL state
+
+[configuration]
+strem1_temp_defaultlevels (int/None, int/None): default temperature levels for warning, critical states. Preset to (28, 32). None disables a threshold.
+strem1_humidity_defaultlevels (int/None, int/None): default humidity levels for warning, critical states. Preset to (28, 32). None disables a threshold.
+strem1_wetness_defaultlevels (int/None, int/None): default wetness levels for warning, critical states. Preset to (28, 32). None disables a threshold.
diff --git a/checks/strem1_sensors b/checks/strem1_sensors
new file mode 100644
index 0000000..8bb9871
--- /dev/null
+++ b/checks/strem1_sensors
@@ -0,0 +1,108 @@
+#!/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>, 2011-03-21
+
+strem1_temp_defaultlevels = (28, 32)
+strem1_humidity_defaultlevels = (None, None)
+strem1_wetness_defaultlevels = (None, None)
+
+def strem1_sensors_parse_info(info):
+ # Change format of output: 1 tuple for each group
+ info = zip(*info)
+
+ parsed = []
+ for group in info:
+ grp = group[0]
+
+ items = group[1:]
+ for i in xrange(0, len(items), 3):
+ parsed.append([ grp + ' ' + items[i]] + list(items[i:i+3]))
+ return parsed
+
+
+def inventory_strem1_sensors(checkname, info):
+ inventory = []
+ for index, typ, val, intval in strem1_sensors_parse_info(info[1]):
+ lvls = 'strem1_temp_defaultlevels'
+ if typ == 'Humidity':
+ lvls = 'strem1_humidity_defaultlevels'
+ elif typ == 'Wetness':
+ lvls = 'strem1_wetness_defaultlevels'
+ if val != '-999.9':
+ inventory.append((index, lvls))
+ return inventory
+
+def check_strem1_sensors(item, params, info):
+ for index, typ, val, intval in strem1_sensors_parse_info(info[1]):
+ if index == item:
+ uom = typ == 'Temperature' and info[0][0][0] or '%'
+ val = float(val)
+ warn, crit = params
+
+ infotext = "%.1f" % val + uom
+ perfdata = [ ( typ.lower(), infotext, warn, crit ) ]
+ thrtext = []
+ if warn:
+ thrtext += ["warn at %.1f" % warn + uom]
+ if crit:
+ thrtext += ["crit at %.1f" % crit + uom]
+ if thrtext:
+ infotext += ' (%s)' % ', '.join(thrtext)
+
+ if crit and val >= crit:
+ return (2, "CRITICAL - %s is: " % typ + infotext, perfdata)
+ elif warn and val >= warn:
+ return (1, "WARNING - %s is: " % typ + infotext, perfdata)
+ else:
+ return (0, "OK - %s is: " % typ + infotext, perfdata )
+ return (3, "UNKNOWN - Sensor not found")
+
+
+check_info['strem1_sensors'] = ( check_strem1_sensors, "Sensor - %s", 1, inventory_strem1_sensors)
+
+#1, # SENSATRONICS-EM1::group1Name
+#2, # SENSATRONICS-EM1::group1TempName
+#3, # SENSATRONICS-EM1::group1TempDataStr
+#4, # SENSATRONICS-EM1::group1TempDataInt
+#5, # SENSATRONICS-EM1::group1HumidName
+#6, # group1HumidDataStr
+#7, # group1HumidDataInt
+#8, # group1WetName
+#9, # group1WetDataStr
+#10, # group1WetDataInt
+snmp_info['strem1_sensors'] = [
+ ("1.3.6.1.4.1.16174.1.1.3.2.3", [1]),
+ ("1.3.6.1.4.1.16174.1.1.3.3", [ # SENSATRONICS-EM1::measurementSystem
+ 1, # First group
+ 2, # Second group
+ 3, # Third group
+ 4, # Fourth group
+ ]),
+]
+
+snmp_scan_functions['strem1_sensors'] = \
+ lambda oid: "Sensatronics EM1" in oid(".1.3.6.1.2.1.1.1.0")
Module: check_mk
Branch: master
Commit: bba523c3cd06a9f267d119429604193e56d306da
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bba523c3cd06a9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 22 14:34:15 2011 +0100
Added windows_update check
---
ChangeLog | 3 +
agents/windows/plugins/windows_updates.vbs | 56 +++++++++++++++++++
checks/windows_updates | 83 ++++++++++++++++++++++++++++
3 files changed, 142 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d50bbe8..31a3487 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,6 +45,9 @@
* canon_pages: Added new check for monitoring processed pages on canon
printer/multi-function devices
* strem1_sensors: added check to monitor sensors attached to Sensatorinc EM1 devices
+ * windows_update: Added check to monitor windows update states on windows
+ clients. The check monitors the number of pending updates and checks if
+ a reboot is needed after updates have been installed.
1.1.10:
diff --git a/agents/windows/plugins/windows_updates.vbs b/agents/windows/plugins/windows_updates.vbs
new file mode 100644
index 0000000..972c5dd
--- /dev/null
+++ b/agents/windows/plugins/windows_updates.vbs
@@ -0,0 +1,56 @@
+' -----------------------------------------------------------------------------
+' windows_updates.vbs - check_mk agent plugin to monitor pending windows updates
+'
+' To use this just place it in the plugins/ directory below the path of the
+' check_mk_agent. After that an inventory run on the Nagios host should lead
+' to a new inventorized service.
+'
+' Author: Lars Michelsen <lm(a)mathias-kettner.de>, 2011-03-21
+' -----------------------------------------------------------------------------
+
+Option Explicit
+
+Dim result, reboot, numImp, numOpt, important, opti
+Dim updtSearcher, colDownloads, objEntry
+
+If CreateObject("Microsoft.Update.AutoUpdate").DetectNow <> 0 Then
+ WScript.Echo "<<<windows_updates>>>"
+ WScript.Quit(0)
+End If
+
+Set updtSearcher = CreateObject("Microsoft.Update.Session").CreateUpdateSearcher
+
+reboot = 0
+numImp = 0
+numOpt = 0
+
+If CreateObject("Microsoft.Update.SystemInfo").RebootRequired Then
+ reboot = 1
+End If
+
+Set result = updtSearcher.Search("IsInstalled = 0 and IsHidden = 0")
+Set colDownloads = result.Updates
+
+For Each objEntry in colDownloads
+ if objEntry.AutoSelectOnWebSites Then
+ if numImp = 0 Then
+ important = objEntry.Title
+ else
+ important = important & "; " & objEntry.Title
+ End If
+ numImp = numImp + 1
+ Else
+ If numOpt = 0 Then
+ opti = objEntry.Title
+ Else
+ opti = opti & "; " & objEntry.Title
+ End If
+ numOpt = numOpt + 1
+ End If
+Next
+
+WScript.Echo "<<<windows_updates>>>"
+WScript.Echo reboot & " " & numImp & " " & numOpt
+WScript.Echo important
+WScript.Echo opti
+WScript.Quit()
diff --git a/checks/windows_updates b/checks/windows_updates
new file mode 100644
index 0000000..e94827e
--- /dev/null
+++ b/checks/windows_updates
@@ -0,0 +1,83 @@
+#!/usr/bin/python
+# -*- encoding: utf-8 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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>
+
+# <<<windows_updates>>>
+# 0 2 5
+# Windows XP Service Pack 3 (KB936929); Windows-Tool zum Entfernen sch�dlicher Software - M�rz 2011 (KB890830)
+# Update f�r WMDRM-f�hige Medienplayer (KB891122); Windows Media Player 11; Windows Search 4.0 f�r Windows XP (KB940157); Microsoft Base Smartcard-Kryptografiedienstanbieter-Paket: x86 (KB909520); Update f�r die Microsoft .NET Framework 3.5 Service Pack 1- und .NET Framework 3.5-Produktfamilie (KB951847) x86
+
+# First row: Reboot_required, num_important, num_optional
+# Second row: List of all important updates
+# Thirt row: List of all optional updates
+
+windows_updates_default_params = (None, None, None, None)
+
+def inventory_windows_updates(checktype, info):
+ if info and len(info[0]) == 3:
+ return [(None, "windows_updates_default_params")]
+
+def check_windows_updates(_unused, params, info):
+ if info and len(info[0]) == 3:
+ status = 0
+ reboot_required, num_imp, num_opt = map(saveint, info[0])
+ imp_warn, imp_crit, opt_warn, opt_crit = params
+ important = ''
+ if len(info) >= 2:
+ important = ' '.join(info[1])
+ optional = ''
+ if len(info) >= 3:
+ optional = ' '.join(info[2])
+
+ txt = []
+ perfdata = []
+ for label, updates, cur, warn, crit in [ ('important', important, num_imp, imp_warn, imp_crit),
+ ('optional', optional, num_opt, opt_warn, opt_crit) ]:
+ this_txt = '%d %s' % (cur, label)
+ if label == 'important' and cur > 0:
+ this_txt += ' (%s)' % updates
+ if crit and cur >= crit:
+ this_txt += ' (CRIT: >=%d)' % crit
+ if status < 2:
+ status = 2
+ elif warn and cur >= warn:
+ this_txt += ' (WARN: >=%d)' % warn
+ if status < 1:
+ status = 1
+ txt.append(this_txt)
+ perfdata.append((label, cur, warn, crit))
+
+ if reboot_required == 1:
+ if status < 1:
+ status = 1
+ txt.append('WARN: A reboot is required to finish update installations')
+
+ return (status, '%s - %s' % (nagios_state_names[status], ', '.join(txt)), perfdata)
+
+ return (3, 'UNKNOWN - No windows update information provided')
+
+check_info['windows_updates'] = (check_windows_updates, "System Updates", 1, inventory_windows_updates)
Module: check_mk
Branch: master
Commit: 28d15d6b4349ac5eae5a47ce17c0ecda36c9f4b1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=28d15d6b4349ac…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 22 14:43:17 2011 +0100
Linux mk_oracle: Updated tablespace query to use 'used blocks' instead of 'user blocks'
---
ChangeLog | 1 +
agents/plugins/mk_oracle | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 31a3487..e75f9ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,7 @@
* windows_update: Added check to monitor windows update states on windows
clients. The check monitors the number of pending updates and checks if
a reboot is needed after updates have been installed.
+ * Linux mk_oracle: Updated tablespace query to use 'used blocks' instead of 'user blocks'
1.1.10:
diff --git a/agents/plugins/mk_oracle b/agents/plugins/mk_oracle
index 4f311ea..e6ad4a2 100644
--- a/agents/plugins/mk_oracle
+++ b/agents/plugins/mk_oracle
@@ -66,8 +66,14 @@ echo '<<<oracle_tablespaces>>>'
for SID in $SIDS
do
sqlplus "$SID" <<EOF | sed 's/READ ONLY/READONLY/g'
-select f.file_name, f.tablespace_name, f.status, f.AUTOEXTENSIBLE, f.blocks, f.maxblocks, f.USER_BLOCKS, f.INCREMENT_BY, f.ONLINE_STATUS, t.BLOCK_SIZE, t.status from dba_data_files f, dba_tablespaces t where f.tablespace_name = t.tablespace_name
+select f.file_name, f.tablespace_name, f.status, f.AUTOEXTENSIBLE, f.blocks, f.maxblocks, f.blocks - b.free_blocks as used_blocks, f.INCREMENT_BY, f.ONLINE_STATUS, t.BLOCK_SIZE, t.status
+from dba_data_files f, dba_tablespaces t ,(SELECT file_id, SUM(blocks) free_blocks FROM dba_free_space b GROUP BY file_id) b
+where f.tablespace_name = t.tablespace_name
+and f.file_id=b.file_id
UNION
-select f.file_name, f.tablespace_name, f.status, f.AUTOEXTENSIBLE, f.blocks, f.maxblocks, f.USER_BLOCKS, f.INCREMENT_BY, 'TEMP', t.BLOCK_SIZE, t.status from dba_temp_files f, dba_tablespaces t where f.tablespace_name = t.tablespace_name;
+select f.file_name, f.tablespace_name, f.status, f.AUTOEXTENSIBLE, f.blocks, f.maxblocks, f.blocks - b.free_blocks as used_blocks, f.INCREMENT_BY, 'TEMP', t.BLOCK_SIZE, t.status
+from dba_temp_files f, dba_tablespaces t ,(SELECT file_id, SUM(blocks) free_blocks FROM dba_free_space b GROUP BY file_id) b
+where f.tablespace_name = t.tablespace_name
+and f.file_id=b.file_id ;
EOF
done