You are on page 1of 8

INSTALACIN DE

NAGIS EN CENTS 6.2

Instalacin de Nagios en CentOS 6.2 | Moiss Araya

Contenido
Instalar Nagios en CentOS 6.2 ........................................................................................................ 3
Verificar datos de S.O. ................................................................................................................ 3
Instalar requerimientos. ............................................................................................................. 3
Crear usuario y contrasea Nagios. ............................................................................................ 4
Creamos el grupo para ejecucin de comandos desde la interfaz web ........................................ 4
Instalar repositorio EPEL. ........................................................................................................... 4
Instalar Nagios. .......................................................................................................................... 5
Configurar Nagios ...................................................................................................................... 5
Modificar parmetros de acceso a Nagios .................................................................................. 6
Cambiar la password de usuario Web Nagios ............................................................................. 6
Iniciar servicios........................................................................................................................... 6
Iniciar servicio HTTP ............................................................................................................... 6
Configurar arranque automtico ............................................................................................ 7
Activar servicio Nagios ........................................................................................................... 7
Iniciar Nagios. ............................................................................................................................ 7
Verificar que los servicios estn ejecutndose. ........................................................................... 7
Ingresar a Nagios........................................................................................................................ 8

Instalacin de Nagios en CentOS 6.2 | Moiss Araya

Instalacin de Nagios en CentOS 6.2


Verificar datos de S.O.

Datos de conexin: Root/weblogic (ejemplo)

[root@weblogic ~]# hostname


weblogic.domain
[root@weblogic ~]# uname -a
Linux weblogic.domain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64
GNU/Linux
[root@weblogic ~]# cat /etc/redhat-release
CentOS release 6.2 (Final)

Instalar requerimientos.
[root@weblogic ~]# yum install httpd php gcc glibc glibc-common gd gd-devel net-snmp-utils net-

snmp openssl openssl-devel mod_ssl


Extracto de proceso:
libstdc++
libstdc++-devel

x86_64
x86_64

4.4.7-3.el6
4.4.7-3.el6

base
base

293 k
1.6 M

Transaction Summary
========================================================================================
====================================
Install 14 Package(s)
Upgrade 17 Package(s)
Total download size: 55 M
Is this ok [y/N]: y
Downloading Packages:
(1/31): cpp-4.4.7-3.el6.x86_64.rpm
| 3.7 MB 00:00
(2/31): gcc-4.4.7-3.el6.x86_64.rpm
Installed:
gd.x86_64 0:2.0.35-11.el6 gd-devel.x86_64 0:2.0.35-11.el6 libjpeg-turbo.x86_64 0:1.2.1-1.el6
mod_ssl.x86_64 1:2.2.15-29.el6.centos net-snmp.x86_64 1:5.5-44.el6_4.4
php.x86_64 0:5.3.3-23.el6_4
Dependency Installed:
libXpm.x86_64 0:3.5.10-2.el6
libXpm-devel.x86_64 0:3.5.10-2.el6 libjpeg-turbo-devel.x86_64
0:1.2.1-1.el6
lm_sensors-libs.x86_64 0:3.1.1-17.el6 net-snmp-libs.x86_64 1:5.5-44.el6_4.4 php-cli.x86_64 0:5.3.323.el6_4
php-common.x86_64 0:5.3.3-23.el6_4
Complete!

Instalacin de Nagios en CentOS 6.2 | Moiss Araya

Crear usuario y contrasea Nagios.

nagios/Nagios (ejemplo)

[root@weblogic ~]# useradd -m nagios


[root@weblogic ~]# passwd nagios
Cambiando la contrasea del usuario nagios.
Nueva contrasea:
Vuelva a escribir la nueva contrasea:
passwd: todos los tokens de autenticacin se actualizaron exitosamente.

Creamos el grupo para ejecucin de comandos desde la interfaz web


[root@weblogic ~]# groupadd nagadm
[root@weblogic ~]# usermod -a -G nagios nagios
[root@weblogic ~]# usermod -a -G nagios apache

Instalar repositorio EPEL.


[root@weblogic ~]# wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-

8.noarch.rpm
--2013-10-22 22:20:51-- http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-68.noarch.rpm
Resolviendo dl.fedoraproject.org... 209.132.181.23, 209.132.181.24, 209.132.181.25, ...
Connecting to dl.fedoraproject.org|209.132.181.23|:80... conectado.
Peticin HTTP enviada, esperando respuesta... 200 OK
Longitud: 14540 (14K) [application/x-rpm]
Saving to: `epel-release-6-8.noarch.rpm'
100%[==================================================================================>]
14.540 88,2K/s in 0,2s
2013-10-22 22:20:52 (88,2 KB/s) - `epel-release-6-8.noarch.rpm' saved [14540/14540]
[root@weblogic ~]# rpm -ivh epel-release-6-8.noarch.rpm
advertencia:epel-release-6-8.noarch.rpm: CabeceraV3 RSA/SHA256 Signature, ID de clave 0608b895: NOKEY
Preparando...
########################################### [100%]
1:epel-release
########################################### [100%]

Instalacin de Nagios en CentOS 6.2 | Moiss Araya

