Skip to content

HalianElf/HealthChecks-Powershell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

HealthChecks Powershell

Codacy Badge made-with-powershell Beerpay

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 Auth, leveraging the API key to check the reverse proxies.

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 on those. Lastly, comment out any of the checks you don't need in the main function.

Once you have all of the checks configured as you need, you can run the script with the -DebugOn flag to make sure that all the responses are returning what's expected.

Please be warned that by default, Windows Policies are to block any and all scripts that are not made directly on your machine. If you are experiencing this, you can run it using Powershell.exe -ExecutionPolicy RemoteSigned -File .\application_healthchecks_generic.ps1 to do it just at runtime or use Set-ExecutionPolicy RemoteSigned from an Administrator Powershell window to set it permanently.

Scheduling

Now that you have it so that everything is working properly, you can use Task Scheduler to have it run automatically. When adding a new task, set the action to Start a program, choose Powershell.exe as the Program/script and use -ExecutionPolicy RemoteSigned -File C:\Path\To\Script\application_healthchecks_generic.ps1 in the arguments. (Note: if you set the Execution Policy permanently, you won't need the -ExecutionPolicy flag)

Pausing/Unpausing Checks

If you are doing some maintenenance, you can pause/unpause all checks using all or an individual check by name. Pausing is done with -pause or -p and unpausing is done with -unpause or -u

Examples:

Pause all checks: .\application_healthchecks_generic.ps1 -pause all

Unpause all checks: .\application_healthchecks_generic.ps1 -unpause all

Pause a specific check: .\application_healthchecks_generic.ps1 -p organizr

Unpause a specific check: .\application_healthchecks_generic.ps1 -u organizr

Discord alert for paused monitors

Using the -webhook or -w option will check for any paused monitors and, if there are any, send an alert to the specified Discord/Slack webhook like below:

Discord/Slack Notification Discord/Slack Notification

Thanks

Big thanks to christronyxyocum for creating the bash scripts that this is based off of.

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

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published