nagios

Dependencias
1-.sudo apt-get install -y apache2 libapache2-mod-php5 build-essential libgd2-xpm-dev libssl-dev apache2-utils libssl-dev xinetd

Grupos
2-.sudo groupadd -g 9000 nagios && sudo groupadd -g 9001 nagcmd && sudo useradd -u 9000 -g nagios -G nagcmd -d /usr/local/nagios -c ‘Nagios Admin’ nagios && adduser www-data nagcmd

Descargando
3-.cd /tmp/ && wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.5.1.tar.gz && sudo mv nagios-3.5.1.tar.gz /opt/ && cd /opt/

Descomprimiento
4-.tar xzf nagios-3.5.1.tar.gz && cd /opt/nagios

instalando
5-.sudo ./configure –-prefix=/usr/local/nagios -–with-nagios-user=nagios –-with-nagios-group=nagios –-with-command-user=nagios –-with-command-group=nagcmd && sudo make all && sudo make install && sudo make install-init && sudo make install-config && sudo make install-commandmode && sudo mkdir /etc/httpd && sudo mkdir /etc/httpd/conf.d && sudo make install-webconf

Creando usuario para la consola web
6-.sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin && chown nagios:nagcmd /usr/local/nagios/etc/htpasswd.users

Inicio de nagios en el boot
7-.sudo chmod +x /etc/init.d/nagios && sudo update-rc.d nagios defaults

Enable CGI-bin
8-.sudo a2enmod cgi && sudo service apache2 restart

Instalando Nagios Plugin
Al instalar el plugin podrás monitoriar los procesos de tu localhost.
9-.cd /tmp && wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz && sudo mv nagios-plugins-2.0.tar.gz /opt/ && cd /opt && sudo tar xzf nagios-plugins-2.0.tar.gz && cd /opt/nagios-plugins-2.0/ && sudo ./configure –with-nagios-user=nagios –with-nagios-group=nagios –with-openssl=/usr/bin/openssl –enable-perl-modules –enable-libtap && sudo make && sudo make install

##########################
##Pendiente de verificar##
##########################

Installation on the Host Node

First, you’ll need to install the NRPE plugin on the Nagios host node. This is the host that runs the web server and that you’ve already set up Nagios on. (If you haven’t already set up Nagios, this tutorial will help you, and you should do that first.)

To install the host side of NRPE, issue

apt-get install nagios-nrpe-plugin

fuente: http://www.cslu.ogi.edu/~zak/debianclusters/Nagios_NRPE_Addon_Installation_and_Configuration

##################################
## Instalar en el server remoto ##
##################################

On Nagios Monitoring Server
Now login into your Nagios Monitoring Server. Here you will need to do following things:
Install the check_nrpe plugin.
Create a Nagios command definition using the check_nrpe plugin.
Create Nagios host and add service definitions for monitoring the remote Linux host.
Step 1: Install NRPE Plugin
Go to the nagios download directory and download latest NRPE Plugin with wget command.

1
2
[[email protected]]# cd /root/nagios
[[email protected]]# wget http://garr.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz

Unpack the NRPE source code tarball.

1
2
3
4
5
6
[[email protected]]# tar xzf nrpe-2.15.tar.gz
[[email protected]]# cd nrpe-2.15
Compile and install the NRPE addon.
[[email protected]]# ./configure
[[email protected]]# make all
[[email protected]]# make install-daemon

Step 2: Verify NRPE Daemon Remotely
Make sure that the check_nrpe plugin can communicate with the NRPE daemon on the remote Linux host. Add the IP address in the command below with the IP address of your Remote Linux host.

1
[[email protected]]# /usr/local/nagios/libexec/check_nrpe -H <remote_linux_ip_address>

You will get a string back that shows you what version of NRPE is installed on the remote host, like this:

1
NRPE v2.15

If your receive a plugin time-out error, then check the following things.
Make sure your firewall isn’t blocking the communication between the remote host and the monitoring host.
Make sure that the NRPE daemon is installed correctly under xinetd.
Make sure that the remote Linux host firewall rules blocking the monitoring server from communicating to the NRPE daemon.

#######################################
## Instalar en el host server nagios ##
#######################################

Adding Remote Linux Host to Nagios Monitoring Server
To add a remote host you need to create a two new files “hosts.cfg” and “services.cfg” under “/usr/local/nagios/etc/” location.

1
2
3
[[email protected]]# cd /usr/local/nagios/etc/
[[email protected]]# touch hosts.cfg
[[email protected]]# touch services.cfg

Now add these two files to main Nagios configuration file. Open nagios.cfg file with any editor.

1
[[email protected]]# vi /usr/local/nagios/etc/nagios.cfg

Now add the two newly created files as shown below.
# You can specify individual object config files as shown below:

1
2
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg

Now open hosts.cfg file and add the default host template name and define remote hosts as shown below. Make sure to replace host_name, alias and address with your remote host server details.

1
[[email protected]]# vi /usr/local/nagios/etc/hosts.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
## Default Linux Host Template ##
define host{
name                            linux-box               ; Name of this template
use                             generic-host            ; Inherit default values
check_period                    24x7        
check_interval                  5      
retry_interval                  1      
max_check_attempts              10      
check_command                   check-host-alive
notification_period             24x7    
notification_interval           30      
notification_options            d,r    
contact_groups                  admins  
register                        0                       ; DONT REGISTER THIS - ITS A TEMPLATE
}

## Default
define host{
use                             linux-box               ; Inherit default values from a template
host_name                       tecmint             ; The name we're giving to this server
alias                           CentOS 6                ; A longer name for the server
address                         5.175.142.66            ; IP address of Remote Linux host
}
Next open services.cfg file add the following services to be monitored.
[[email protected]]# vi /usr/local/nagios/etc/services.cfg
define service{
        use                     generic-service
        host_name               tecmint
        service_description     CPU Load
        check_command           check_nrpe!check_load
        }

define service{
        use                     generic-service
        host_name               tecmint
        service_description     Total Processes
        check_command           check_nrpe!check_total_procs
        }

define service{
        use                     generic-service
        host_name               tecmint
        service_description     Current Users
        check_command           check_nrpe!check_users
        }

define service{
        use                     generic-service
        host_name               tecmint
        service_description     SSH Monitoring
        check_command           check_nrpe!check_ssh
        }

define service{
        use                     generic-service
        host_name               tecmint
        service_description     FTP Monitoring
        check_command           check_nrpe!check_ftp
        }

Now NRPE command definition needs to be created in commands.cfg file.

1
[[email protected]]# vi /usr/local/nagios/etc/objects/commands.cfg

Add the following NRPE command definition at the bottom of the file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
###############################################################################
# NRPE CHECK COMMAND
#
# Command to use NRPE to check remote host systems
###############################################################################

define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }
Finally, verify Nagios Configuration files for any errors.
[[email protected]]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Total Warnings: 0
Total Errors:   0

Restart Nagios:

1
[[email protected]]# service nagios restart

That’s it. Now go to Nagios Monitoring Web interface at “http://Your-server-IP-address/nagios” or “http://FQDN/nagios” and Provide the username “nagiosadmin” and password. Check that the Remote Linux Host was added and is being monitored.
Nagios Remote Host Monitoring
Nagios Remote Host Monitoring

Fuente:http://www.tecmint.com/how-to-add-linux-host-to-nagios-monitoring-server/

Instalando plugin NRPE
10-.cd /tmp/ && wget http://superb-dca3.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz && sudo mv nrpe-2.15.tar.gz /opt/ && cd /opt/ && sudo tar xzf nrpe-2.15.tar.gz && cd nrpe-2.15/ && sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so && sudo ./configure –with-ssl=/usr/bin/openssl –with-ssl-lib=/usr/lib && sudo make all && sudo make install && sudo make install-plugin && sudo make install-daemon && sudo make install-daemon-config && sudo make install-xinetd

Edite el archivo /etc/xinetd.d/nrpe y agregue la dirección IP del servidor nagios en la directiva only_from. only_from = 127.0.0.1

Agregue la siguiente entrada para el demonio NRPE en el fichero /etc/services
nrpe 5666/tcp # NRPE

Reinicie el servicio xinetd

Esta entrada fue publicada en Debian, Seguridad. Guarda el enlace permanente.

25 respuestas a nagios

  1. Pingback: sidney

  2. Pingback: brent

  3. Pingback: Jesus

  4. Pingback: casey

  5. Pingback: Michael

  6. Pingback: edwin

  7. Pingback: Mitchell

  8. Pingback: Ramon

  9. Pingback: Johnny

  10. Pingback: mark

  11. Pingback: ronald

  12. Pingback: Harvey

  13. Pingback: Wade

  14. Pingback: ernest

  15. Pingback: Jerry

  16. Pingback: gerard

  17. Pingback: darrell

  18. Pingback: Joe

  19. Pingback: Shaun

  20. Pingback: jeremiah

  21. Pingback: christian

  22. Pingback: hugh

  23. Pingback: mario

  24. Pingback: cody

  25. Pingback: Matthew

Deja un comentario