doc:appunti:linux:sa:cacti_122
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:sa:cacti_122 [2020/06/08 19:06] – [Modifica servizi predefiniti] niccolo | doc: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 |
| vars.notification_interval = 1d | vars.notification_interval = 1d | ||
| } | } | ||
| Line 370: | Line 370: | ||
| Il // | Il // | ||
| - | In condizioni normali viene ricevuto un **check passivo** ogni 24 ore, quindi il check attivo giornaliero (// | + | In condizioni normali viene ricevuto un **check passivo** ogni 24 ore, quindi il check attivo giornaliero (// |
| Per definire il servizio associato ad un host si aggiunge ad esempio nel file **/ | Per definire il servizio associato ad un host si aggiunge ad esempio nel file **/ | ||
| Line 388: | Line 388: | ||
| Il timestamp in formato Unix si può ottenere da una shell Unix con il comando **%%date +%s%%**. | Il timestamp in formato Unix si può ottenere da una shell Unix con il comando **%%date +%s%%**. | ||
| + | |||
| + | La ricezione di un check passivo viene registrata nel log **/ | ||
| + | |||
| + | < | ||
| + | [2022-02-22 02:49:04 +0100] information/ | ||
| + | Executing external command: [1645494544] PROCESS_SERVICE_CHECK_RESULT; | ||
| + | Backup Maildir; | ||
| + | rsync Maildir da Santorini a Naxos eseguito con successo. | ||
| + | </ | ||
| + | |||
| + | ==== Ricezione check passivo via REST API ==== | ||
| + | |||
| + | Si verifica che la **[[# | ||
| + | |||
| + | Nel file **/ | ||
| + | |||
| + | < | ||
| + | // Used to submit passive checks results, e.g. from backup scripts. | ||
| + | object ApiUser " | ||
| + | password = " | ||
| + | permissions = [ " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Il client che deve inviare l' | ||
| + | |||
| + | <code bash> | ||
| + | ICINGA2_SERVER=' | ||
| + | ICINGA2_USER=' | ||
| + | ICINGA2_PASSWORD=' | ||
| + | |||
| + | SERVICE_HOST=' | ||
| + | SERVICE_NAME=" | ||
| + | EXIT_STATUS=" | ||
| + | EXIT_MESSAGE=" | ||
| + | |||
| + | curl -k -s -u " | ||
| + | -H ' | ||
| + | -X POST " | ||
| + | -d '{ " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | </ | ||
| + | |||
| + | Un servizio Icinga può essere in uno dei seguenti stati: | ||
| + | |||
| + | ^ 0 | OK | | ||
| + | ^ 1 | WARNING | ||
| + | ^ 2 | CRITICAL | ||
| + | ^ 3 | UNKNOWN | ||
| ==== Server NSCA ==== | ==== Server NSCA ==== | ||
| + | |||
| + | :!: **ATTENZIONE**: | ||
| Nell' | Nell' | ||
| Line 701: | Line 754: | ||
| </ | </ | ||
| + | ===== Monitoraggio servizio CLAMD ===== | ||
| + | |||
| + | Il programma antivirus **[[http:// | ||
| + | |||
| + | Per impostazione predefinita clamd **non** si mette in ascolto sulla porta **TCP 3310**, è necessario aggiungere queste righe alla configurazione: | ||
| + | |||
| + | < | ||
| + | # Listen also on TCP localhost, to allow running status check. | ||
| + | TCPSocket 3310 | ||
| + | TCPAddr 127.0.0.1 | ||
| + | </ | ||
| + | |||
| + | Il binding viene fatto solo su // | ||
| + | |||
| + | < | ||
| + | command[check_clamd]=/ | ||
| + | </ | ||
| + | |||
| + | Sul server Icinga2 si deve definire il **servizio** aggiungendo in **/ | ||
| + | |||
| + | < | ||
| + | apply Service "CLAMD Service" | ||
| + | import " | ||
| + | check_command = " | ||
| + | assign where host.vars.nrpe_clamd | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Quindi si aggiunge il comando aggiungendo in **/ | ||
| + | |||
| + | < | ||
| + | object CheckCommand " | ||
| + | command = [ PluginDir + "/ | ||
| + | arguments = { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Infine nella sezione **host** relativa all' | ||
| + | |||
| + | < | ||
| + | object Host " | ||
| + | ... | ||
| + | vars.nrpe_clamd = true | ||
| + | ... | ||
| + | } | ||
| + | </ | ||
| ===== Riferimenti Web ===== | ===== Riferimenti Web ===== | ||
doc/appunti/linux/sa/cacti_122.1591635970.txt.gz · Last modified: by niccolo
