View Single Post
No!No!No!Yes!'s Avatar
Posts: 700 | Thanked: 846 times | Joined on Nov 2009
#8
Originally Posted by Bratag View Post
Very cool - One imagines this can be applied to pretty much any % based command.
Sure... see also following Beeconified version of a "ping -q -c 3 server1" command to test server1 responsiveness:
Code:
ping -q -c 3 server1 | awk 'BEGIN { FS="[ \/]+"; rt=0 } $1 == "round-trip" { rt=1; print $6 "\n" $7 "\n" $8 "\n(ms)"; if ($8 < 100) exit 0; else if ($8 < 200) exit 1; else exit 2 } END { if ( rt == 0 ) exit -1 }'
The awk statement will return:
Exit Status 0 (Green Beecon) for round-trip max below 100ms
Exit Status 1 (Yellow Beecon) for round-trip max between 100 and 200 ms
Exit Status 2 (Red Beecon) for round-trip max above 200ms
Exit Status -1 (Grey Beecon) for server1 unresponsiveness
 

The Following 2 Users Say Thank You to No!No!No!Yes! For This Useful Post: