WhoisUP – Is your host up or down?

During last months, I have not written tutorial about Cisco technology because I have dedicated my free time to write my personal script to monitor hosts, router and so on.

Why write a new script and not use a pre-existent script/software? The reasons are different, but in particular three:

  • Surfing the web, I have found software that check hosts with a minute delay (they use crontab…), but in my case I want to check hosts continuously; other software can check hosts continually, but they are too complex for my purpose and they have features don’t needed in my case.
  • They can be too expensive.
  • The second reason is because I love PHP and write code :)

Having said this, I have published WhoisUP: an open source script released under the GPLv2, that monitors hosts via ICMP, shows the status in a web page with AJAX features and send alert.

During the design phase, I had two possibility to send ICMP packets: using PHP or using a third-party software. My choice was addressed to use a third-party software: Nmap. As a matter of fact, Nmap can send ICMP packets with high performance and save the result into an XML file.

Then the WhoisUP script read the XML file, shows the host status (up or down) in a web page and in case of fault, can trigger alert: popup notice, sound alarm, mail or syslog message.

The script is written in PHP and JQuery and it is supported on linux and windows machine. The requirements are:

  • WEB Server (Apache, ISS, …)
  • PHP 5 >= 5.1.0
  • NMAP

The installation is simple and require few steps:

  1. Unzip the files and place them on your webserver
  2. Set the ‘TMP’ and ‘conf’ folders to chmod 777 (on *nix systems) or to writable permission (on Windows systems)
  3. Set the files into ‘conf’ and ‘TMP’ folders to chmod 777 (on *nix systems) or to writable permission (on Windows systems)
  4. Go to the page htttp://[name-of-your-host]/whoisup/admin.php
  5. Login with the default key: ‘whoisup’
  6. Compile the fields and change the secret key
  7. Enable the core.php script in background. You have two ways to do it:
    1. Call the core.php script using the php command line with administrative/root privileges; for instance:
      php \[your-absolute-path]\whoisup\core.php [your-secret-key]
    2. Call the core.php using a browser (Explorer, Chrome, Firefox, …); for instance open the page:
      http://[name-of-your-host]/whoisup/core.php?secret=[your-key]
      This is the worst method, because the webserver must run with administrative/root privileges.

The installation is completed. To see the host status, go to the page http://[name-of-your-host]/whoisup/

 

Syntax format
The ‘EmailToField’ list must follow this syntax, for instance:
test@nospam.com
ciscozine@mydomain.com
whoisup@nospam.com

The IP address list must follow this format: [host-ip] # [host-name]
For instance:
192.168.1.1 # my-route
8.8.8.8 # google-dns
123.123.123.123 # test-host

 

Remember:

  • If you stop the core.php script, you don’t receive any alarms (mail or syslog message) and the index page (http://[name-of-your-host]/whoisup/) is not updated!
  • The index page (http://[name-of-your-host]/whoisup/) is only used to see the host status. It is not needed open the index page to receive alarms.

 

Screenshot

User page with popup notice disabled

User page with popup notice enabled

 

Admin page

 

The script is free and can be download here: http://whoisup.sourceforge.net/

2 COMMENTS

  1. many thanks for this piece of good work – is it possible to implement result customization (e.g. grouping by floor or room …)

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.