* Feature request: "inverted" ping -a (beep on failure)
@ 2011-04-15 19:35 Christian Boltz
2011-04-15 19:49 ` Randy Dunlap
2011-04-15 21:57 ` Martin Topholm
0 siblings, 2 replies; 6+ messages in thread
From: Christian Boltz @ 2011-04-15 19:35 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
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
--
"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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: "inverted" ping -a (beep on failure)
2011-04-15 19:35 Feature request: "inverted" ping -a (beep on failure) Christian Boltz
@ 2011-04-15 19:49 ` Randy Dunlap
2011-04-15 20:10 ` Denys Fedoryshchenko
[not found] ` <20110415124937.6e746646.rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org>
2011-04-15 21:57 ` Martin Topholm
1 sibling, 2 replies; 6+ messages in thread
From: Randy Dunlap @ 2011-04-15 19:49 UTC (permalink / raw)
To: Christian Boltz; +Cc: netdev
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 ;-)
>
>
> (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 ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: "inverted" ping -a (beep on failure)
2011-04-15 19:49 ` Randy Dunlap
@ 2011-04-15 20:10 ` Denys Fedoryshchenko
[not found] ` <20110415124937.6e746646.rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org>
1 sibling, 0 replies; 6+ messages in thread
From: Denys Fedoryshchenko @ 2011-04-15 20:10 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Christian Boltz, netdev
On Fri, 15 Apr 2011 12:49:37 -0700, Randy Dunlap wrote:
> 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 ;-)
>>
>>
>> (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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: "inverted" ping -a (beep on failure)
[not found] ` <20110415124937.6e746646.rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org>
@ 2011-04-15 20:11 ` Christian Boltz
2011-04-15 20:14 ` Randy Dunlap
0 siblings, 1 reply; 6+ messages in thread
From: Christian Boltz @ 2011-04-15 20:11 UTC (permalink / raw)
To: Randy Dunlap, netdev-u79uwXL29TY76Z2rM5mHXA
Hello,
Am Freitag, 15. April 2011 schrieb Randy Dunlap:
> On Fri, 15 Apr 2011 21:35:32 +0200 Christian Boltz wrote:
> > I'd like to have the exact opposite of it: beep when pinging fails.
[...]
> 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 1
done
but I'd prefer to have something like this directly in ping ;-)
> Or do you want ping to beep and then continue running?
Yes, that's exactly what I want.
Gruß
Christian Boltz
--
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: "inverted" ping -a (beep on failure)
2011-04-15 20:11 ` Christian Boltz
@ 2011-04-15 20:14 ` Randy Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2011-04-15 20:14 UTC (permalink / raw)
To: Christian Boltz; +Cc: netdev
On Fri, 15 Apr 2011 22:11:45 +0200 Christian Boltz wrote:
> Hello,
>
> Am Freitag, 15. April 2011 schrieb Randy Dunlap:
> > On Fri, 15 Apr 2011 21:35:32 +0200 Christian Boltz wrote:
> > > I'd like to have the exact opposite of it: beep when pinging fails.
> [...]
> > 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.
> 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.
> 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.
> ping -c1 $server || beep
> sleep 1
> done
>
> but I'd prefer to have something like this directly in ping ;-)
>
> > 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 ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Feature request: "inverted" ping -a (beep on failure)
2011-04-15 19:35 Feature request: "inverted" ping -a (beep on failure) Christian Boltz
2011-04-15 19:49 ` Randy Dunlap
@ 2011-04-15 21:57 ` Martin Topholm
1 sibling, 0 replies; 6+ messages in thread
From: Martin Topholm @ 2011-04-15 21:57 UTC (permalink / raw)
To: Christian Boltz; +Cc: netdev
On Fri, 15 Apr 2011, Christian Boltz wrote:
> 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 .
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-04-15 22:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-15 19:35 Feature request: "inverted" ping -a (beep on failure) Christian Boltz
2011-04-15 19:49 ` Randy Dunlap
2011-04-15 20:10 ` Denys Fedoryshchenko
[not found] ` <20110415124937.6e746646.rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org>
2011-04-15 20:11 ` Christian Boltz
2011-04-15 20:14 ` Randy Dunlap
2011-04-15 21:57 ` Martin Topholm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).