HealthChecks.io
Create a new check
Bash script
Configure CRON
Integrations
Last updated
Last updated
sudo vim /etc/default/healthchecks.sh#!/bin/bash
# Healthchecks.io URL
# ***********
# CHANGE HERE
# ↓↓↓↓↓↓↓↓↓↓↓
healthchecks_io_url="https://hc-ping.com/<UNIQUE_ID>"
# URLs for the health endpoints of Prometheus and Alertmanager
prometheus_health_url="http://localhost:9090/-/healthy"
alertmanager_health_url="http://localhost:9093/-/healthy"
# Check health of Prometheus
if curl -f ${prometheus_health_url}; then
# Check health of Alertmanager
if curl -f ${alertmanager_health_url}; then
# Send heartbeat to Healthchecks.io
curl -fsS --retry 3 ${healthchecks_io_url} > /dev/null
else
echo "Alertmanager is not healthy."
fi
else
echo "Prometheus is not healthy."
fisudo chmod u+x /etc/default/healthchecks.shsudo crontab -e* * * * * /etc/default/healthchecks.sh