Skip to content

Commit

Permalink
added ps and ethtool aware check_mk output.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jens-maus authored and alexreinert committed Oct 22, 2018
1 parent 5fd140e commit 714fbae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addon/addon/server.tcl
Expand Up @@ -47,6 +47,9 @@ proc handle_connection { channelId clientAddress clientPort } {

puts $channelId "<<<lnx_if:sep(58)>>>"
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>>>"
if { [exec busybox | sed -n 1p | awk { { print $2 } }] == "v1.20.2" } {
Expand All @@ -62,6 +65,9 @@ proc handle_connection { channelId clientAddress clientPort } {
puts $channelId "<<<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 "[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]"
Expand Down

0 comments on commit 714fbae

Please sign in to comment.