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,17 +48,19 @@ proc handle_connection { channelId clientAddress clientPort } {
puts $channelId "<<<lnx_if:sep(58)>>>"
puts $channelId "[exec sed 1,2d /proc/net/dev]"
if { [regexp CCU2 [exec grep Hardware < /proc/cpuinfo]] == 0 } {
puts $channelId "<<<df>>>"
if { [regexp CCU2 [exec grep Hardware < /proc/cpuinfo]] == 0 } {
puts $channelId "[exec df -PTk | sed 1d]"
} else {
puts $channelId "[exec df -Pk | sed 1d]"
}
puts $channelId "<<<mounts>>>"
puts $channelId "[exec grep ^/dev < /proc/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]+) } < /proc/diskstats]"
}
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 } {
puts $channelId "<<<ntp>>>"
@ -80,7 +82,7 @@ proc handle_connection { channelId clientAddress clientPort } {
}
foreach plugin [glob -nocomplain "[file dirname [info script]]/plugins/*"] {
puts $channelId "[exec $plugin]"
puts $channelId [exec $plugin]
}
flush $channelId

View File

@ -23,7 +23,7 @@ case "$1" in
info)
echo "Info: <b>(Inoffical) check_mk agent</b>"
echo "Version: 1.0"
echo "Version: 1.1"
echo "Name: check_mk_agent"
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:
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):
for line in parsed:
if line == item:
@ -85,6 +81,7 @@ def check_homematic_humidity(item, params, parsed):
if humidity is None or temperature is None:
return 3, 'Humidity or temperature are not available'
date = humidity[1]
temperature = float(temperature[0])
humidity = float(humidity[0])
@ -95,7 +92,7 @@ def check_homematic_humidity(item, params, parsed):
else:
state = 0
message = "Temperature: %f, Humidity: %f" % (temperature, humidity)
message = "Temperature: %f, Humidity: %f (last change: %s)" % (temperature, humidity, date)
perfdata = [
('temperature', temperature),
('humidity', humidity),

View File

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