Tronitor
Bash script to work with UptimeRobot, StatusCake, HealthChecks.io, & Upptime monitoring providers
Install / Use
/learn @tronyx/TronitorREADME
Tronitor
A bash script to work with UptimeRobot, StatusCake, HealthChecks.io, and Upptime monitors via their respective APIs. It checks to make sure that the API key/token, username for StatusCake, and your GitHub username and the name of your Upptime repository on GitHub, that you provided are valid before performing any requested operations.
Contributors
Big thanks to nemchik for all the ideas and help with getting some things to work, and to 1activegeek for asking me to create this for him in the first place, albeit MUCH less complicated than what it's become.
Feel free to check out their work and buy them a beer too!
Application Healthchecks
This script partners up with my Application Healthchecks script that provides checks for a lot of popular HTPC applications, IE: Plex, Sonarr, Radarr, etc. that work with HealthChecks.io. Tronitor would allow you to pause and unpause the checks manually or on a schedule, via a cronjob, for planned maintenance, etc. This essentially allows you to create your own maintenance windows without having to pay for a premium account with either of the providers.
Package Requirements/Recommendations
cURL
The cURL command is required for the script to function as it's used to submit API calls to the providers. If it is not installed before you execute the script most, if not all, operations will fail. Because of this, the script does check whether or not cURL is installed and, if not, it will inform you as such and then exit.
JQ
The jq command is required for the script to function as it is used to more easily extract data from JSON files created by the script when gathering information for the monitoring providers and the corresponding checks/tests.
It is also used by the script to automatically format the JSON output into a human-readable and colorized output. There is a variable at the beginning of the script to set the use of the jq command (strictly for displaying the output of the script) to true or false. I've personally encountered some issues with it when using the script within a cronjob and not using jq to format the output resolves them. It is set to true by default.
# Set JQ to false to disable its use for displaying output.
# This works better for using the script with cronjobs, etc.
jq='true'
Installing JQ on Ubuntu Server 18.04:
tronyx@suladan:~$ sudo apt install jq
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
jq
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 45.6 kB of archives.
After this operation, 90.1 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 jq amd64 1.5+dfsg-2 [45.6 kB]
Fetched 45.6 kB in 0s (123 kB/s)
Selecting previously unselected package jq.
(Reading database ... 107503 files and directories currently installed.)
Preparing to unpack .../jq_1.5+dfsg-2_amd64.deb ...
Unpacking jq (1.5+dfsg-2) ...
Setting up jq (1.5+dfsg-2) ...
Processing triggers for man-db (2.8.3-2) ...
Sample output using JQ:

Sample output without JQ:

Setting it up
The best method to get the script working is to use git to clone the repository onto your preferred machine:
tronyx@suladan:~$ git clone https://github.com/tronyx/tronitor.git
Cloning into 'tronitor'...
remote: Enumerating objects: 108, done.
remote: Counting objects: 100% (108/108), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 262 (delta 60), reused 76 (delta 32), pack-reused 154
Receiving objects: 100% (262/262), 161.85 KiB | 6.74 MiB/s, done.
Resolving deltas: 100% (143/143), done.
:warning: NOTE: You CAN get away with just grabbing a copy of the tronitor.sh script itself, but the monitor creation functionality will not work as it depends on the included template files in the repository.
The script stores the API keys/token, username for StatusCake, and, for Upptime, your GitHub username, PAT (Personal Access Token), and the name of your Upptime reposistory, for up to all four providers so that you do not need multiple copies of the script to work with each of the different providers.
If you do not know how to create a PAT for your GitHub account, you can checkout their documentation on it HERE.
The first time that you run the script for a specific monitor it will alert you that the API key/token, etc. are missing and prompt you to input them:
UptimeRobot

StatusCake

Healthchecks.io

:warning: NOTE: If you are running your own, self-hosted version of the Healthchecks.io application, you will need to modify the healthchecksDomain variable on line 24 of the tronitor.sh script with the domain name that you're hosting the application with.
Upptime

You can also simply open the script with your favorite text editor and add your provider's API key, if you're using StatusCake, your account username, and, if you're using Upptime, the repository owner (organization or user), your GitHub username, PAT (Personal Access Token), and the name of your Upptime reposistory.
After entering the information, the script will check whether or not it is valid and then add it to the script for you.
If you use the alert option, be sure to also enter in your Discord/Slack webhook URL. If you forget this as well, the script will also prompt you to enter it:

Usage

The -m/--monitor option accepts both full and shorthand versions of the provider's name:
tronyx@suladan:~/tronitor$ ./tronitor.sh -m uptimerobot -l
tronyx@suladan:~/tronitor$ ./tronitor.sh -m ur -l
tronyx@suladan:~/tronitor$ ./tronitor.sh -m statuscake -l
tronyx@suladan:~/tronitor$ ./tronitor.sh -m sc -l
tronyx@suladan:~/tronitor$ ./tronitor.sh -m healthchecks -l
tronyx@suladan:~/tronitor$ ./tronitor.sh -m hc -l
tronyx@suladan:~/tronitor$ ./tronitor.sh -m upptime -l
tronyx@suladan:~/tronitor$ ./tronitor.sh -m up -l
Examples
Get account statistics
Display basic statistics for your account:
tronyx@suladan:~/tronitor$ ./tronitor.sh -m uptimerobot -s
Here are the basic statistics for your UptimeRobot account:
{
"stat": "ok",
"account": {
"email": "me@domain.com",
"monitor_limit": 50,
"monitor_interval": 5,
"up_monitors": 14,
"down_monitors": 0,
"paused_monitors": 0
}
}
List all monitors
Display all monitors associated with your account and their current statuses:
tronyx@suladan:~/tronitor$ ./tronitor.sh --monitor ur -l
The following UptimeRobot monitors were found in your UptimeRobot account:
Plex (ID: 779783111) - Status: Up
Radarr (ID: 780859973) - Status: Down
Sonarr (ID: 780859962) - Status: Paused
Tautulli (ID: 780859975) - Status: Seems down
Find currently paused monitors
Find and display all monitors in your account that are currently paused and then prompt you as to whether or not you would like to unpause them:
tronyx@suladan:~/tronitor$ ./tronitor.sh -m ur -f
The following StatusCake monitors are currently paused:
Plex (ID: 779783111)
Radarr (ID: 780859973)
Sonarr (ID: 780859962)
Tautulli (ID: 780859975)
Would you like to unpause the paused monitors? ([Y]es or [N]o):
You can also use the -n option to display the same list, but not display a prompt to unpause the paused monitors.
Discord alert for paused monitors
Using the -w option will check for any paused monitors and, if there are any, send an alert to the specified Discord/Slack webhook like below:

If you set the notifyAll option to true, Tronitor will send a notification even if there are no paused monitors:

Info
Display all information for a single monitor:
tronyx@suladan:~/tronitor$ ./tronitor.sh -m uptimerobot -i 'plex'
{
"stat": "ok",
"pagination": {
"offset": 0,
"limit": 50,
"total": 1
},
"monitors": [
{
"id": 779783111,
"friendly_name": "Plex",
"url": "https://plex.tv",
"type": 1,
"sub_type
Related Skills
tmux
351.8kRemote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
diffs
351.8kUse the diffs tool to produce real, shareable diffs (viewer URL, file artifact, or both) instead of manual edit summaries.
terraform-provider-genesyscloud
Terraform Provider Genesyscloud
blogwatcher
351.8kMonitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.
