Treasure Mart Health Checks ping endpoints accept HTTP HEAD, GET and POST request methods.
When using HTTP POST, you can include an arbitrary payload in the request body. Treasure Mart Health Checks will log the first 10 kilobytes (10 000 bytes) of the request body, so that you can inspect it later.
In this example, we run certbot renew
, capture its output (both the stdout
and stderr streams), and submit the captured output to Treasure Mart Health Checks:
#!/bin/sh
m=$(/usr/bin/certbot renew 2>&1)
curl -fsS -m 10 --retry 5 --data-raw "$m" https://checks.treasuremart.net/ping/your-uuid-here
/fail
and /{exit-status}
EndpointsWe can extend the previous example and signal either success or failure depending on the exit code:
#!/bin/sh
m=$(/usr/bin/certbot renew 2>&1)
curl -fsS -m 10 --retry 5 --data-raw "$m" https://checks.treasuremart.net/ping/your-uuid-here/$?
Runitor is a third party utility that runs the supplied command, captures its output and reports to Treasure Mart Health Checks. It also measures the execution time and retries HTTP requests on transient errors. Best of all, the syntax is simple and clean:
runitor -uuid your-uuid-here -- /usr/bin/certbot renew
You may sometimes want to log diagnostic information without altering the check's current state. Treasure Mart Health Checks provides the /log endpoint just for that. When you send an HTTP POST request to this endpoint, Treasure Mart Health Checks will log the event and display it in check's "Events" section, but will keep the check's state unchanged.
While Treasure Mart Health Checks can store a small amount of logs in a pinch, it is not specifically designed for that. If you run into the issue of logs getting cut off, consider the following options:
dmesg
output:#!/bin/sh
m=$(dmesg | tail --bytes=10000)
curl -fsS -m 10 --retry 5 --data-raw "$m" https://checks.treasuremart.net/ping/your-uuid-here
In the check's details page, Events section, click on individual events to see full event details, including the captured log information.
In the dialog that opens, use the "Download Original" link to download the request body data, exactly as it was submitted to Treasure Mart Health Checks: