Re: ping server
debian user wrote:
i would like to set up a ping server for my office. I however have
not found a simple way of recieving a responce of "dead" or "alive".
I am not to concerned about time etc? I just want to ping a few
servers and then send the results out in a email to a few key
personal. Right now I am doing "echo ping -c 3 server-name > file"
for half a dozen boxes then i email the file to sevel people
periodicly during the day. I would like it to be a little eaiser to
read i.e. "dead" or "alive" after the server name.
You can use the returnvalue of ping to get some information:
dev2:~# ping -c 2 localhost
PING dev2 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.0 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.0 ms
--- dev2 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms
dev2:~# echo $?
0
dev2:~# ping -c 2 unknownhostname
ping: unknown host unknownhostname
dev2:~# echo $?
2
dev2:~# ping -c 2 10.0.0.230 (dead IP)
PING 10.0.0.230 (10.0.0.230): 56 data bytes
--- 10.0.0.230 ping statistics ---
2 packets transmitted, 0 packets received, 100% packet loss
dev2:~# echo $?
1
Otherwise, look at Big Brother at www.bb4.org. It does some of the same,
just more indepth.Just because your server answers ping, it doesn't mean
that apache can't be dead ;)
Venlig hilsen
Martin Seebach
Reply to: