Ping (ICMP) Monitor Script

This script is from 2004 and mostly obselete. It is here for reference on various functions. There are better ways to do this now.

This is a script written in PHP that will monitor an IP via ICMP and report via syslog if the system goes down and also reports how long it was down once it comes back up. I needed this to monitor not only my internet connection at home but also my hosted connection and server. It generates the ping itself (in this version) so it requires root access but it would be easy to write a new ping() routine to just call /bin/ping. It runs either as a daemon or at the console but I recommend it as a daemon.

PHP has to be compiled with –enable-pcntl and –enable-sockets.

While I would still call this script beta, it does it’s job. Note, that you can send the process a HUP to re-read the configuration without restarting it. Enjoy!

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *