documentation/Procédures/supervision.md

4.8 KiB

Installation de la supervision sur une machine virtuelle

Générer un ticket sur isengard.libre-en-communs.org

sudo icinga2 pki ticket --cn NOM_DE_DOMAINE_DE_VM

On obtient un ticket à noter dans l'issue. Il sera redemandé plus tard.

En SSH sur la machine virtuelle, installer l'agent de supervision

sudo apt install icinga2 monitoring-plugins monitoring-plugins-contrib

Modifier la configuration de la sonde de mémoire vive (pour corriger un bug)

/usr/share/icinga2/include/plugins-contrib.d/operating-system.conf
object CheckCommand "mem" {
    command = [ PluginContribDir + "/check_memory" ]

    arguments = {
            "-u" = {
                    set_if = "$mem_used$"
                    description = "Check USED memory"
            }
            "-f" = {
                    set_if = "$mem_free$"
                    description = "Check FREE memory"
            }
            "-C" = {
                    set_if = "$mem_cache$"
                    description = "Count OS caches as FREE memory"
            }
            "-w" = {
                    value = "$mem_warning$"
                    description = "Percent free/used when to warn"
            }
            "-c" = {
                    value = "$mem_critical$"
                    description = "Percent free/used when critical"
            }
    }

    vars.mem_used = false
    vars.mem_free = false
    vars.mem_cache = false
}

Connecter notre agent au serveur de supervision

sudo icinga2 node wizard
On réalise la configuration interactive suivante:
Welcome to the Icinga 2 Setup Wizard!

We will guide you through all required configuration details.

Please specify if this is an agent/satellite setup ('n' installs a master setup) [Y/n]: 

Starting the Agent/Satellite setup routine...

Please specify the common name (CN) [NOM_DE_DOMAINE_DE_VM]: 

Please specify the parent endpoint(s) (master or satellite) where this node should connect to:
Master/Satellite Common Name (CN from your master/satellite node): isengard.libre-en-communs.org

Do you want to establish a connection to the parent node from this node? [Y/n]: 
Please specify the master/satellite connection information:
Master/Satellite endpoint host (IP address or FQDN): isengard.libre-en-communs.org
Master/Satellite endpoint port [5665]: 

Add more master/satellite endpoints? [y/N]: 
Parent certificate information:

Version:             3
Subject:             CN = isengard.libre-en-communs.org
Issuer:              CN = Icinga CA
Valid From:          Dec  9 14:36:07 2021 GMT
Valid Until:         Dec  5 14:36:07 2036 GMT
Serial:              c4:3f:53:b2:cf:09:f7:b5:2e:88:39:03:e9:96:c8:fc:99:a1:ca:3a

Signature Algorithm: sha256WithRSAEncryption
Subject Alt Names:   isengard.libre-en-communs.org
Fingerprint:         54 78 22 83 24 22 3A A7 FD 00 01 E4 10 67 71 B6 CA 3E A2 71 93 63 F8 64 29 E9 45 1F D1 35 A9 95 

Is this information correct? [y/N]: y

Please specify the request ticket generated on your Icinga 2 master (optional).
(Hint: # icinga2 pki ticket --cn 'NOM_DE_DOMAINE_DE_VM'):  INSERER_NUMERO_DE_TICKET_ICI
Please specify the API bind host/port (optional):
Bind Host []: 
Bind Port []: 

Accept config from parent node? [y/N]: y
Accept commands from parent node? [y/N]: y

Reconfiguring Icinga...
Disabling feature notification. Make sure to restart Icinga 2 for these changes to take effect.
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.

Local zone name [NOM_DE_DOMAINE_DE_VM]: 
Parent zone name [master]: 

Default global zones: global-templates director-global
Do you want to specify additional global zones? [y/N]: 

Do you want to disable the inclusion of the conf.d directory [Y/n]: 
Disabling the inclusion of the conf.d directory...

Done.

Now restart your Icinga 2 daemon to finish the installation!

Créer le fichier de zone pour la nouvelle machine dans isengard.libre-en-communs.org

/etc/icinga2/zones.d/master/NOM_DE_DOMAINE_DE_VM.conf
object Endpoint "NOM_DE_DOMAINE_DE_VM" {
}

object Zone "NOM_DE_DOMAINE_DE_VM" {
endpoints = [ "NOM_DE_DOMAINE_DE_VM" ]
parent = "master"
}

object Host "NOM_DE_DOMAINE_DE_VM" {
    import "generic-host"
    address  = "NOM_DE_DOMAINE_DE_VM"
    address6 = "NOM_DE_DOMAINE_DE_VM"
    vars.os = "GNU/Linux"
    vars.client_endpoint = name

    vars.notification["mail"] = {  
        groups = [ "icingaadmins" ]  
    }  

}