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

added ps and ethtool aware check_mk output.

added ps and ethtool aware check_mk output. Please note that the output
of ps is somewhat limited to the capabilities to the ps command of
busybox for which conversion routines might be a solution in future. But
for the moment this should be enough to actually monitor if a certain
process is running or not.
This commit is contained in:
Jens Maus 2018-10-22 16:04:58 +02:00 committed by Alexander Reinert
parent 5fd140ea24
commit 714fbae9e8

View File

@ -47,6 +47,9 @@ 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]"
if { [file exists /usr/sbin/ethtool] } {
puts $channelId [exec sh -c {sed -e 1,2d /proc/net/dev | cut -d':' -f1 | sort | while read eth; do echo "[$eth]"; ethtool "$eth" | grep -E '(Speed|Duplex|Link detected|Auto-negotiation):'; echo -e "\tAddress: $(cat "/sys/class/net/$eth/address")\n"; done}]
}
puts $channelId "<<<df>>>" puts $channelId "<<<df>>>"
if { [exec busybox | sed -n 1p | awk { { print $2 } }] == "v1.20.2" } { if { [exec busybox | sed -n 1p | awk { { print $2 } }] == "v1.20.2" } {
@ -62,6 +65,9 @@ proc handle_connection { channelId clientAddress clientPort } {
puts $channelId "<<<mounts>>>" puts $channelId "<<<mounts>>>"
puts $channelId "[exec egrep ^(/dev|ubi) < /proc/mounts]" puts $channelId "[exec egrep ^(/dev|ubi) < /proc/mounts]"
puts $channelId "<<<ps>>>"
puts $channelId "[exec sh -c {ps ax -o user,vsz,rss,pid,args | sed -e 1d -e 's/ *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) */(\1,0,0,00:00:00\/00:00:00,\4) /'}]"
puts $channelId "<<<diskstat>>>" puts $channelId "<<<diskstat>>>"
puts $channelId "[clock seconds]" 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]" 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]"