Today I’m going to present you a simple script that uses the UptimeRobot APIs; UptimeRobot is an awesome service that, for free, allows you to check the uptime of your servers (max 50) with a check based on a webpage or an open listening port on the server with a minimum delay between the checks of 5 minutes (or higher). It also supports webhooks, basically when one of your server goes offline UptimeRobot makes a call to url. I use this feature to send an SMS to my telephone using a paid SMS Gateway (unsupported by UptimeRobot). For more infomation visit their website: UptimeRobot.com
Anyway, I created this script to present some statistics on the servers monitored such as the uptime in the last days, the response time during the last 24 hours and more important than everything else the current status of the server (Online or not).
The script is configurable, you can:
- select which server to add: UptimeRobots supports two types of API keys, a private one that allows access to all the monitors inside your account and a public key that allows access to the statistics of a specific monitor; it’s up to you to choose which key to use, but keep in mind that you can’t add the same monitor two times;
- choose if you want to see the response time of the last 24 hours and how precisely you want to see it, take in mind that by enabling this feature the loading time of the page will be higher (no problems with 4-5 monitors); the precision is indicated in minutes, for example 30 minutes mean that in the graph there will be the response time every 30 minutes, I prefer 120 minutes to avoid spikes in the graph;
- regarding the uptime statistics, select the period used to calculate the uptime ratio, by default is last day, last week and last month: 1, 7 and 30 days; you can add other values such as ‘1-7-30-60’.
You can see the script in action here Status page. As you can see the script is fully responsive, if it works in every browser at every resolution 😛
I left some comments in the script so you should be able to customize it (like I did to add the munin graphs and Laura Bodewig, the anime girl in the background).
Now to the download links, remember to edit the config file. Feel free to contact me if anything goes wrong.
I also used these awesome libraries: