User Tools

Site Tools


doc:appunti:linux:sa:cacti_122

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:sa:cacti_122 [2022/03/25 17:37] – [Check passivo] niccolodoc:appunti:linux:sa:cacti_122 [2022/10/10 16:27] (current) – [Monitoraggio servizio CLAMD] niccolo
Line 361: Line 361:
         return "No check results received. Last result time: " + lastCheck         return "No check results received. Last result time: " + lastCheck
     }}     }}
-    check_interval = 1d  /* This determines the freshness of the check. */ +    check_interval = 1d +1h  /* This determines the freshness of the check. */ 
-    retry_interval = 1h  /* Execute the active check if freshness is due. */ +    retry_interval = 1h      /* Execute the active check if freshness is due. */ 
-    max_check_attempts = 3  /* Retry the active check some times, before notification. */+    max_check_attempts = 3   /* Retry the active check some times, before notification. */
     vars.notification_interval = 1d       vars.notification_interval = 1d  
 } }
Line 754: Line 754:
 </code> </code>
  
 +===== Monitoraggio servizio CLAMD =====
 +
 +Il programma antivirus **[[http://www.clamav.net/|ClamAV]]** generalmente viene configurato in Debian come servizio **clamav-daemon.service**, l'eseguibile **clamd** è in esecuzione con i parametri configurati in **/etc/clamav/clamd.conf**. Per attivare il monitoraggio del servizio (si vuole sapere se il demone è in esecuzione) conviene usare il plugin **/usr/lib/nagios/plugins/check_clamd** fornito dal pacchetto **monitoring-plugins-basic**, che fa una semplice interrogazione su TCP/IP.
 +
 +Per impostazione predefinita clamd **non** si mette in ascolto sulla porta **TCP 3310**, è necessario aggiungere queste righe alla configurazione:
 +
 +<file>
 +# Listen also on TCP localhost, to allow running status check.
 +TCPSocket 3310
 +TCPAddr 127.0.0.1
 +</file>
 +
 +Il binding viene fatto solo su //localhost// in modo da non esporre il servizio antivirus all'esterno; pertanto il plugin Icinga deve essere eseguito in locale e il check da parte di un host remoto avvien tramite NRPE. Per ottenere questo si aggiunge in **/etc/nagios/nrpe_local.cfg**:
 +
 +<file>
 +command[check_clamd]=/usr/lib/nagios/plugins/check_clamd -H localhost
 +</file>
 +
 +Sul server Icinga2 si deve definire il **servizio** aggiungendo in **/etc/icinga2/conf.d/local/services.conf** la seguente sezione:
 +
 +<file>
 +apply Service "CLAMD Service" {
 +    import "generic-service"
 +    check_command = "mail_check_nrpe_clamd"
 +    assign where host.vars.nrpe_clamd
 +}
 +</file>
 +
 +Quindi si aggiunge il comando aggiungendo in **/etc/icinga2/conf.d/local/commands.conf** la seguente sezione:
 +
 +<file>
 +object CheckCommand "mail_check_nrpe_clamd" {
 +    command = [ PluginDir + "/check_nrpe", "--timeout=60:UNKNOWN" ]
 +    arguments = {
 +        "-H" = "$address$"
 +        "-c" = "check_clamd"
 +        "-n" = { set_if = "$nrpe_no_ssl$" }
 +    }
 +}
 +</file>
 +
 +Infine nella sezione **host** relativa all'host da monitorare (potrebbe essere nel file **/etc/icinga2/conf.d/hosts.conf**), si aggiunge la riga:
 +
 +<file>
 +object Host "clamav-hostname" {
 +  ...
 +  vars.nrpe_clamd = true
 +  ...
 +}
 +</file>
 ===== Riferimenti Web ===== ===== Riferimenti Web =====
  
doc/appunti/linux/sa/cacti_122.1648226232.txt.gz · Last modified: 2022/03/25 17:37 by niccolo