The 03.10.13 at 15:54, Damian Buckley wrote:
about this and now want to set a command up to email me via sendmail when the ping command fails....
Is this possible? and can anybody show me how?
Yes, it is. You would have to use a better tool, like fping: |> Unlike ping , fping is meant to be used in scripts, so its output |> is designed to be easy to parse. nimrodel:~ # fping telperion nimrodel nimrodel is alive telperion is unreachable nimrodel:~ # You would have to run a script from cron. This script (running as root, mind) does the fping stuff (fping needs root privileges). Then you would parse the output: finding the string 'unreachable' could trigger the email sending; I would use mailx for that. You can increase the information: nimrodel:~ # fping -e telperion nimrodel nimrodel is alive (0.11 ms) telperion is unreachable nimrodel:~ # or include statistics: nimrodel:~ # fping -e -s telperion nimrodel nimrodel is alive (0.10 ms) telperion is unreachable 2 targets 1 alive 1 unreachable 0 unknown addresses 4 timeouts (waiting for response) 5 ICMP Echos sent 1 ICMP Echo Replies received 3 other ICMP received 0.10 ms (min round trip time) 0.10 ms (avg round trip time) 0.10 ms (max round trip time) 4.087 sec (elapsed real time) nimrodel:~ # -- Cheers, Carlos Robinson