CLI tool which checks a list of endpoints to see what's up and down, and reports the results to Microsoft Teams channels.
First, create a file named config.json with the following structure:
{
"teamsWebhookUrlSuccess": "your_success_url",
"teamsWebhookUrlFailure": "your_failure_url",
"endpoints": ["amazon.com", "google.com", "127.0.0.1"],
"tries": 3
}
Next, make two Microsoft Teams channels for successes and failures and enable incoming webhooks (described here). Copy the webhook URL's to your config.json file.
When the tool runs, it will use the operating system's built in ping
command (Linux, Mac, or Windows) to check if each endpoint is up or down. tries is the number of ping attempts per endpoint and all ping attempts must be successful for the endpoint to be considered up (so if you have tries set to 3, and 2 pings to an endpoint succeed but the third fails, the endpoint is considered down). The status of the endpoint checks is sent to Microsoft Teams via the success or failure webhooks depending if all endpoints were up or not.
The common use case is to have this tool run on a scheduled interval, so by using two channels you can mute the success channel and just have notifications active for the failure channel. This way you can check the success channel occasionally to make sure the tool is running, but only get actively notified if an endpoint is down.
Once your config.json is set up, simply move it next to the whatsup
executable and run the tool for a one-off endpoints check. Setup cron, task scheduler, etc. for recurring checks.
~/work > ls
config.json whatsup
~/work > ./whatsup
All 3 endpoints are up.
Checked 3 endpoints.