Dies ist eine alte Version des Dokuments!
Docker Compose Icinga stack
Quelle: https://github.com/lippserd/docker-compose-icinga
Stack nach Anleitung von Github herunterladen und im Verzeichnis folgende Änderungen vornehmen:
- Eingebaute Host-Konfiguration entfernen (wird dann im Director konfiguriert)
 Datei /etc/icinga2/conf.d/hosts.conf löschen lassen
 in Dateiinit-icinga2.shunten einfügenif [ -f /data/etc/icinga2/conf.d/hosts.conf ]; then rm -F /data/etc/icinga2/conf.d/hosts.conf fi
- Passwort von „icingaadmin“ ändern
 in Dateidocker-compose.ymldie Zeileicingaweb.passwords.icingaweb2.icingaadmin:
- Icinga Stack startencd /opt/docker-compose-icinga docker compose up -d 
- Icinga Stack stoppendocker compose down 
- Wiederherstellen der Standard-Benutzerrollen unterbinden
 in Dateidocker-compose.ymldie Zeilen auskommentieren
 icingaweb.roles.Administrators.groups: Administrators
 icingaweb.roles.Administrators.permissions: '*'
 icingaweb.roles.Administrators.users: icingaadmin
- Icinga Stack startendocker compose up -d
- Icinga nach reboot automatisch startensystemctl edit –full docker-compose-icinga.serviceUnit] Description=Start Icinga-Playground Docker containers After=docker.service Requires=docker.service [Service] Type=oneshot RemainAfterExit=yes WorkingDirectory=/opt/docker-compose-icinga User=linux Group=docker #ExecStart=docker compose -p icinga-playground up -d #ExecStop=docker compose -p icinga-playground stop ExecStart=docker compose up -d ExecStop=docker compose stop TimeoutStartSec=0 [Install] WantedBy=multi-user.target Danach den Service einschalten und den Systemd-Daemon neustarten systemctl enable docker-compose-icinga.service && systemctl daemon-reload
Eigene Checks einbinden
In den Icinga2 Container verbinden und folgendes ausführen:
echo "include_recursive \"/custom_data/custom.conf.d/\"" >> /etc/icinga2/icinga2.conf
Danach auf dem Docker-Host den Ordner für die eigenen Checks erstellen und Checks dort ablegen.
mkdir -p /opt/docker-compose-icinga/icinga2.conf.d/my-plugins/
Eigene Icinga-Constants erstellen.
vi /opt/docker-compose-icinga/icinga2.conf.d/constants.conf
Inhalt:
# My Custom Plugins const CustomPluginDir = "custom_data/custom.conf.d/my-plugins/"
Eigene Icinga-Service Konfiguration erstellen.
/opt/docker-compose-icinga/icinga2.conf.d/services.conf
Inhalt am Beispiel vom Check für QNap-Nas:
object CheckCommand "check_qnap2" {
  import "plugin-check-command"
  command = [ CustomPluginDir + "/check_qnap2.sh" ]
  arguments += {
        "-H" = {
            description = "Host name, IP Address, or unix socket (must be an absolute path)"
            value = "$qnap_address$"
        }
        "-C" = {
            description = "Community string for SNMP communication (default is 'public')"
            value = "$qnap_community$"
        }
        "-v" = {
            description = "SNMP protocol version (defalt: 2c)"
            value = "$qnap_version$"
        }
        "-p" = {
            description = "Port number (default: 161)"
            value = "$qnap_port$"
        }
        "-t" = {
            description = "Seconds before connection times out (default: 10)"
            value = "$qnap_timeout$"
        }
        "-a" = {
            description = "Executed Command-Check"
            value = "$qnap_timeout$"
        }
  }
  vars.check_address = {
        arguments = [  ]
        deprecated = false
        name = "<anonymous>"
        side_effect_free = false
        type = "Function"
    }
    vars.check_ipv4 = false
    vars.check_ipv6 = false
    vars.qnap_address = "$check_address$"
}
Nun noch den Icinga stack neu starten.
cd /opt/docker-compose-icinga docker compose restart
Jetzt kann der neu definierte Check im Director normal verwendet werden.