Ping reporter script Filed Under: Perl
Description
This is an application to report if a device or a web server is down at any time.
The script can check the status by either pinging the device using an ICMP packet or by checking if a specific web page is available on that device.
The user will be informed if the device goes down or comes back up by sending an email.
The first time you run the script it will autogenerate a sample configuration that you must edit with the appropriate parameters.
The application in not run as a service so you will need create a task or a cron job so it is run at specific intervals.
Requirements
To be able to run the script you need to install the following CPAN modules.
- Config::Simple
- libwww-perl
Configuration file structure
The configuration file is split in various sections:
Device List
This section of the file contains the list of devices that the script will look. This are reference to other parts of the configuration file so in the case you want to stop monitor a device but you don’t want to remove the configuration part for that device just remove the name of that device from the deviceList
.
[pingReporter]
deviceList=name, name2
Mail settigns
This section of the configuration will configure the appropriate settings for sending email notifications.
[mail]
recipient=recipient@domain.com
sender=sender@domain.com
server={server name or IP}
Device settigns
This section of the configuration file will configure the various settings for the device that needs to be check.
- Location: this a description of the location where the device is located. This is used in the emails so the user know the location of the device.
- Check: this can be either a ping to the device using ICMP (
icmp
setting) or a check of a web page (http
setting). - IP: this is used if you have selected the
icmp
setting. This is the IP address or the name of the device. - URL: use this only if you have setup the check as
http
. This setting will be the page that the script will check if is available. - status: do not edit this part of the configuration as is used internally by the script to know if the device was previously up or down.
[name]
location=location name
check={icmp | http}
status={online | offline}
IP={IP address or device name}
url=url of web page
Download
- Permalink
- Alberto Diaz
- 6 Jan 2008 3:08 PM
- Comments (2)
January 6th, 2008 at 15:19
Diox, que mitico que eres!!!!
Buen script!! Ademas me va a venir muy bien ahora q voy a tener que aprender Perl a cholón.
Sigue así!!! cuidate
March 6th, 2012 at 20:36
I’m new to all this pinging stuff. Just doing a lot of reading online about it, trying to learn more about pings and how they function. Cheers.