1
0
mirror of https://github.com/alexreinert/homematic_check_mk.git synced 2023-10-10 13:37:02 +02:00

Added date of last change to check message

Support more checks on CCU2
Preparations for release 1.1
This commit is contained in:
Alexander Reinert 2017-07-19 20:45:41 +02:00
parent 13d1e92fac
commit 085bf4b77b
4 changed files with 17 additions and 18 deletions

View File

@ -48,18 +48,20 @@ proc handle_connection { channelId clientAddress clientPort } {
puts $channelId "<<<lnx_if:sep(58)>>>" puts $channelId "<<<lnx_if:sep(58)>>>"
puts $channelId "[exec sed 1,2d /proc/net/dev]" puts $channelId "[exec sed 1,2d /proc/net/dev]"
puts $channelId "<<<df>>>"
if { [regexp CCU2 [exec grep Hardware < /proc/cpuinfo]] == 0 } { if { [regexp CCU2 [exec grep Hardware < /proc/cpuinfo]] == 0 } {
puts $channelId "<<<df>>>"
puts $channelId "[exec df -PTk | sed 1d]" puts $channelId "[exec df -PTk | sed 1d]"
} else {
puts $channelId "<<<mounts>>>" puts $channelId "[exec df -Pk | sed 1d]"
puts $channelId "[exec grep ^/dev < /proc/mounts]"
puts $channelId "<<<diskstat>>>"
puts $channelId "[clock seconds]"
puts $channelId "[exec egrep { (x?[shv]d[a-z]*|cciss/c[0-9]+d[0-9]+|emcpower[a-z]+|dm-[0-9]+|VxVM.*|mmcblk.*|dasd[a-z]*|bcache[0-9]+|nvme[0-9]+n[0-9]+) } < /proc/diskstats]"
} }
puts $channelId "<<<mounts>>>"
puts $channelId "[exec egrep ^(/dev|ubi) < /proc/mounts]"
puts $channelId "<<<diskstat>>>"
puts $channelId "[clock seconds]"
puts $channelId "[exec egrep { (x?[shv]d[a-z]*|cciss/c[0-9]+d[0-9]+|emcpower[a-z]+|dm-[0-9]+|VxVM.*|mmcblk.*|dasd[a-z]*|bcache[0-9]+|nvme[0-9]+n[0-9]+|mtdblock.+) } < /proc/diskstats]"
if { [file exists /usr/bin/ntpq] == 1 } { if { [file exists /usr/bin/ntpq] == 1 } {
puts $channelId "<<<ntp>>>" puts $channelId "<<<ntp>>>"
puts $channelId "[exec ntpq -np | sed -e 1,2d -e {s/^\(.\)/\1 /} -e {s/^ /%/}]" puts $channelId "[exec ntpq -np | sed -e 1,2d -e {s/^\(.\)/\1 /} -e {s/^ /%/}]"
@ -80,7 +82,7 @@ proc handle_connection { channelId clientAddress clientPort } {
} }
foreach plugin [glob -nocomplain "[file dirname [info script]]/plugins/*"] { foreach plugin [glob -nocomplain "[file dirname [info script]]/plugins/*"] {
puts $channelId "[exec $plugin]" puts $channelId [exec $plugin]
} }
flush $channelId flush $channelId
@ -110,7 +112,7 @@ proc get_homematic_check_result { } {
_dp = dom.GetObject(_svc.AlTriggerDP()); _dp = dom.GetObject(_svc.AlTriggerDP());
_ch = dom.GetObject(_dp.Channel()); _ch = dom.GetObject(_dp.Channel());
_dev = dom.GetObject(_ch.Device()); _dev = dom.GetObject(_ch.Device());
WriteLine("SVC_MSG;" # _dev.Name() # ";" # _svc.Name().StrValueByIndex (".", 1).StrValueByIndex ("-", 0) # ";" # _dp.Timestamp()); WriteLine("SVC_MSG;" # _dev.Name() # ";" # _svc.Name().StrValueByIndex (".", 1).StrValueByIndex ("-", 0) # ";" # _dp.Timestamp());
} }
} }

View File

@ -23,7 +23,7 @@ case "$1" in
info) info)
echo "Info: <b>(Inoffical) check_mk agent</b>" echo "Info: <b>(Inoffical) check_mk agent</b>"
echo "Version: 1.0" echo "Version: 1.1"
echo "Name: check_mk_agent" echo "Name: check_mk_agent"
echo "Operations: uninstall restart" echo "Operations: uninstall restart"
;; ;;

View File

@ -71,10 +71,6 @@ def inventory_homematic_humidity(parsed):
if temperature is not None and humidity is not None: if temperature is not None and humidity is not None:
yield line, { } yield line, { }
# data = parsed[line]
# if isinstance(data, dict) and data.get('HSSTYPE', 'UNKNOWN') in [ [u'HM-WDS10-TH-O'], [u'HM-WDS20-TH-O'], [u'HM-WDS40-TH-I'], [u'HM-CC-TC'], [u'HM-WDS100-C6-O-2'], [u'HM-WDS100-C6-O'], [u'HM-TC-IT-WM-W-EU'], [u'HM-WDS40-TH-I-2'], [u'HM-WDC7000'], [u'HMIP-WTH'], [u'HmIP-WTH-2'], [u'HmIP-STH'], [u'HmIP-STHD'], [u'HmIP-BWTH'], [u'HmIP-BWTH24'] ]:
# yield line, { }
def check_homematic_humidity(item, params, parsed): def check_homematic_humidity(item, params, parsed):
for line in parsed: for line in parsed:
if line == item: if line == item:
@ -85,6 +81,7 @@ def check_homematic_humidity(item, params, parsed):
if humidity is None or temperature is None: if humidity is None or temperature is None:
return 3, 'Humidity or temperature are not available' return 3, 'Humidity or temperature are not available'
date = humidity[1]
temperature = float(temperature[0]) temperature = float(temperature[0])
humidity = float(humidity[0]) humidity = float(humidity[0])
@ -95,7 +92,7 @@ def check_homematic_humidity(item, params, parsed):
else: else:
state = 0 state = 0
message = "Temperature: %f, Humidity: %f" % (temperature, humidity) message = "Temperature: %f, Humidity: %f (last change: %s)" % (temperature, humidity, date)
perfdata = [ perfdata = [
('temperature', temperature), ('temperature', temperature),
('humidity', humidity), ('humidity', humidity),

View File

@ -15,6 +15,6 @@
'plugins/wato/homematic.py']}, 'plugins/wato/homematic.py']},
'name': 'homematic', 'name': 'homematic',
'title': 'Homematic', 'title': 'Homematic',
'version': '1.0', 'version': '1.1',
'version.min_required': '1.2.8', 'version.min_required': '1.2.8',
'version.packaged': '1.4.0p5'} 'version.packaged': '1.4.0p8'}