| 1 | #!/bin/sh |
| 2 | # |
| 3 | # This is the script that gets run for our Docker image health checks. |
| 4 | |
| 5 | if [ -z "${NETDATA_HEALTHCHECK_TARGET}" ] ; then |
| 6 | # If users didn't request something else, query `/api/v1/info`. |
| 7 | PORT=${NETDATA_LISTENER_PORT:-19999} |
| 8 | NETDATA_HEALTHCHECK_TARGET="http://localhost:${PORT}/api/v1/info" |
| 9 | fi |
| 10 | |
| 11 | case "${NETDATA_HEALTHCHECK_TARGET}" in |
| 12 | cli) |
| 13 | netdatacli ping || exit 1 |
| 14 | ;; |
| 15 | *) |
| 16 | curl -sSL "${NETDATA_HEALTHCHECK_TARGET}" || exit 1 |
| 17 | ;; |
| 18 | esac |