Glen Pitt-Pladdy :: BlogPing, ping, ping.... | |||
Update: This is an old version of the script. See a more recent version of the pinger script.
After searching high and low for a basic host monitoring utility capable of monitoring and logging ping status of a number of hosts, I gave up and wrote my own. Keeping it simpleThe big problem with everything I found was that it was way too complicated, or simply didn't do the job. The original version of the script was written simply to log pings, and this week proved it's usefulness once again, but this time it needed a small addition. A company I do IT consulting for ran into some trouble (BT fault) with their internet connectivity. Their connection is intermittent (mostly down), so to ensure they get their mail reliably, the backup MX needs to deliver the queued mail as soon as their connection comes up rather than on the regular retry schedule which could be too slow to catch them when they come up briefly. All that I added was the facility to execute commands when a host goes down or comes up, and by executing "/usr/sbin/sendmail -q" with postfix, it gives it a kick and it attempts to deliver the queue. Likewise this could be used to email someone when a host's status changes. The next day, the script proved useful again at another company where I had it running to log the status of their networks (I didn't trust some of their service providers). A hosting company sent a mail saying that they had detected a problem with the server in the data centre, but wanted payment before they would say what the problem was. A quick look at logs that this script produces and it was all clear (I monitor the last couple of hops as well as the server): one of their routers had died for a few minutes and hence the server was not available. Why they wanted to be paid to tell us that they had a fault (they probably would not have admitted it anyway), really calls into question their own monitoring (never attribute to malice what can be attributed to stupidity). How to use itSimply fill in a useful name (put into the column headers of the logs) and associated hostname or IP address in the %MONITOR hash. Next, if you want some action when a host goes up or down, add that into the %HOST_UP or %HOST_DOWN hashes. If you want control over the rates and other parameters of ping, then alter them below. The script is normally run on Debian GNU/Linux, but should be fine on virtually any other Linux distro, and also most other unix style systems. You may need to modify the path to Perl or ping, and the ping options, but that is about it. Once started, the script will create files named "pinglog-YYYYMMDD.csv" in the current directory, which should load in any spreadsheet that supports csv such as OpenOffice. To leave it running in the background, I normally use GNU screen. DownloadThe script is no longer available. |
|||
This is a bunch of random thoughts, ideas and other nonsense, and is not intended to be taken seriously. I'm experimenting and mostly have no idea what I am doing with most of this so it should be taken with cuation and at your own risk. Intrustive technologies are minimised where possible. For the purposes of reducing abuse and other risks hCaptcha is used and has it's own policies linked from the widget.
Copyright Glen Pitt-Pladdy 2008-2023
|