VCU TS Healthchecks ping endpoints accept HTTP HEAD, GET and POST request methods.
When using HTTP POST, you can include arbitrary payload in the request body. If the request body looks like a UTF-8 string, VCU TS Healthchecks will log the first 10 kilobytes of the request body, so you can inspect it later.
In this example, we run certbot renew
, capture its output, and submit
the captured output to VCU TS Healthchecks:
#!/bin/sh
m=$(/usr/bin/certbot renew 2>&1)
curl -fsS --retry 3 -X POST --data-raw "$m" https://healthcheck.ts.vcu.edu/ping/your-uuid-here
/fail
EndpointWe can extend the previous example and signal either success or failure depending on the exit code:
#!/bin/sh
url=https://healthcheck.ts.vcu.edu/ping/your-uuid-here
m=$(/usr/bin/certbot renew 2>&1)
if [ $? -ne 0 ]; then url=$url/fail; fi
curl -fsS --retry 3 -X POST --data-raw "$m" $url
Finally, all of the above can be packaged in a single line. The one-line version can be put directly in crontab, without using a wrapper script.
m=$(/usr/bin/certbot renew 2>&1); curl -fsS -X POST --data-raw "$m" "https://healthcheck.ts.vcu.edu/ping/your-uuid-here$([ $? -ne 0 ] && echo -n /fail)"