La migliore soluzione per il Network System Monitoring è la combinazione di queste applicazioni Nagios/Centreon/NagVis/Dokuwiki.

Questo articolo ripropone l’installazione passo-passo e la configurazione su CENTOS 6 di NAGIOS.
Vi invito a leggere anche l’articolo per trasformare una Red Hat Enterprise Linux in CentOS.

Installazione sistema operativo

1.Installare CentOS
Aggiornare il sistema
# yum -y update rpm
# yum -y -y -v update
(fai ne fai uso configura il proxy)

2.Rimuovi software inutile (GUI,Squid,etc…):
# yum -y remove gdm
# yum -y -v remove squid

3. Configura il sistema “level 3” (solo comando):
# vim \etc\inittab

4.Disabilita funzioni inutili:
# chkconfig –level 3 bluetooth off
# chkconfig –list |grep 3:on

5.Disabilita SELinux:
# vim /etc/selinux/config
SELINUX=disabled
# reboot

Installare i pre-requisiti

# yum -y install libstdc++-devel gcc-c++
# yum -y install httpd
# yum -y install gd gd-devel

(Opzionale) # yum groupinstall “Development Tools”
# yum install kernel-devel

Installare SSL e MySQL
# yum -y install openssl-devel perl-DBD-MySQL mysql-server mysql-devel

Installare PHP
# yum -y -v install php php-mysql php-gd php-ldap php-xml

Installare i moduli DBI
# yum -y install perl-DBI perl-DBD-MySQL

Installare i moduli PERL
# yum -y install perl-Config-IniFiles

Installare RRDTools
# yum -y install rrdtool perl-rrdtool

Installare SNMP
# yum -y install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils
# yum -y install perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl

Altre APPs
# yum -y install fping graphviz cpp gcc gcc-c++ libstdc++ glib2-devel

Installare PEAR e configurazione
# yum install php-pear

Configurazione

(PROXY) # pear config-set http_proxy http://: my_proxy.com:port

Aggiornale PEAR prima di installare
# pear channel-update pear.php.net
pear upgrade-all

Installare NAGIOS

# groupadd nagios
# adduser nagios -g nagios
# passwd nagios

Controllare il creato
# grep nagios /etc/passwd

Aggiungere gli utenti giusti
# usermod -G nagios nagios
# usermod -G apache,nagios apache

controllare se gli utenti sono corretti
# grep nagios /etc/group
# mkdir /usr/local/nagios
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz

# ./configure –-enable-embedded-perl –-prefix=/usr/local/nagios -–with-cgiurl=/nagios/cgi-bin –-with-htmurl=/nagios/ –-with-nagios-user=nagios –-with-nagios-group=nagios -–with-command-group=nagios
–enable-nanosleep –enable-event-broker

Test installazione:
# make test
Troubleshooting: probabili problemi con embedded-perl

Usare cpan da cmd:
# cpan
#> install Test:Simple Test::Long Test::WWW::Mechanize::CGI
Path to Perl (only if needed)
export PERL5LIB=/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE/libperl.so libperl.so

Installare Nagios
# make all
# make install
# make install-init
# make install-commandmode
# make install-config
# make install-webconf (this will copy nagios.conf)
# ls -l /usr/local/nagios

dovresti vedere 5 diverse subdirectory

# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Modificare il file cgi.cfg per permettere all’utente nagiosadmin autenticazione

# vim /usr/local/nagios/etc/cgi.cfg
authorized_for_system_information=nagiosadmin

httpd.conf

FIX: /etc/httpd/conf.d/nagios.conf
Alias /nagios/ “/usr/local/nagios/share/”

configura httpd.conf

ScriptAlias /nagios/cgi-bin “/usr/local/nagios/sbin”

# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

Alias /nagios/ “/usr/local/nagios/share/”

# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

Finally Restart Apache and Nagios
# service httpd restart
# service nagios restart
Add both to auto start
# chkconfig –add httpd
# chkconfig –level 35 httpd on
# chkconfig –add nagios
# chkconfig –level 35 nagios on
Try it on your browser:

http:///nagios/

Se non funziona controlla i LOGs
/var/logs/httpd/error_log
/usr/local/nagios/etc/htpasswd.users
/usr/local/nagios/etc/cgi.cfg


Installare i plugin NAGIOS

# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
# ./configure –with-openssl=/usr/bin/openssl –enable-perl-modules –prefix=/usr/local/nagios –with-nagios-user=nagios
# make all
# make install

Controlla se:
# ls -l /usr/local/nagios/libexec
i permessi devono essere nagios:nagios

# chown nagios:nagios -R /usr/local/nagios/libexec
# chomod +x -R /usr/local/nagios/libexec

Installare CENTREON

Installare MySQL & PHP5
# yum -y -v install mysql-server
# yum -y -v install php-date
# yum -y -v install php-gd php-mysql php-snmp php-ldap
# yum -y -v install php-mail php-mail-mime php-net-smtp php-net-socket
# yum -y -v install php5-xmlrpc

Avvia mysql in safe mode e inserisci la password
#service mysqld_safe –skip-grant-tables

