Module: check_mk
Branch: master
Commit: 9f903cce255fec5c202f488cdb78594cd15eb7e9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9f903cce255fec…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Mar 12 15:27:46 2014 +0100
FIX: dell_poweredge_cpu not correctly detects when cpus are not present
---
checkman/dell_poweredge_cpu | 5 +----
checks/dell_poweredge_cpu | 8 +++-----
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/checkman/dell_poweredge_cpu b/checkman/dell_poweredge_cpu
index 52e7b59..3e16658 100644
--- a/checkman/dell_poweredge_cpu
+++ b/checkman/dell_poweredge_cpu
@@ -15,10 +15,7 @@ description:
No limits are set in the check.
item:
- Either the name of the location variable configured for the CPU, or
- the chassis index and sensor index seperated by a dash.
+ The name of the location variable configured for the CPU
inventory:
All CPUs of the device are detected
-
-
diff --git a/checks/dell_poweredge_cpu b/checks/dell_poweredge_cpu
index ff9ea56..de91938 100644
--- a/checks/dell_poweredge_cpu
+++ b/checks/dell_poweredge_cpu
@@ -46,15 +46,13 @@ dell_poweredge_cpu_scan = lambda oid: oid('.1.3.6.1.2.1.1.2.0') == ".1.3.6.1.4.
def inventory_dell_poweredge_cpu(info):
inventory = []
for line in info[0]:
- if line[5] != "":
+ if line[5] != "" and line[2] != "1":
inventory.append( ( line[5], None ) )
- else:
- inventory.append( ( line[0]+"-"+line[1], None ) )
return inventory
def check_dell_poweredge_cpu(item, _no_params, info):
for chassisIndex, Index, StateSettings, Status, Reading, LocationName in info[0]:
- if item == LocationName or item == chassisIndex + "-" + Index:
+ if item == LocationName:
for line in info[1]:
if line[0] == chassisIndex and line[1] == Index:
BrandName = line[2]
@@ -72,7 +70,7 @@ def check_dell_poweredge_cpu(item, _no_params, info):
return state, infotext
- return 3, "Temp Sensor not found"
+ return 3, "CPU not found"
check_info["dell_poweredge_cpu"] = {
"check_function" : check_dell_poweredge_cpu,
Module: check_mk
Branch: master
Commit: a8551898ca3f5cebfc0cdb013f197f07e110a56a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a8551898ca3f5c…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Mar 12 15:08:25 2014 +0100
dell_poweredge_mem: new check to monitor memory modules of Dell PowerEdge Servers
---
.werks/591 | 8 ++++
ChangeLog | 1 +
checkman/dell_poweredge_mem | 27 ++++++++++++++
checks/dell_poweredge_mem | 87 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 123 insertions(+)
diff --git a/.werks/591 b/.werks/591
new file mode 100644
index 0000000..f443b4a
--- /dev/null
+++ b/.werks/591
@@ -0,0 +1,8 @@
+Title: dell_poweredge_mem: new check to monitor memory modules of Dell PowerEdge Servers
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1394633291
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index e71ac16..70fec53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -105,6 +105,7 @@
* 0731 mk_postgres: improved support for versions postgres < 9.2...
* 0588 dell_poweredge_amperage.current, dell_poweredge_amperage.power, dell_poweredge_cpu, dell_poweredge_status, dell_poweredge_temp: new checks for the Dell PowerEdge Blade Server
* 0589 brocade_tm: new check monitoring traffic manager statistics for interfaces of brocade devices
+ * 0591 dell_poweredge_mem: new check to monitor memory modules of Dell PowerEdge Servers
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/dell_poweredge_mem b/checkman/dell_poweredge_mem
new file mode 100644
index 0000000..e22f890
--- /dev/null
+++ b/checkman/dell_poweredge_mem
@@ -0,0 +1,27 @@
+title: Dell PowerEdge Server: State of Memory Modules
+agents: snmp
+catalog: hw/network/dell
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the state of the memory modules of Dell PowerEdge Servers.
+ The state is extracted from the device via SNMP from the parameter
+ {memoryDeviceStatus}.
+
+ The state of the check is {OK} when the device returns a state of {OK}.
+ The state of the cehck is {WARN} when the device returns a state of {other},
+ {unknown} or {nonCritical}. The state of the check is {CRIT} otherwise.
+
+ No limits are set in the check.
+
+ In addition to the state the following information of the memory modules
+ is retrieved and displayed in the check output: size, speed, manufacturer,
+ part number and serial number
+
+item:
+ The name of the location variable configured for the memory module
+
+inventory:
+ All memory module of the device are detected
+
+
diff --git a/checks/dell_poweredge_mem b/checks/dell_poweredge_mem
new file mode 100644
index 0000000..50e9748
--- /dev/null
+++ b/checks/dell_poweredge_mem
@@ -0,0 +1,87 @@
+#!/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.
+
+dell_poweredge_mem_info = ( ".1.3.6.1.4.1.674.10892.5.4.1100.50.1", [
+ #"1", # memoryDevicechassisIndex 0
+ #"2", # memoryDeviceIndex 1
+ #"3", # memoryDeviceStateCapabilities
+ #"4", # memoryDeviceStateSettings 0
+ "5", # memoryDeviceStatus 0
+ #"6", # memoryDeviceReading
+ #"7", # memoryDeviceType
+ "8", # memoryDeviceLocationName 1
+ #"10", # memoryDeviceBankLocationName
+ "14", # memoryDeviceSize
+ "15", # memoryDeviceSpeed
+ "21", # memoryDeviceManufacturerName
+ "22", # memoryDevicePartNumberName
+ "23", # memoryDeviceSerialNumberName
+ #"26", # memoryDeviceFQDD
+ ])
+
+dell_poweredge_mem_scan = lambda oid: oid('.1.3.6.1.2.1.1.2.0') == ".1.3.6.1.4.1.674.10892.5"
+
+def inventory_dell_poweredge_mem(info):
+ inventory = []
+ for line in info:
+ location = line[1]
+ if location != "":
+ inventory.append( ( location, None ) )
+ return inventory
+
+def check_dell_poweredge_mem(item, _no_params, info):
+ di = dict()
+ for status, location, di['Size'], di['Speed'], di['Manufacturer'], di['PartNumber'], \
+ di['SerialNumber'] in info:
+
+ if item == location:
+ state_table = {
+ "1" : ( "other", 1 ),
+ "2" : ( "unknown", 1 ),
+ "3" : ( "", 0 ),
+ "4" : ( "nonCritical", 1 ),
+ "5" : ( "Critical", 2 ),
+ "6" : ( "NonRecoverable", 2 ),
+ }
+ infotext, state = state_table.get(status, "2")
+ for parameter, value in di.items():
+ infotext += ", %s: %s" % ( parameter, value )
+
+ infotext = re.sub("^, ","", infotext)
+
+ return state, infotext
+
+ return 3, "Memory Device not found"
+
+check_info["dell_poweredge_mem"] = {
+ "check_function" : check_dell_poweredge_mem,
+ "inventory_function" : inventory_dell_poweredge_mem,
+ "service_description" : "%s",
+ "has_perfdata" : False,
+ "snmp_info" : dell_poweredge_mem_info,
+ "snmp_scan" : dell_poweredge_mem_scan,
+}
+
Module: check_mk
Branch: master
Commit: c1ca2a3c2bd99a24d1dd8c6b70981d29e56a48e5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c1ca2a3c2bd99a…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Tue Mar 11 15:40:39 2014 +0100
FIX mkeventd: fixed encoding of unicode characters in the snmptrap receiver
Messages coming in via the build-in snmptrap receiver and containing unicode characters
never matched any rule because the matching algorithm threw an exception. This
has been fixed.
---
.werks/590 | 10 ++++++++++
ChangeLog | 1 +
mkeventd/bin/mkeventd | 8 +++++++-
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/.werks/590 b/.werks/590
new file mode 100644
index 0000000..20753cf
--- /dev/null
+++ b/.werks/590
@@ -0,0 +1,10 @@
+Title: mkeventd: fixed encoding of unicode characters in the snmptrap receiver
+Level: 2
+Component: ec
+Version: 1.2.5i1
+Date: 1394548319
+Class: fix
+
+Messages coming in via the build-in snmptrap receiver and containing unicode characters
+never matched any rule because the matching algorithm threw an exception. This
+has been fixed.
diff --git a/ChangeLog b/ChangeLog
index 8ea63d9..e71ac16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -345,6 +345,7 @@
* 0679 FIX: Allow non-Ascii characters in generated events
* 0680 FIX: Do not allow spaces in host names in event simulator...
* 0672 FIX: Service item of "Check event state in event console" checks can now be configured...
+ * 0590 FIX: mkeventd: fixed encoding of unicode characters in the snmptrap receiver...
Livestatus:
* 0337 New header for limiting the execution time of a query...
diff --git a/mkeventd/bin/mkeventd b/mkeventd/bin/mkeventd
index b00f40f..c9673a1 100755
--- a/mkeventd/bin/mkeventd
+++ b/mkeventd/bin/mkeventd
@@ -957,13 +957,19 @@ class EventServer:
return # dropping unhandled snmp version
# once we got here we have a real parsed trap which we convert to an event now
+ text = ', '.join([ '%s: %s' % (item[0], str(item[1]).replace('\n', '')) for item in trap ])
+ # Convert to Unicode, first assume UTF-8, then latin-1
+ try:
+ text = text.decode("utf-8")
+ except:
+ text = text.decode("latin-1")
event = {
'time' : time.time(),
'host' : host.replace('\n', ''),
'priority' : 5, # notice
'facility' : 31, # not used by syslog -> we use this for all traps
'application' : application.replace('\n', ''),
- 'text' : ', '.join([ '%s: %s' % (item[0], str(item[1]).replace('\n', '')) for item in trap ])
+ 'text' : text
}
self.process_event(event)
Module: check_mk
Branch: master
Commit: a2cd68cdae023ad225cff6e2a6fc5d51bd298aa9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a2cd68cdae023a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Mar 10 14:03:13 2014 +0100
mk_postgres: improved support for versions postgres < 9.2
Postgres < 9.2 didn't know the pg_stat_activity column 'query'.
This caused an entry in the error log.
The new mk_postgres plugin is now able to handle this smarter.
---
.werks/731 | 10 ++++++++++
ChangeLog | 1 +
agents/plugins/mk_postgres | 10 +++++-----
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/.werks/731 b/.werks/731
new file mode 100644
index 0000000..2307b01
--- /dev/null
+++ b/.werks/731
@@ -0,0 +1,10 @@
+Title: mk_postgres: improved support for versions postgres < 9.2
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1394456453
+Class: feature
+
+Postgres < 9.2 didn't know the pg_stat_activity column 'query'.
+This caused an entry in the error log.
+The new mk_postgres plugin is now able to handle this smarter.
diff --git a/ChangeLog b/ChangeLog
index 8565e88..21c69c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -102,6 +102,7 @@
* 0138 Removed caching function in Windows Update agent plugin...
NOTE: Please refer to the migration notes!
* 0564 esx_vsphere_vm.datastores: displays the datastores of the VM...
+ * 0731 mk_postgres: improved support for versions postgres < 9.2...
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/agents/plugins/mk_postgres b/agents/plugins/mk_postgres
index dc92a20..9b135d0 100755
--- a/agents/plugins/mk_postgres
+++ b/agents/plugins/mk_postgres
@@ -11,11 +11,11 @@ fi
echo '<<<postgres_sessions>>>'
# Postgres 9.2 uses 'query' instead of 'current_query'
-for name in query current_query
-do
- OUTPUT="$(echo "select $name = '<IDLE>', count(*) from pg_stat_activity group by ($name = '<IDLE>');" |\
- su - $USER -c "psql --variable ON_ERROR_STOP=1 -d postgres -A -t -F' '" 2>/dev/null)" && break
-done
+QNAME="$(echo "select column_name from information_schema.columns where table_name='pg_stat_activity' and column_name in ('query','current_query');" |\
+ su - $USER -c "psql -d postgres -t -A -F';'")"
+OUTPUT="$(echo "select $QNAME = '<IDLE>', count(*) from pg_stat_activity group by ($QNAME = '<IDLE>');" |\
+ su - $USER -c "psql --variable ON_ERROR_STOP=1 -d postgres -A -t -F' '" 2>/dev/null)"
+
echo "$OUTPUT"
# line with number of idle sessions is sometimes missing on Postgre 8.x. This can lead
# to an altogether empty section and thus the check disappearing.