health.sh 493 B

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