Nagios 2.10 su Centos 5 parte 1

In questa guida vedremo come installare Nagios 2.10 su CentOS 5.1 64 bit ( applicabile anche su altre versioni di centos con poche modifiche )<br /> Nagios e' uno strumento di monitoring indispensabile su ogni server per tenere controllate <br /> le risorse della macchina ( carichi sulla cpu , disco usato , etc ) e servizi (SMTP, POP3, HTTP, NNTP, PING, etc.)<br /> quando qualcosa non andra per il verso giusto Nagios ci avvisera con un email o con sms .<br /> <br /> Prerequisiti del sistema sono un mail server funzionante e apache installato, e la repository di rpmforge configurata.<br /> <br /> Procediamo dunque con installazione di nagios :<br /> <br /> Per prima cosa assicuriamoci di avere installati questi pacchetti :<br /> <br /> <div class="codeheader">Codice:</div> <div class="code"> <pre style="margin-top: 0pt; display: inline;">yum --enablerepo=rpmforge install nagios nagios-plugins nagios-devel nagios-plugins-nrpe</pre> </div> <br /> yum risolvere alcune dipendenze , ad installazione completata andiamo a creare l'utente e la password di nagiosadmin :<br /> <span style="font-family: monospace;"><br /> </span> <div class="codeheader">Codice:</div> <div class="code"> <pre style="margin-top: 0pt; display: inline;">htpasswd -c /etc/nagios/htpasswd.users nagiosadmin<br /></pre> </div> <br /> digitate poi la password che volete assegnare a nagiosadmin<br /> <br /> Andiamo poi a editare questi file :<br /> <br /> vi /etc/nagios/localhost.cfg<br /> <br /> nella sezione CONTACTS andimo a editare la nostra email<br /> <br /> <div class="codeheader">Codice:</div> <div class="code"> <pre style="margin-top: 0pt; display: inline;">###############################################################################<br /><br />#<br /><br /># CONTACTS<br /><br />#<br /><br />###############################################################################<br /><br />###############################################################################<br /><br /><br /><br /># In this simple config file, a single contact will receive all alerts.<br /><br /># This assumes that you have an account (or email alias) called<br /><br /># &quot;nagios-admin&quot; on the local host.<br /><br /><br /><br />define contact{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; contact_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nagios-admin<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alias&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nagios Admin<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; service_notification_period&nbsp;&nbsp;&nbsp;&nbsp; 24x7<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; host_notification_period&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 24x7<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; service_notification_options&nbsp;&nbsp;&nbsp; w,u,c,r<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; host_notification_options&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d,r<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; service_notification_commands&nbsp;&nbsp; notify-by-email<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; host_notification_commands&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; host-notify-by-email<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; email&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mia-email@xxxxx.com<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br /><br /><br /><br /><br /><br /><br />###############################################################################<br /><br />###############################################################################<br /></pre> </div> <br /> salviamo e andiamo poi a editare vi /etc/nagios/nagios.cfg<br /> <br /> nella sezione EXTERNAL COMMAND OPTION , andiamo ad abilitare esecuzione dei comandi da CGI per interfaccia web :<br /> <br /> <div class="codeheader">Codice:</div> <div class="code"> <pre style="margin-top: 0pt; display: inline;"># EXTERNAL COMMAND OPTION<br /><br /># This option allows you to specify whether or not Nagios should check<br /><br /># for external commands (in the command file defined below).&nbsp; By default<br /><br /># Nagios will *not* check for external commands, just to be on the<br /><br /># cautious side.&nbsp; If you want to be able to use the CGI command interface<br /><br /># you will have to enable this.&nbsp; Setting this value to 0 disables command<br /><br /># checking (the default), other values enable it.<br /><br /><br /><br />check_external_commands=1<br /></pre> </div> <br /> A questo punto installazione di base di Nagios 2.10 e' completata , rendiamo il servizio avviabile al avvio della macchina :<br /> <br /> <div class="codeheader">Codice:</div> <div class="code"> <pre style="margin-top: 0pt; display: inline;">chkconfig nagios on<br /></pre> </div> <br /> riavviamo poi apache e facciamo partire nagios<br /> <br /> <div class="codeheader">Codice:</div> <div class="code"> <pre style="margin-top: 0pt; display: inline;">service httpd restart<br /></pre> </div> <br /> Per controllare che sia tutto a posto :<br /> <br /> <div class="codeheader">Codice:</div> <div class="code"> <pre style="margin-top: 0pt; display: inline;">nagios -v nagios.cfg<br /></pre> </div> <br /> se tutto e' ok comparira una risposta simile a questa :<br /> <br /> <div class="codeheader">Codice:</div> <div class="code"> <pre style="margin-top: 0pt; display: inline;">[root@server]# nagios -v nagios.cfg<br /><br /><br /><br />Nagios 2.10<br /><br />Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org)<br /><br />Last Modified: 10-21-2007<br /><br />License: GPL<br /><br /><br /><br />Reading configuration data...<br /><br /><br /><br />Running pre-flight check on configuration data...<br /><br /><br /><br />Checking services...<br /><br />Checked 6 services.<br /><br />Checking hosts...<br /><br />Checked 1 hosts.<br /><br />Checking host groups...<br /><br />Checked 1 host groups.<br /><br />Checking service groups...<br /><br />Checked 0 service groups.<br /><br />Checking contacts...<br /><br />Checked 1 contacts.<br /><br />Checking contact groups...<br /><br />Checked 1 contact groups.<br /><br />Checking service escalations...<br /><br />Checked 0 service escalations.<br /><br />Checking service dependencies...<br /><br />Checked 0 service dependencies.<br /><br />Checking host escalations...<br /><br />Checked 0 host escalations.<br /><br />Checking host dependencies...<br /><br />Checked 0 host dependencies.<br /><br />Checking commands...<br /><br />Checked 22 commands.<br /><br />Checking time periods...<br /><br />Checked 4 time periods.<br /><br />Checking extended host info definitions...<br /><br />Checked 0 extended host info definitions.<br /><br />Checking extended service info definitions...<br /><br />Checked 0 extended service info definitions.<br /><br />Checking for circular paths between hosts...<br /><br />Checking for circular host and service dependencies...<br /><br />Checking global event handlers...<br /><br />Checking obsessive compulsive processor commands...<br /><br />Checking misc settings...<br /><br /><br /><br />Total Warnings: 0<br /><br />Total Errors: 0<br /><br /><br /><br />Things look okay - No serious problems were detected during the pre-flight check<br /></pre> </div> Possiamo poi avviare nagios <br /> <br /> <div class="codeheader">Codice:</div> <div class="code"> <pre style="margin-top: 0pt; display: inline;">service nagios start<br /></pre> </div> <br /> A questo punto da browser dovremmo avere la possibilita di usare interfaccia di nagios,<br /> da locale&nbsp; http://localhost/nagios/<br /> da remoto http://IPDELSERVER/nagios/<br /> <br /> Questa e' solo una installazione/configurazione di base per personalizzare le tante funzioni , vi lascio alla documentazione ufficiale<br /> su nagios.org<br /> Se volete aggiungere qualche plugin e personalizzare proseguite la lettura nella seconda parte <a href="http://www.centos-italia.org/index.php?page=configurare-nagios-centos">http://www.centos-italia.org/index.php?page=configurare-nagios-centos</a><br /> Buon nagios :)

SMF 2.0.17 | SMF © 2013, Simple Machines
TinyPortal © 2005-2012

Indietro all'articolo