You can easily add Healthchecks.io monitoring to a shell script. All you have to do is make a HTTP request at the end of the script. curl and wget are two common command line HTTP clients you can use.
# Sending a HTTP GET request with curl: curl --retry 3 https://hc-ping.com/your-uuid-here # Silent version (no stdout/stderr output unless curl hits an error): curl -fsS --retry 3 https://hc-ping.com/your-uuid-here # Sending a HTTP GET request with wget: wget https://hc-ping.com/your-uuid-here -O /dev/null
You can append
/fail to any ping URL and use the resulting URL to actively
signal a failure. The below example:
#!/bin/sh # Payload here: /usr/bin/certbot renew # Ping Healthchecks.io curl --retry 3 "https://hc-ping.com/your-uuid-here$([ $? -ne 0 ] && echo -n /fail)"
When pinging with HTTP POST, you can put extra diagnostic information in request body. If the request body looks like a valid UTF-8 string, Healthchecks.io will accept and store first 10KB of the request body.
In the below example, certbot's output is captured and submitted via HTTP POST:
#!/bin/sh m=$(/usr/bin/certbot renew 2>&1) curl -fsS --retry 3 -X POST --data-raw "$m" https://hc-ping.com/your-uuid-here