When Nagios detects that a service is down or degraded, you can automatically push that status into Alert24 so your Alert24 status page reflects the real state — without manually updating it. This uses Alert24's incoming webhook receiver.
Step 1: Create a webhook receiver in Alert24
- Go to Settings → Webhook Receivers → Add receiver
- Give it a name (e.g., "Nagios status updates")
- Link it to the Service you want to update (e.g., "API Gateway")
- Set Status field path to
current_state(the field in the webhook payload that carries the status) - Set Status mapping:
operational → OK, UP degraded → WARNING down → CRITICAL, DOWN, UNREACHABLE - Enable Auto-create incidents if you want Alert24 to open an incident automatically
- Save — Alert24 gives you an incoming webhook URL:
https://app.alert24.net/api/webhooks/incoming/YOUR_TOKEN
Step 2: Create the event handler script
Save to /usr/local/nagios/libexec/alert24_status.sh:
#!/bin/bash
# Update Alert24 service status from Nagios state changes
STATE="$1" # OK / WARNING / CRITICAL / UNKNOWN / UP / DOWN
STATE_TYPE="$2" # SOFT / HARD
SERVICE_DESC="$3"
HOST="$4"
WEBHOOK_URL="https://app.alert24.net/api/webhooks/incoming/YOUR_TOKEN"
# Only update on HARD state changes
if [ "$STATE_TYPE" != "HARD" ]; then
exit 0
fi
curl -s -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "{
\"current_state\": \"$STATE\",
\"host\": \"$HOST\",
\"service\": \"$SERVICE_DESC\",
\"source\": \"nagios\"
}"
Make it executable: chmod +x /usr/local/nagios/libexec/alert24_status.sh
Step 3: Wire up the event handler
In commands.cfg:
define command {
command_name alert24_status
command_line /usr/local/nagios/libexec/alert24_status.sh \
"$SERVICESTATE$" "$SERVICESTATETYPE$" \
"$SERVICEDESC$" "$HOSTNAME$"
}
In your service definition:
define service {
use generic-service
host_name web-prod-01
service_description HTTP Check
check_command check_http
event_handler alert24_status
event_handler_enabled 1
}
Tips
- HARD vs SOFT: Nagios retries checks several times before declaring a HARD state. Only update Alert24 on HARD changes to avoid flickering the status page during retries.
- Multiple services: Create one Alert24 webhook receiver per service and use separate event handlers for each, or use a single receiver and a smarter script that maps Nagios hostnames to Alert24 service IDs.
- Recovery: When Nagios sends
OKorUP, the status mapping sendsoperationalto Alert24 — your status page automatically shows green.