added "waitmax" binary for CCU2 and CCU3 platform and propagated its use
to the check_mk agent execution. Also implemented nfsmounts and cifsmounts outputs using waitmax.
This commit is contained in:
parent
d3b393dece
commit
2ab8da8d1b
|
@ -34,10 +34,10 @@ proc handle_connection { channelId clientAddress clientPort } {
|
|||
|
||||
if { [file exists /proc/net/tcp6] == 1 } {
|
||||
puts $channelId "<<<tcp_conn_stats>>>"
|
||||
puts $channelId "[exec cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk { /:/ { c[$4]++; } END { for (x in c) { print x, c[x]; } } }]"
|
||||
puts $channelId "[exec /usr/local/addons/check_mk_agent/waitmax -s 1 10 cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk { /:/ { c[$4]++; } END { for (x in c) { print x, c[x]; } } }]"
|
||||
} else {
|
||||
puts $channelId "<<<tcp_conn_stats>>>"
|
||||
puts $channelId "[exec cat /proc/net/tcp 2>/dev/null | awk { /:/ { c[$4]++; } END { for (x in c) { print x, c[x]; } } }]"
|
||||
puts $channelId "[exec /usr/local/addons/check_mk_agent/waitmax -s 1 10 cat /proc/net/tcp 2>/dev/null | awk { /:/ { c[$4]++; } END { for (x in c) { print x, c[x]; } } }]"
|
||||
}
|
||||
|
||||
puts $channelId "<<<lnx_if>>>"
|
||||
|
@ -65,6 +65,14 @@ proc handle_connection { channelId clientAddress clientPort } {
|
|||
puts $channelId "<<<mounts>>>"
|
||||
puts $channelId "[exec egrep ^(/dev|ubi) < /proc/mounts]"
|
||||
|
||||
if { [file exists /bin/stat] == 1 } {
|
||||
puts $channelId "<<<nfsmounts>>>"
|
||||
puts $channelId [exec sh -c {sed -n '/ nfs4\? /s/[^ ]* \([^ ]*\) .*/\1/p' </proc/mounts | sed 's/\\040/ /g' | while read MP; do /usr/local/addons/check_mk_agent/waitmax -s 9 5 stat -f -c "$MP ok %b %f %a %s" "$MP" || echo "$MP hanging 0 0 0 0"; done}]
|
||||
|
||||
puts $channelId "<<<cifsmounts>>>"
|
||||
puts $channelId [exec sh -c {sed -n '/ cifs\? /s/[^ ]* \([^ ]*\) .*/\1/p' </proc/mounts | sed 's/\\040/ /g' | while read MP; do if [ ! -r "$MP" ]; then echo "$MP Permission denied"; else /usr/local/addons/check_mk_agent/waitmax -s 9 2 stat -f -c "$MP ok %b %f %a %s" "$MP" || echo "$MP hanging 0 0 0 0"; fi; done}]
|
||||
}
|
||||
|
||||
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) /'}]"
|
||||
|
||||
|
@ -74,7 +82,7 @@ proc handle_connection { channelId clientAddress clientPort } {
|
|||
|
||||
if { [file exists /usr/bin/ntpq] == 1 } {
|
||||
puts $channelId "<<<ntp>>>"
|
||||
puts $channelId "[exec ntpq -np | sed -e 1,2d -e {s/^\(.\)/\1 /} -e {s/^ /%/}]"
|
||||
puts $channelId "[exec /usr/local/addons/check_mk_agent/waitmax 5 /usr/bin/ntpq -np | sed -e 1,2d -e {s/^\(.\)/\1 /} -e {s/^ /%/}]"
|
||||
}
|
||||
|
||||
puts $channelId "<<<homematic:sep(59)>>>"
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -8,6 +8,12 @@ RCDDIR=/usr/local/etc/config/rc.d
|
|||
case "$1" in
|
||||
|
||||
""|start)
|
||||
rm -f /usr/local/addons/${ADDONNAME}/waitmax 2>/dev/null
|
||||
if [ "$(uname -m)" == "armv5tejl" ]; then
|
||||
ln -s /usr/local/addons/${ADDONNAME}/waitmax-ccu2 /usr/local/addons/${ADDONNAME}/waitmax
|
||||
else
|
||||
ln -s /usr/local/addons/${ADDONNAME}/waitmax-ccu3 /usr/local/addons/${ADDONNAME}/waitmax
|
||||
fi
|
||||
tclsh $ADDONDIR/server.tcl &
|
||||
;;
|
||||
|
||||
|
@ -23,7 +29,7 @@ case "$1" in
|
|||
|
||||
info)
|
||||
echo "Info: <b>(Inoffical) check_mk agent</b>"
|
||||
echo "Version: 1.3"
|
||||
echo "Version: 1.4"
|
||||
echo "Name: check_mk_agent"
|
||||
echo "Operations: uninstall restart"
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue