{"id":13552122,"url":"https://github.com/tronyx/tronitor","last_synced_at":"2025-04-03T03:30:48.122Z","repository":{"id":46701963,"uuid":"149651184","full_name":"tronyx/tronitor","owner":"tronyx","description":"Bash script to work with UptimeRobot, StatusCake,  HealthChecks.io, \u0026 Upptime monitoring providers","archived":false,"fork":false,"pushed_at":"2022-09-08T21:06:17.000Z","size":2659,"stargazers_count":51,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-12T13:23:19.603Z","etag":null,"topics":["application-healthchecks","health-checks","health-checks-api","healthchecks","healthchecks-api","healthchecksapi","healthchecksio","monitor","monitors","specific-monitors","status-cake","statuscake","statuscake-api","statuscake-monitors","statuscakeapi","uptime-robot","uptimerobot","uptimerobot-api","uptimerobot-monitors","uptimerobotapi"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tronyx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"tronyx","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-09-20T18:13:33.000Z","updated_at":"2024-04-22T02:12:26.000Z","dependencies_parsed_at":"2023-01-18T01:30:58.444Z","dependency_job_id":null,"html_url":"https://github.com/tronyx/tronitor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tronyx%2Ftronitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tronyx%2Ftronitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tronyx%2Ftronitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tronyx%2Ftronitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tronyx","download_url":"https://codeload.github.com/tronyx/tronitor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213520307,"owners_count":15599594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["application-healthchecks","health-checks","health-checks-api","healthchecks","healthchecks-api","healthchecksapi","healthchecksio","monitor","monitors","specific-monitors","status-cake","statuscake","statuscake-api","statuscake-monitors","statuscakeapi","uptime-robot","uptimerobot","uptimerobot-api","uptimerobot-monitors","uptimerobotapi"],"created_at":"2024-08-01T12:01:59.241Z","updated_at":"2024-08-01T12:12:21.378Z","avatar_url":"https://github.com/tronyx.png","language":"Shell","funding_links":["https://github.com/sponsors/tronyx"],"categories":["Shell"],"sub_categories":[],"readme":"# Tronitor\n\n[![CodeFactor](https://www.codefactor.io/repository/github/tronyx/tronitor/badge)](https://www.codefactor.io/repository/github/tronyx/tronitor) [![Travis (.com) branch](https://img.shields.io/travis/rust-lang/rust/master.svg?logo=travis)](https://app.travis-ci.com/tronyx/tronitor) [![made-with-bash](https://img.shields.io/badge/Made%20with-Bash-1f425f.svg)](https://www.gnu.org/software/bash/) [![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/tronyx/tronitor/blob/develop/LICENSE.md) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/tronyx/tronitor.svg)](http://isitmaintained.com/project/tronyx/tronitor \"Average time to resolve an issue\") [![Percentage of issues still open](http://isitmaintained.com/badge/open/tronyx/tronitor.svg)](http://isitmaintained.com/project/tronyx/tronitor \"Percentage of issues still open\")\n\nA bash script to work with [UptimeRobot](https://uptimerobot.com), [StatusCake](https://www.statuscake.com), [HealthChecks.io](https://healthchecks.io), and [Upptime](https://upptime.js.org/) 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.\n\n## Contributors\n\n[![GitHub contributors](https://img.shields.io/github/contributors/tronyx/tronitor.svg)](https://github.com/tronyx/tronitor/graphs/contributors/)\n\nBig thanks to [nemchik](https://github.com/GhostWriters/DockSTARTer/commits?author=nemchik) for all the ideas and help with getting some things to work, and to [1activegeek](https://github.com/1activegeek) for asking me to create this for him in the first place, albeit MUCH less complicated than what it's become.\n\nFeel free to check out their work and buy them a beer too!\n\n## Application Healthchecks\n\nThis script partners up with my [Application Healthchecks](https://github.com/tronyx/HealthChecks-Linux) 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.\n\n## Package Requirements/Recommendations\n\n### cURL\n\nThe `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.\n\n### JQ\n\nThe `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.\n\nIt 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.\n\n```bash\n# Set JQ to false to disable its use for displaying output.\n# This works better for using the script with cronjobs, etc.\njq='true'\n```\n\n#### Installing JQ on Ubuntu Server 18.04:\n\n```bash\ntronyx@suladan:~$ sudo apt install jq\nReading package lists... Done\nBuilding dependency tree\nReading state information... Done\nThe following NEW packages will be installed:\n  jq\n0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.\nNeed to get 45.6 kB of archives.\nAfter this operation, 90.1 kB of additional disk space will be used.\nGet:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 jq amd64 1.5+dfsg-2 [45.6 kB]\nFetched 45.6 kB in 0s (123 kB/s)\nSelecting previously unselected package jq.\n(Reading database ... 107503 files and directories currently installed.)\nPreparing to unpack .../jq_1.5+dfsg-2_amd64.deb ...\nUnpacking jq (1.5+dfsg-2) ...\nSetting up jq (1.5+dfsg-2) ...\nProcessing triggers for man-db (2.8.3-2) ...\n```\n\n#### Sample output using JQ:\n\n![JQ True](/Images/jq_sample.png)\n\n#### Sample output without JQ:\n\n![JQ False](/Images/no_jq_sample.png)\n\n## Setting it up\n\nThe best method to get the script working is to use `git` to clone the repository onto your preferred machine:\n\n```bash\ntronyx@suladan:~$ git clone https://github.com/tronyx/tronitor.git\nCloning into 'tronitor'...\nremote: Enumerating objects: 108, done.\nremote: Counting objects: 100% (108/108), done.\nremote: Compressing objects: 100% (75/75), done.\nremote: Total 262 (delta 60), reused 76 (delta 32), pack-reused 154\nReceiving objects: 100% (262/262), 161.85 KiB | 6.74 MiB/s, done.\nResolving deltas: 100% (143/143), done.\n```\n\n: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.\n\nThe 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.\n\nIf you do not know how to create a PAT for your GitHub account, you can checkout their documentation on it [HERE](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token).\n\nThe 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:\n\n### UptimeRobot\n![UptimeRobot User Data Prompt](/Images/ur_user_data.png)\n\n### StatusCake\n![StatusCake User Data Prompt](/Images/sc_user_data.png)\n\n### Healthchecks.io\n![Healthchecks User Data Prompt](/Images/hc_user_data.png)\n\n: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.\n\n### Upptime\n![Upptime/GitHub User Data Prompt](/Images/up_user_data.png)\n\nYou 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.\n\nAfter entering the information, the script will check whether or not it is valid and then add it to the script for you.\n\nIf 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:\n\n![Webhook URL Prompt](/Images/webhook_url.png)\n\n## Usage\n\n![Script Usage](/Images/usage.png)\n\nThe `-m/--monitor` option accepts both full and shorthand versions of the provider's name:\n\n```bash\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m uptimerobot -l\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m ur -l\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m statuscake -l\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m sc -l\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m healthchecks -l\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m hc -l\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m upptime -l\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m up -l\n```\n\n## Examples\n### Get account statistics\n\nDisplay basic statistics for your account:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m uptimerobot -s\nHere are the basic statistics for your UptimeRobot account:\n\n{\n \"stat\": \"ok\",\n \"account\": {\n   \"email\": \"me@domain.com\",\n   \"monitor_limit\": 50,\n   \"monitor_interval\": 5,\n   \"up_monitors\": 14,\n   \"down_monitors\": 0,\n   \"paused_monitors\": 0\n }\n}\n```\n\n### List all monitors\n\nDisplay all monitors associated with your account and their current statuses:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh --monitor ur -l\nThe following UptimeRobot monitors were found in your UptimeRobot account:\n\nPlex (ID: 779783111) - Status: Up\nRadarr (ID: 780859973) - Status: Down\nSonarr (ID: 780859962) - Status: Paused\nTautulli (ID: 780859975) - Status: Seems down\n```\n\n### Find currently paused monitors\n\nFind 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:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m ur -f\nThe following StatusCake monitors are currently paused:\n\nPlex (ID: 779783111)\nRadarr (ID: 780859973)\nSonarr (ID: 780859962)\nTautulli (ID: 780859975)\n\nWould you like to unpause the paused monitors? ([Y]es or [N]o):\n```\n\nYou can also use the `-n` option to display the same list, but not display a prompt to unpause the paused monitors.\n\n### Discord alert for paused monitors\n\nUsing 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:\n\n![Discord/Slack Notification](/Images/webhook_paused.png)\n\nIf you set the `notifyAll` option to `true`, Tronitor will send a notification even if there are no paused monitors:\n\n![Discord/Slack Notification](/Images/webhook_notifyAll.png)\n\n### Info\n\nDisplay all information for a single monitor:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m uptimerobot -i 'plex'\n{\n  \"stat\": \"ok\",\n  \"pagination\": {\n    \"offset\": 0,\n    \"limit\": 50,\n    \"total\": 1\n  },\n  \"monitors\": [\n    {\n      \"id\": 779783111,\n      \"friendly_name\": \"Plex\",\n      \"url\": \"https://plex.tv\",\n      \"type\": 1,\n      \"sub_type\": \"\",\n      \"keyword_type\": null,\n      \"keyword_value\": \"\",\n      \"http_username\": \"\",\n      \"http_password\": \"\",\n      \"port\": \"\",\n      \"interval\": 300,\n      \"status\": 2,\n      \"create_datetime\": 1513815865\n    }\n  ]\n}\n```\n\n### Get alert contacts\n\nDisplays a list of all of the alert contacts configured for the account:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m ur -a\nThe following alert contacts have been found for your UptimeRobot account:\n\n{\n  \"stat\": \"ok\",\n  \"offset\": 0,\n  \"limit\": 50,\n  \"total\": 2,\n  \"alert_contacts\": [\n    {\n      \"id\": \"0526944\",\n      \"friendly_name\": \"E-Mail\",\n      \"type\": 2,\n      \"status\": 2,\n      \"value\": \"me@domain.com\"\n    },\n    {\n      \"id\": \"2611518\",\n      \"friendly_name\": \"Discord\",\n      \"type\": 11,\n      \"status\": 2,\n      \"value\": \"https://discordapp.com/api/webhooks/123456789/qwerty-qwerty-qwerty/slack\"\n    }\n  ]\n}\n```\n\nThis can be helpful when creating a new monitor as you can use the `id` field of the alert contact to specify the alert contact that you want to be notified when an event occurs with the new monitor that you're creating.\n\n### Pause all monitors\n\nPause all monitors in your account:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m uptimerobot -p all\nPausing Plex:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 779783111\n  }\n}\n\nPausing Radarr:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 780859973\n  }\n}\n\nPausing Sonarr:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 780859962\n  }\n}\n\nPausing Tautulli:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 780859975\n  }\n}\n```\n\n:warning: **NOTE:** Healthchecks.io works with cronjobs so, unless you disable your cronjobs for the HC.io monitors, or work with the created lock file, all paused monitors will become active again the next time they receive a ping. Tronitor creates a lock file, `/tmp/tronitor/healthchecks.lock`, so that you can modify your existing HC.io script to check for the lock file and not send pings if it is present.\n\n\n### Pause specific monitors\n\nPause specific monitors in your account:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh --monitor ur -p 'Plex',780859973\nPausing Plex:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 779783111\n  }\n}\n\nPausing Radarr:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 780859973\n  }\n}\n```\n\n:warning: **NOTE:** Healthchecks.io works with cronjobs so, unless you disable your cronjobs for the HC.io monitors, or work with the created lock file, all paused monitors will become active again the next time they receive a ping. Tronitor creates a lock file, `/tmp/tronitor/MONITOR-UUID.lock`, so that you can modify your existing HC.io script to check for the lock file and not send pings if it is present.\n\n### Unpause all currently paused monitors\n\nUnpause all monitors in your account:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m ur -u all\nUnpausing Plex:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 779783111\n  }\n}\n\nUnpausing Radarr:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 780859973\n  }\n}\n\nUnpausing Sonarr:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 780859962\n  }\n}\n\nUnpausing Tautulli:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 780859975\n  }\n}\n```\n\n### Unpause specific monitors\n\nUnpause specific monitors that are currently paused in your account:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m ur -u 'Plex',780859973\nUnpausing Plex:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 779783111\n  }\n}\n\nUnpausing Radarr:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 780859973\n  }\n}\n```\n\n### Create a new monitor\n\nMonitors can be created using this option.\n\n:warning: **NOTE:** StatusCake's API is dumb and WILL let you create more tests than you're supposed to have with the limit for your account and it can cause some very odd behavior with the monitors.\n\nModify the settings of the corresponding monitor type template file in the corresponding `Templates` directory for your provider, IE: creating a new HTTP(s) monitor for UptimeRobot would require you to modify the `Templates/UptimeRobot/new-http-monitor.json` file. The full API documentation for the two providers can be found [HERE (UR)](https://uptimerobot.com/api), [HERE (SC)](https://www.statuscake.com/api/index.md), and [HERE (HC)](https://healthchecks.io/docs/api/) for information on monitor types and any required values and what they're for.\n\nThe following example is for creating a new HTTP(s) monitor for Google:\n\n```json\ntronyx@suladan:~/tronitor$ cat Templates/UptimeRobot/new-http-monitor.json\n{\n      \"api_key\": \"\",\n      \"friendly_name\": \"Google\",\n      \"url\": \"https://google.com\",\n      \"type\": 1,\n      \"http_username\": \"\",\n      \"http_password\": \"\",\n      \"interval\": 300,\n      \"alert_contacts\": \"\",\n      \"ignore_ssl_errors\": \"false\",\n      \"format\": \"json\"\n}\n```\n\nThe `api_key` field is filled in automatically by the script, but you can still add it yourself if you'd like to. The `alert_contacts` field can be filled in with the `id` field from your preferred alert contact which you can retrieve using the `-a/--alerts` option with the script.\n\nThen just execute the script to create the monitor:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh --monitor uptimerobot -c http\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 781067574,\n    \"status\": 1\n  }\n}\n```\n\n### Resetting monitors\n\nReset (deleting all stats and response time data) all or specific monitors in your account:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m ur -r google\n\n***WARNING*** This will reset ALL data for the specified monitors!!!\nAre you sure you wish to continue? ([Y]es or [N]o):\ny\n\nResetting Google:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 781067574\n  }\n}\n```\n\n### Deleting monitors\n\nDelete all, or a specific, monitor from your account:\n\n```json\ntronyx@suladan:~/tronitor$ ./tronitor.sh -m ur -d plex\n\n***WARNING*** This will delete the specified monitor from your account!!!\nAre you sure you wish to continue? ([Y]es or [N]o):\ny\n\nDeleting Plex:\n{\n  \"stat\": \"ok\",\n  \"monitor\": {\n    \"id\": 781067560\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftronyx%2Ftronitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftronyx%2Ftronitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftronyx%2Ftronitor/lists"}