Monitoring
Nagios / Icinga Integration
Überblick
Das Plugin check_seconddns.sh fragt die SecondDNS Health-API ab und gibt Standard-Nagios-Exit-Codes zurück (0 = OK, 1 = WARNING, 2 = CRITICAL, 3 = UNKNOWN) mit Perfdata.
Voraussetzungen
- Nagios, Icinga oder kompatibles Monitoring-System
- curl auf dem Monitoring-Server installiert
- Ein SecondDNS API-Key (Dashboard → API Key)
1. Plugin herunterladen
curl -o /usr/lib/nagios/plugins/check_seconddns.sh \
https://raw.githubusercontent.com/seconddns/dns_integrations/main/nagios_plugins/check_seconddns.sh
chmod +x /usr/lib/nagios/plugins/check_seconddns.shQuelle: github.com/seconddns/dns_integrations/nagios_plugins
2. Befehl definieren
Fügen Sie dies zur Nagios-Befehlskonfiguration hinzu (z.B. /etc/nagios/objects/commands.cfg):
define command {
command_name check_seconddns
command_line /usr/lib/nagios/plugins/check_seconddns.sh -k $ARG1$ $ARG2$
}3. Service definieren
Alle Zonen auf einmal prüfen:
define service {
host_name your-dns-host
service_description SecondDNS Zone Health
check_command check_seconddns!your-api-key-here!
check_interval 15
retry_interval 5
max_check_attempts 3
notification_interval 60
}Oder eine einzelne Zone prüfen:
define service {
host_name your-dns-host
service_description SecondDNS: example.com
check_command check_seconddns!your-api-key-here!-z example.com
check_interval 15
...
}4. Ausgabebeispiele
# All zones healthy: OK - all 12 zones synced # Problems detected: WARNING - example.com stale 135min master=2024041503 ours=2024041501 | stale_min=135;120;360 CRITICAL - broken.net master_unreachable since 2026-04-16T13:00:00Z | stale_min=390;120;360
So funktioniert es
- Plugin ruft GET /api/health/zones?format=nagios auf (oder /api/health/zones/ZONE?format=nagios)
- API gibt Text zurück — eine Zeile pro Problem-Zone, oder "OK" wenn alle synchronisiert
- Plugin parst das erste Wort (OK/WARNING/CRITICAL) und setzt den Exit-Code
- Nagios übernimmt Exit-Code und Perfdata für Benachrichtigungen und Graphen