Skip to content

Script to test various application reverse proxies, as well as their internal pages, and report to their respective Healthchecks.io checks

License

Notifications You must be signed in to change notification settings

tronyx/HealthChecks-Linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HealthChecks Linux

CodeFactor made-with-bash GitHub Average time to resolve an issue Percentage of issues still open

Script to test various application reverse proxies, as well as their internal pages, and report to their respective Healthchecks.io checks. This is meant to work with Organizr Authentication, leveraging the Organizr API key to check the reverse proxies.

If you are not using Organizr, which you totally should be if you're not, you can remove the following from the external URL for any checks you want to use:

 -H "token: ${orgAPIKey}"

Mind the space that is at the beginning of the line too.

Setting it up

There are variables at the top that are used throughout the script to do the tests. You'll want to fill in your domain, Organizr API key, and server IP(s). If you are self-hosting Healthchecks, you can change the hcPingDomain variable. You'll also need to go to each of the check_application functions and edit the UUID for the Healthcheck and the ports and/or subdomains or subdirectories on those. Lastly, uncomment (remove the # from the beginning of the line) the checks that you wish to run in the main function at the bottom of the script.

Once you have all of the checks configured as you need, you can run the script with bash -x application_healthchecks_generic.sh to make sure that all the responses are returning what's expected, an HTTP response code of 200.

If you do not have reverse proxies (external access) setup for your applications, you can simply set the external response variable to 200 so that will always pass:

extResponse='200'

⚠️ NOTE: You may need to tweak some of the URLs that are being used to check the applications depending on your setup and you might be using a subfolder configuration where I'm using a subdomain or vice versa. Point is, this won't work 100% for everyone, so you might need to do some trial and error to get everything working.

Scheduling

Now that you have it configured so that everything is working properly, you can use a cronjob to schedule the script to run automatically and perform the checks.

Here's an example of running the script every two minutes:

## Run application healthchecks script for Healthchecks.io
*/2 * * * * /home/tronyx/scripts/application_healthchecks.sh

My HC.io checks are setup with a two minute period and a three minute grace. You can adjust all of that according to your needs.

Tronitor

This script partners up with my Tronitor script that allows you to pause and unpause your monitors manually or via a cronjob for scheduled maintenance, etc. If you wish to use this script with Tronitor you will need to uncomment the Tronitor temp directory line and then comment out or remove the original one.

Thanks

Big thanks to HalianElf for creating the Powershell version of the script for Windows users.

Questions

If you have any questions, you can find me on the Organizr Discord.

About

Script to test various application reverse proxies, as well as their internal pages, and report to their respective Healthchecks.io checks

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages