KrisChase.com

Easily monitor uptime on WHM & cPanel Server with UptimeRobot

Posted in Web Development on 06.10.2015 by @chasebadkids

It’s all about UptimeRobot

When managing multiple WHM servers with hundreds of cPanel accounts, sometimes you need a quick and easy way to monitor your sites uptime. many of you may be aware of the service Uptime Robot. If not, then you should definitely check it out. Uptime Robot is a service which allows you to freely monitor the uptime and receive alerts for up to 50 domains. You can receive slack messages, emails, pushbullet notifications and more.

API to the Rescue

Adding entries into WHM isn’t all that difficult, however when managing sites using WHM and cPanel across multiple servers, adding and removing your entries can be time consuming. Thankfully that’s where the API comes into play.

Bil Bas created an UptimeRobot client in python that allows us to easily interface with the UptimeRobot API.

Setting up the UptimeRobot Client

Install the required python packages

Debian, Ubuntu and other Debian-based distributions

 apt-get install python-pip python-yaml python-argparse

Or

yum install python-pip python-yaml python-argparse

Download and unpack the source code.

wget https://github.com/uptimerobot/cli/archive/master.zip
unzip master.zip

Create a package from source and install

cd uptimerobot-cli-master/
python build.py release
pip install dist/uptimerobot-*.tar.gz

Modify your default config file

Using defaults
It is annoying to have to add the api key to every single uptimerobot command line. Therefore it is possible to store it into a defaults file.
Copy the file cli-master/uptimerobot/.uptimerobot.yml to your home directory and edit it accordingly. It is also possible to copy it to the current directory. uptimerobot will look in the current directory first, then in the users’s home directory. A command line setting will always override the default settings.

Now you’re all installed. Here’s the fun part

Getting your monitors created

Drop the bash script below onto your server and

Simply execute the script and all domains from your system will be added into uptime robot!

Menu