Instalar Nagios.
[root@weblogic ~]# yum install -y nagios*
Extracto
Installing : nagios-plugins-rhev-1.0.0-2.el6.noarch
91/93
Installing : nagios-plugins-apt-1.4.16-5.el6.x86_64
92/93
Installing : nagios-plugins-bdii-1.0.14-1.el6.x86_64
93/93
Installed:
nagios.x86_64 0:3.5.1-1.el6
nagios-common.x86_64 0:3.5.1-1.el6
nagios-devel.x86_64 0:3.5.1-1.el6
nagios-lcgdm.x86_64 0:0.9.4-1.el6
Dependency Installed:
dejavu-lgc-sans-mono-fonts.noarch 0:2.30-2.el6
Complete!

fping.x86_64 0:2.4b2-10.el6

Configurar Nagios

Editar archivo contacts.cfg y agregar cuenta de correo.

[root@weblogic ~]# vi /etc/nagios/objects/contacts.cfg


define contact{
contact_name
use
above)
alias

email

nagiosadmin

; Short name of user

generic-contact

Nagios Admin

; Inherit default values from generic-contact template (defined

; Full name of user

jhon_doe@acme.com

; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******

Instalacin de Nagios en CentOS 6.2 | Moiss Araya

Modificar parmetros de acceso a Nagios

Comentar las lneas 15 y 16.


Descomentar las lneas 17, 18 y 19, en esta ltima agregar las redes que tendrn acceso.

[root@weblogic ~]# vi /etc/httpd/conf.d/nagios.conf


Extracto de archivo:
<Directory "/usr/lib64/nagios/cgi-bin/">
# SSLRequireSSL
Options ExecCGI
AllowOverride None

15 # Order allow,deny
16 # Allow from all
17 Order deny,allow
18 Deny from all
19 Allow from 127.0.0.1 192.168.232.0/24
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user
</Directory>

Cambiar la password de usuario Web Nagios

Nagiosweb (ejemplo)

[root@weblogic ~]# htpasswd -c /etc/nagios/passwd nagiosadmin


New password:
Re-type new password:
Adding password for user nagiosadmin

Iniciar servicios
Iniciar servicio HTTP
[root@weblogic ~]# service httpd start
Iniciando httpd: httpd: apr_sockaddr_info_get() failed for weblogic.domain
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for
ServerName
[ OK ]
[root@weblogic ~]#

Instalacin de Nagios en CentOS 6.2 | Moiss Araya


Configurar arranque automtico

[root@weblogic ~]# chkconfig httpd --level 345 on

Activar servicio Nagios

[root@weblogic ~]# chkconfig --add nagios


[root@weblogic ~]# chkconfig nagios on

Iniciar Nagios.
[root@weblogic ~]# service nagios start
Starting nagios: done.

Verificar que los servicios estn ejecutndose.


[root@weblogic ~]# ps -fea |grep nagios
nagios 2917 1 0 00:23 ?
00:00:00 /usr/sbin/nagios -d /etc/na
gios/nagios.cfg
root 3079 2021 0 00:45 pts/0 00:00:00 grep nagios
[root@weblogic ~]# ps -fea |grep httpd
root 2888 1 0 00:23 ?
00:00:00 /usr/sbin/httpd
apache 2890 2888 0 00:23 ?
00:00:00 /usr/sbin/httpd
apache 2891 2888 0 00:23 ?
00:00:00 /usr/sbin/httpd
apache 2892 2888 0 00:23 ?
00:00:00 /usr/sbin/httpd
apache 2893 2888 0 00:23 ?
00:00:00 /usr/sbin/httpd
apache 2894 2888 0 00:23 ?
00:00:00 /usr/sbin/httpd
apache 2895 2888 0 00:23 ?
00:00:00 /usr/sbin/httpd
apache 2896 2888 0 00:23 ?
00:00:00 /usr/sbin/httpd
apache 2897 2888 0 00:23 ?
00:00:00 /usr/sbin/httpd
apache 2898 2888 0 00:23 ?
00:00:00 /usr/sbin/httpd
root 3081 2021 0 00:46 pts/0 00:00:00 grep httpd
[root@weblogic ~]#

Si el servidor tiene iptables habilitado ingresar lo siguiente:

[root@weblogic ~]# iptables -A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
[root@ weblogic ~]# service iptables save
[root@ weblogic ~]# service iptables restart
iptables: Flushing firewall rules:
[ OK ]
iptables: Setting chains to policy ACCEPT: filter
[ OK ]
iptables: Unloading modules:
[ OK ]
iptables: Applying firewall rules:
[ OK ]

Instalacin de Nagios en CentOS 6.2 | Moiss Araya

Ingresar a Nagios

Ingresar a la URL: http://ip_servidor/nagios


Ingresar credenciales nagiosadmin/nagiosweb

Clic sobre hosts para ver el detalle de lo que

Fuentes:

http://fraterneo.blogspot.com/2013/03/instalando-y-configurando-nagios-en.html
http://drivemeca.blogspot.com/2013/04/como-instalar-nagios-en-centos-64-paso.html

You might also like