From 714fbae9e8495e7d81a5e6f5c40ccf93ddcd19f7 Mon Sep 17 00:00:00 2001 From: Jens Maus Date: Mon, 22 Oct 2018 16:04:58 +0200 Subject: [PATCH] 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. --- addon/addon/server.tcl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addon/addon/server.tcl b/addon/addon/server.tcl index cb16023..3a1d875 100755 --- a/addon/addon/server.tcl +++ b/addon/addon/server.tcl @@ -47,6 +47,9 @@ proc handle_connection { channelId clientAddress clientPort } { puts $channelId "<<>>" 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 "<<>>" if { [exec busybox | sed -n 1p | awk { { print $2 } }] == "v1.20.2" } { @@ -62,6 +65,9 @@ proc handle_connection { channelId clientAddress clientPort } { puts $channelId "<<>>" puts $channelId "[exec egrep ^(/dev|ubi) < /proc/mounts]" + puts $channelId "<<>>" + 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 "<<>>" 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]"