wiki:programme:icinga2:check_update

barcode

check_update auf CentOS7 mit SELinux

  • Da in der Datei yum.conf Proxy-Zugangsdaten stehen können, wurde die Datei auf die Rechte 640 gesetzt (Standard 644). Somit kann nur noch root yum benutzen.
  • Aus Sicherheitsgründen ist SELinux aktiv
  • Plugin installieren
     yum install nagios-plugins-check-updates
  • Check-Command definieren und nrpe neu starten
    echo -e 'command[check_os_update]= sudo /var/lib64/nagios/plugins/check_updates -t 45 --boot-check_warning --critical=55' | tee /etc/nrpe.d/os_update.cfg
    systemctl restart nrpe.service
     
  • sudo anpassen, dass nrpe dieses Kommando ohne Passwort ausführen darf
    echo -e 'nrpe ALL=(root) NOPASSWD:/usr/lib64/nagios/plugins/check_updates' | tee /etc/sudoers.d/check_os_update
  • SELinux: nrpe erlauben, sudo zu nutzen
    setsebool -P nagios_run_sudo 1
  • sudo: Definieren, dass kein für nrpe kein Terminal genutzt werden soll
    echo -e '#This is generally enforced by having Defaults requiretty in the /etc/sudoers.\n#Some Linux distributions have been known to have this as a default configuration. RedHat just recently removed this from Fedora and REHL, see Bug 1020147 (https://bugzilla.redhat.com/show_bug.cgi?id=1020147#c9)\nDefaults:nrpe !requiretty' | sudo tee -a /etc/sudoers.d/nrpe_requiretty
  • icinga2: check definieren
    das commando check_update braucht eine gewisse Laufzeit. Deshalb sollte auch nrpe so lange warten, bis der check beendet ist
    /etc/icinga2/conf.d/commands/nrpe.cfg
    object CheckCommand "nrpe-check-1arg" {
        import "plugin-check-command"
        command = [PluginDir + "/check_nrpe" ]
        arguments = {
        "-H" = "$host$"
        "-c" = "$check$"
        "-t" = "50"
        }
    }


    /etc/icinga2/conf.d/services/nrpe.conf
    apply Service "OS Update" {
        import "generic-service"
        check_command = "nrpe-check-1arg"
        vars.host = "$host.address$"
        vars.check = "check_os_update"
        max_check_attempts = 5
        check_interval = 30m
        retry_interval = 10m
     
     
        assign where host.address && ( host.vars.os == "CentOS7" )
        ignore where host.name == "einzelner Rechner"
    }
  • icinga neu starten und Spaß haben
Geben Sie Ihren Kommentar ein. Wiki-Syntax ist zugelassen:
  _____   ____   _  __   ____   __ __
 / ___/  / __/  / |/ /  / __/  / // /
/ /__   _\ \   /    /  / _/   / _  / 
\___/  /___/  /_/|_/  /_/    /_//_/
 
  • wiki/programme/icinga2/check_update.txt
  • Zuletzt geändert: 2020/02/25 20:25
  • von wikiadmin