Aggiungi password
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“password”) where User=’root’;
mysql> flush privileges;
mysql> quit
# service mysqld restart
# chkconfig –add mysqld
# chkconfig –level 3 mysqld on

PhpMySQLAdmin(Optional) per l’amministrazione facile di MySQL:
# yum -y -v install phpmyadmin
Accedi con :

http://infonagiosdsv/phpMyAdmin

Installare NDOUtils
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz
# tar -zxvf ndoutils-1.4b9.tar.gz
#./configure
#make all
#make install
(non farlo correre ci penserà CENTREON)

Installare i servizi EMAIL:
PostFix o SendMail,
# yum -y -v install postfix

# yum -y -v install sendmail
Fai un test delle email
# echo “TEST EMAIL” | sendmail -s “testing my first email” youtemail@domain.xxx

Upgrade PEAR
# pear upgrade pear
# pear channel-update pear.php.net
# pear install -o -f –alldeps DB_DataObject DB_DataObject_FormBuilder MDB2 Numbers_Roman
# pear install -o -f –alldeps Numbers_Words HTML_Common HTML_QuickForm2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL
# pear install -o -f –alldeps HTTP Image_Canvas Image_Color Image_Graph Image_GraphViz Net_Traceroute Net_Ping Validate XML_RPC
# pear install -o -f –alldeps SOAP

richiesti da Php
# yum install php-mbstring php-posix

Migliora SUDO
# vim /etc/sudoers
#Default requiretty
:wq!

Scarica CENTREON

# wget http://download.centreon.com/index.php?id=123
# bash install.sh

Cambiare la configurazione in questo punto:
per i moduli RRD perl [RRDs.pm] ?
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/RRDs.pm
Dove si trova PEAR [PEAR.php]
/usr/share/pear/PEAR.php
Dove si trova NDO?
/usr/local/nagios/bin/ndomod.o

Fai partire la GUI:

http:///centreon

Forse dvi far ripartire NDOUtils
# /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg

Auto START/STOP NDO daemone.
# vim /etc/init.d/nagios
trova la stringa e aggiungi:
“if [ $? -eq 0 ]; then…”
/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
“su – $NagiosUser -c “touch $NagiosVarDir/nagios.log $NagiosRetentionFile…”
“killproc_nagios nagios…”
histoy

Assicurati che SNMPD funziona
# vim /etc/snmp/snmpd.conf
# service snmpd restart
# chkconfig –add snmpd
# chkconfig –level 3 snmpd on

Nel caso di ERROR:
Can’t locate Net/SNMP.pm in @INC
SOLUZIONE:
1) By CPAN (best)
on command line, as root :
[your_host]# perl -MCPAN -e shell
cpan shell — CPAN exploration and modules installation (v1.76)
ReadLine support enabled
cpan> install Net::SNMP
If it’s the first time you run CPAN, it will probably ask you some (simple) questions.
CPAN will also ask you to satisfy some dependencies (Crypt::DES, Digest::MD5, etc..).
2) A mano
Scarica i seguenti moduli (tar.gz format) on www.cpan.org
– Crypt::DES
– Digest::MD5
– Digest::SHA1
– Digest::HMAC
– Net::SNMP
for each one (you must install Net::SNMP at the end) :
tar zxf .tar.gz
cd
perl Makefile.pl
make test
make install

INSTALLARE DOKUWIKI

Aggiungi la configurazione APACHE
# vim /etc/httpd/conf.d/dokuwiki.conf
#DOKUWIKI
Alias /wiki “/usr/local/dokuwiki/www”

Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all

# mkdir /usr/local/dokuwiki
# cd /usr/local/dokuwiki
# wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-02-14b.tgz
# tar -zxvf dokuwiki-2009-02-14b.tgz
# mv dokuwiki-2009-02-14b wwww
# chown apache:root -R /usr/local/dokuwiki/www
# service httpd restart

Vai su:

http:///wiki/install.php

INSTALLARE NAGVIS

Agguingere grpahviz repo
# vim /etc/yum.repos.d/graphviz.repo
[graphviz-stable]
name=Graphviz – RHEL $releasever – $basearch
baseurl=http://www.graphviz.org/pub/graphviz/stable/redhat/el$releasever/$basearch/os/
enabled=1
gpgcheck=0
# yum -y install grpahviz
# yum –enablerepo=graphviz-snapshot update ‘graphviz*’
# wget https://sourceforge.net/projects/nagvis/files/NagVis%201.4%20%28stable%29/NagVis-1.4.4/nagvis-1.4.4.tar.gz/download
# tar -zxvf
# ./install.sh -i ndo2db -u apache -g apache

Configura user/name/db dove NDO DB all’interno del DB ( togli il commento):
# vim /usr/local/nagios/share/nagvis/etc/nagvis.ini.php
[backend_ndomy_1]

; instance name for tables in NDO-db
dbinstancename=”Central”

# service httpd restart

Per usare NAGVIS:

http:///nagios/nagvis/wui/index.php

Se vuoi visitarein USER mode vai su:

http:///nagios/nagvis/index.php

Installare NAGIOS e CENTREON su CENTOS 6
Tag: