Feature request: "inverted" ping -a (beep on failure)
Subsystems (2)
Hello,
ping -a (beep on ping success) is a quite useful command, but it can be annoying.
I'd like to have the exact opposite of it: beep when pinging fails.
I understand that this is slightly difficult because "ping success" is easier to detect (incoming package) than "ping failure" (no incoming package or firewall reject) - my proposal is to have a timeout for every package (if no reply package comes in) and beep if no reply is seen after the timeout is over.
For the timeout, the -W option could be used. The default timeout seems to be 10 seconds, which is OK.
Usecase / why this would be useful for me:
Basically for server monitoring. The exact usecase is that I have rented a "root server" and asked the hoster to exchange a broken harddisk. With the "inverted" ping -a, it would be easy to notice when they switch off the server to replace the disk.
Please consider this feature for the next version of ping ;-)
(The iputils homepage does not list any bugtracker or similar, therefore I'm asking here.)
Gruß
Christian Boltz
Signature · 8 lines
"we will support any library from any repo combined with any application" is something that NO ONE does. Or if they do, they are insane, or lying, or both. [Greg KH in opensuse-factory] -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 22 lines · On Fri, 15 Apr 2011 21:35:32 +0200 Christian Boltz wrote:
Hello,
ping -a (beep on ping success) is a quite useful command, but it can be annoying.
I'd like to have the exact opposite of it: beep when pinging fails.
I understand that this is slightly difficult because "ping success" is easier to detect (incoming package) than "ping failure" (no incoming package or firewall reject) - my proposal is to have a timeout for every package (if no reply package comes in) and beep if no reply is seen after the timeout is over.
For the timeout, the -W option could be used. The default timeout seems to be 10 seconds, which is OK.
Usecase / why this would be useful for me:
Basically for server monitoring. The exact usecase is that I have rented a "root server" and asked the hoster to exchange a broken harddisk. With the "inverted" ping -a, it would be easy to notice when they switch off the server to replace the disk.
Quoted 5 lines
Please consider this feature for the next version of ping ;-)
(The iputils homepage does not list any bugtracker or similar, therefore I'm asking here.)
Couldn't you look for exit code (status) 1 and then do a bell/beep (or play a sound file :)?
Or do you want ping to beep and then continue running?
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
Hello,
Am Freitag, 15. April 2011 schrieb Randy Dunlap:
Quoted 2 lines · On Fri, 15 Apr 2011 21:35:32 +0200 Christian Boltz wrote:
Quoted 1 line
I'd like to have the exact opposite of it: beep when pinging fails.
[...]
Quoted 2 lines
Couldn't you look for exit code (status) 1 and then do a bell/beep (or play a sound file :)?
That would require that I know in advance when exactly the server is unreachable - but in this case, I wouldn't need to ping it ;-)
To have this working, ping would need an option "exit on error", which it doesn't have AFAIK.
A workaround is to run ping -c1 in a loop:
while true ; do
ping -c1 $server || beep
sleep 1done
but I'd prefer to have something like this directly in ping ;-)
Quoted 1 line
Or do you want ping to beep and then continue running?
Yes, that's exactly what I want.
Gruß
Christian Boltz
Quoted 2 lines
Ich moechte gern einige User die ihre Mails ueber einen Mailserver (sendmail bevorzugt, postfix auch moeglich) scannen.
Dafür reicht ein Kopierer. Hosen runter, User draufsetzen und "Copy"
drücken! [> Ralf Thomas und Sandy Drobic in suse-linux]
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · On Fri, 15 Apr 2011 22:11:45 +0200 Christian Boltz wrote:
Hello,
Am Freitag, 15. April 2011 schrieb Randy Dunlap:
Quoted 2 lines · On Fri, 15 Apr 2011 21:35:32 +0200 Christian Boltz wrote:
Quoted 1 line
I'd like to have the exact opposite of it: beep when pinging fails.
[...]
Quoted 2 lines
Couldn't you look for exit code (status) 1 and then do a bell/beep (or play a sound file :)?
That would require that I know in advance when exactly the server is unreachable - but in this case, I wouldn't need to ping it ;-)
I didn't follow that, but it's OK.
Quoted 2 lines
To have this working, ping would need an option "exit on error", which it doesn't have AFAIK.
'man ping' discusses exit status codes:
If ping does not receive any reply packets at all it will exit with code 1. If a packet count and deadline are both specified, and fewer than count packets are received by the time the deadline has arrived, it will also exit with code 1. On other error it exits with code 2. Otherwise it exits with code 0. This makes it possible to use the exit code to see if a host is alive or not.
Quoted 3 lines
A workaround is to run ping -c1 in a loop:
while true ; do If ping does not receive any reply packets at all it will exit with
code 1. If a packet count and deadline are both specified, and fewer than count packets are received by the time the deadline has arrived, it will also exit with code 1. On other error it exits with code 2. Otherwise it exits with code 0. This makes it possible to use the exit code to see if a host is alive or not.
Quoted 9 lines
ping -c1 $server || beep sleep 1done
but I'd prefer to have something like this directly in ping ;-)
Quoted 1 line
Or do you want ping to beep and then continue running?
Yes, that's exactly what I want.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
Quoted 27 lines · Randy Dunlap
Quoted 25 lines · On Fri, 15 Apr 2011 21:35:32 +0200 Christian Boltz wrote:
Hello,
ping -a (beep on ping success) is a quite useful command, but it can be annoying.
I'd like to have the exact opposite of it: beep when pinging fails.
I understand that this is slightly difficult because "ping success" is easier to detect (incoming package) than "ping failure" (no incoming package or firewall reject) - my proposal is to have a timeout for every package (if no reply package comes in) and beep if no reply is seen after the timeout is over.
For the timeout, the -W option could be used. The default timeout seems to be 10 seconds, which is OK.
Usecase / why this would be useful for me:
Basically for server monitoring. The exact usecase is that I have rented a "root server" and asked the hoster to exchange a broken harddisk. With the "inverted" ping -a, it would be easy to notice when they switch off the server to replace the disk.Please consider this feature for the next version of ping ;-)
Quoted 8 lines
Quoted 2 lines
(The iputils homepage does not list any bugtracker or similar, therefore I'm asking here.)
Couldn't you look for exit code (status) 1 and then do a bell/beep (or play a sound file :)?
Or do you want ping to beep and then continue running?
I wrote my own tool and call it ping watchdog (i so ideas about ping watchdog in other projects, just improved it a little) :-) Probably it can be useful here, it can run script if ping fail more than N packets... it is a bit undocumented and cryptic, but i can improve it.
http://code.google.com/p/sysadmin-tools/source/browse/trunk/pingwdog/pingwdog.c
Quoted 1 line · Christian Boltz
I'd like to have the exact opposite of it: beep when pinging fails.
I too have missed this feature (from the BSDs ping). Also I needed adhoc tracking of multiple hosts. So I experimented with libevent2 and some code from the BSD ping...
You can see the result here http://hoth.dk/xping/screenshot.jpeg
or http://hoth.dk/xping/xping-20110415.tar.gz .
Quoted 3 lines
I understand that this is slightly difficult because "ping success" is easier to detect (incoming package) than "ping failure" (no incoming package or firewall reject)
I used the transmit interval for timeout. There's propably a lot of corner cases I haven't thought about, but it works fairly well.
Regards, Martin