* Conoscenza del computer >> Software >  >> LinkedIn

Monitorare Apache con Nagios: plugin check_apachestatus

Nagios monitora server Apache via modulo mod_status, che espone statistiche in pagina HTML leggibile. Plugin check_apachestatus.pl parse quella pagina per alert su sessioni, worker, richieste.

Configurazione Apache (mod_status)

  1. Modifica /apache/httpd.conf (o apache2.conf): decommenta/aggiungi:
    <Location /server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from .tuodominio.com
    </Location>
  2. Verifica apache/modules.conf ha:
    LoadModule status_module /usr/lib/apache/1.3/mod_status.so
  3. Riavvia Apache: /etc/init.d/apache restart (critico!)
  4. Test: browser → https://server-ip/server-status → pagina statistiche

Configurazione Nagios

  1. Copia plugin check_apachestatus.pl in /local/nagios/libexec/
  2. Test manuale: /local/nagios/libexec/check_apachestatus.pl -H <server-ip>
  3. Definisci servizio in Nagios:
    define service {
        host_name           webserver
        service_description Apache Status
        check_command       check_apachestatus!<server-ip>
        ...
    }

Metriche monitorate

  • Totale accessi, traffico (kB), CPU load
  • Worker: idle, busy, starting, reading, sending, keepalive, dns, logging, closing
  • Scoreboard: stato ogni slot worker
  • Alert su: busy workers > soglia, idle workers = 0 (server saturo)

Estensione: ExtendedStatus

In httpd.conf: ExtendedStatus On → statistiche dettagliate per richiesta (CPU, secondi, client, richiesta, vhost). Aumenta overhead minimo.

LinkedIn

  • --热点software