>_Nagios + ndoutils + nagvis no Centos 6

Neste tutorial vou abordar a instalação do Nagios com NDOutils e também com o NagVis no CentOS 6.

Passo 1 → Download e instalação dos pacotes necessários.

# cd /opt
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
# yum update -y
# wget http://sourceforge.net/projects/nagvis/files/NagVis%201.7/nagvis-1.7.3.tar.gz/download
# wget http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.5.2/ndoutils-1.5.2.tar.gz/download
# wget http://mathias-kettner.de/download/mk-livestatus-1.1.12p6.tar.gz
# yum install nagios nagios-plugins perl-Nagios-Object.noarch perl-Nagios-Plugin.noarch nagios-plugins-nrpe nagios-plugins httpd
# yum install php-gd php-mbstring mod_php  php-xml php-pdo mysql-server mysql gcc make libdbi-dbd-mysql mysql-libs mysql-devel gcc-c++ graphviz-devel graphviz-gd php-mysql
# reboot

Passo 2 → Extraindo e compilando o pacote ndoutils.

# tar -xvf ndoutils-1.5.2.tar.gz
# cd ndoutils-1.5.2
# ./configure
# make

Passo 3 → Configurando o ndoutils.

# mkdir -p /usr/local/nagios/bin/
# cd src/
# cp ndomod-3x.o ndo2db-3x log2ndo file2sock /usr/local/nagios/bin/
# cp ndomod-3x.o /usr/local/nagios/bin/ndomod.o
# cd /opt/ndoutils-1.5.2/config
# cp ndo2db.cfg-sample ndomod.cfg-sample /etc/nagios/
# cd /etc/nagios/
# mv ndo2db.cfg-sample ndo2db.cfg
# mv ndomod.cfg-sample ndomod.cfg
# mkdir -p /var/nagios/
# chown nagios.nagios /var/nagios/ -R
# cd /etc/nagios
# chown nagios.nagios *

Passo 4 → Confiugando o Banco de Dados – Mysql

# /etc/init.d/mysqld start
# mysql
mysql> create database nagios;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on nagios.* to 'nagios'@'localhost' identified by 'doorto2';
Query OK, 0 rows affected (0.00 sec)

mysql> q

Passo 5 → Criando a estrutura da base de dados nagios e em seguida configurando os arquivos ndo2db.cfg, ndomod.cfg e o nagios.cfg.

# cd /opt/ndoutils-1.5.2/db/
# ./installdb -u nagios -pdoorto2 -d nagios

# cd /etc/nagios/
# vim /etc/nagios/nagios.cfg
event_broker_options=-1
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/etc/nagios/ndomod.cfg
# vim /etc/nagios/ndo2db.cfg
####################################################################
# NDO2DB DAEMON CONFIG FILE
#
# Last Modified: 01-02-2009
#####################################################################
lock_file=/var/nagios/ndo2db.lock
ndo2db_user=nagios
ndo2db_group=nagios
socket_type=unix
#socket_type=tcp
socket_name=/var/nagios/rw/ndo.sock
tcp_port=5668
use_ssl=0
db_servertype=mysql
db_host=localhost
db_port=3306
db_name=nagios
db_prefix=nagios_
db_user=nagios
db_pass=doorto2
# Keep timed events for 24 hours
max_timedevents_age=1440
# Keep system commands for 1 week
max_systemcommands_age=10080
# Keep service checks for 1 week
max_servicechecks_age=10080
# Keep host checks for 1 week
max_hostchecks_age=10080
# Keep event handlers for 31 days
max_eventhandlers_age=44640
# Keep external commands for 31 days
max_externalcommands_age=44640
debug_level=0
debug_verbosity=1
debug_file=/var/log/nagios/ndo2db.debug
max_debug_file_size=1000000
#
# vim /etc/nagios/ndomod.cfg
#####################################################################
# NDOMOD CONFIG FILE
#
# Last Modified: 09-05-2007
#####################################################################
instance_name=default
output_type=unixsocket
output=/var/nagios/rw/ndo.sock
tcp_port=5668
use_ssl=0
output_buffer_items=5000
buffer_file=/var/nagios/ndomod.tmp
file_rotation_interval=14400
file_rotation_timeout=60
reconnect_interval=15
reconnect_warning_interval=15
data_processing_options=-1
config_output_options=2

Passo 6 → Adicionando uma chamada no rc.local para iniciar o NDO.

# vim /etc/rc.local
/usr/local/nagios/bin/ndo2db-3x -c /etc/nagios/ndo2db.cfg

Passo 7 → Configurando o arquivo nagios.conf do httpd

# cd /etc/httpd/conf.d/
# vim nagios.conf
ScriptAlias /nagios/cgi-bin "/usr/lib/nagios/cgi"

            ServerAdmin sysadmin@d2d.com.br
            ServerName nagios.d2d.com.br
            DocumentRoot /usr/share/nagios
            ErrorLog logs/nagios_error_log
            CustomLog logs/nagios-access_log common

#  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 /etc/nagios/htpasswd.users
   Require valid-user

Alias /nagios "/usr/share/nagios"

#  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" # chkconfig mysqld on
   AuthType Basic
   AuthUserFile /etc/nagios/htpasswd.users
   Require valid-user

Passo 8 → Criando o arquivo de senha, para acessar o nagios.

# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
# reboot

Passo 9 →Extraindo e compilando o mk-livestatus.

# tar -xvf mk-livestatus-1.1.12p6.tar.gz
# cd mk-livestatus-1.1.12p6
# ./configure
# make install
# ln -s /usr/local/nagvis/ /usr/

# vim /etc/nagios/nagios.cfg
broker_module=/usr/local/lib/mk-livestatus/livestatus.o /var/nagios/rw/live

Passo 10 → Ativando o nagios, httpd e o mysqld para iniciar junto com o S.O.

# chkconfig nagios on
# chkconfig httpd on
# chkconfig mysqld on

Passo 11 → Configurando o nagvis.

# cd /opt/
# tar -xvf nagvis-1.7.3.tar.gz
# cd nagvis-1.7.3
# ./install.sh -m /usr/local/nagios/bin/ndo2db-3x
 

1

2

3

4

5

# /etc/init.d/httpd restart
Parando o httpd:                                           [  OK  ]
Iniciando o httpd:                                         [  OK  ]

6

7

8

9

10

 

 

>_Nagios + ndoutils + nagvis no Centos 6
Tagged on:

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

%d blogueiros gostam disto: