Tag Archive for nrpe

Nagios NPRE – Habilitando argumentos de comando

Esse how-to é para instalar o NRPE habilitando ele argumentos de comandos.

Servidor nagios

No servidor do Nagios vamos configurar o comando no nagios

Editando o /usr/local/nagios/etc/objects/commands.cfg

$ vi /usr/local/nagios/etc/objects/commands.cfg

# ‘check_nrpe’ definindo Monitormento Remoto
define command{
command_name    check_nrpe
command_line    /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$
}

define command{
command_name    check_nrpev
command_line    /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$
}

$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

$ /etc/init.d/nagios restart

Agora na máquina que vamos monitor vamos instalar o NRPE e Nagios plugins

Nagios Plugins

Criando o usuário nagios

$ useradd nagios -d /bin/false -s /bin/false

Baixando, compilando e instalando

$ cd /usr/local/src
$ wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
$ tar xfzv nagios-plugins-1.4.15.tar.gz
$ cd nagios-plugins-1.4.15
$ ./configure
$ make
$ make install

NRPE

Baixando, compilando e instalando

$ cd /usr/local/src/
$ wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
$ tar xfzv nrpe-2.12.tar.gz
$ cd nrpe-2.12

$ ./configure –disable-ssl –enable-command-args

$ make all
$ make install

Configurando

$ echo “nrpe            5666/tcp        # NRPE” >> /etc/services

$ mkdir /etc/nrpe
$ cp /usr/local/src/nrpe-2.12/sample-config/nrpe.cfg /etc/nrpe

$ vi /etc/nrpe/nrpe.cfg

##allowed_hosts=127.0.0.1
allowed_hosts=10.10.11.12

##dont_blame_nrpe=0
dont_blame_nrpe=1

# The following examples use hardcoded command arguments…

## Essas linhas vem habiltadas por padrão, desabiltar elas.
##command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
##command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
##command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
##command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
##command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200

# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to ‘1’.  This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.

command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_swap]=/usr/local/nagios/libexec/check_swap -w $ARG1$ -c $ARG2$
command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$

$ vi /etc/rc.local

# NRPE Nagios
/usr/local/nagios/bin/nrpe -c /etc/nrpe/nrpe.cfg -d