1. Home /
  2. Downloads /
  3. Agents /
  4. Linux /
  5. Installing the Agente on a Linux Patform (Manually)

Installing the Agente on a Linux Patform (Manually)

 

Objective

The objecte is to describe the procedures to a manual installation  of the monitoring agent on Linux, platforms, in order to monitor with the OpMon.

Target audience

It is intended for OpMon administrators and for IT teams that are already familiar with the installation of Linux apps and with the configurations of the OpMon in order to monitor equipment that are running with RedHat, CentOS, Ubuntu, Suse, among other distribuitions.

Solution

In order the optimize the installing process of the agent HP-UX, the OpServices has created an automatedinstalling package, containing the NRPE + NagiosPlugins + OpServicesPlugins. For those who want to performthe installation of this package, click here and follow the steps.

It is possible to replicate the agent if you already have the agent installed on a certain distribuition and want to replicate it to another. For example, if you already have the agent installed on a CentOS and want to replicate it on another CentOS without any installation process, just click here and follow the steps. For those who want to perform the installation manually, follow the steps below.

The agent must be installed on the target Linux machine and afterwards configured on the OpMon, making it thus possible to monitor system metrics, services, processes, performance data, among others. In order to conduct the installation process, the files NRPE and NagiosPlugins will be used, which may be downloaded, as of their latest version, on the following address:

Download  The download link is available on the NRPE page:  [ NRPE ]

Download  The download link is available on the NagiosPlugins page: [ NagiosPlugins ]

Troubleshooting

In case you find any problem or error during the process, find your answer in our knowledge base, clicking here.

1) Obtaining the Agent

Logging as the root of the target server and later download the files, as shown below:

[root@localhost]# cd /tmp
[root@localhost tmp]# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
[root@localhost tmp]# wget --no-check-certificate https://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz

2) Creating a user

It is necessary to create a user, normally with the following definitions: opuser, according to the example given below.

[root@localhost tmp]# adduser opuser -d /usr/local/opmon -g users -s /bin/bash -c "OpMon NRPE"
[root@localhost tmp]# passwd opuser

Remember to set a secure password for this user, or create without permission to log in to the system using this command below:

[root@localhost tmp]# adduser opuser -d /usr/local/opmon -g users -s /sbin/nologin -c "OpMon NRPE"

3) Preparing the requirements

Some packages are required for the installation, they are:

gcc, openssl, net-snmp e xinetd

Therefore, based on a RedHat or a CentOS installation, use the following command to install:

[root@localhost tmp]# yum install gcc openssl-devel net-snmp-utilis xinetd -y

Afterwards, we will adjust the xinetd to run the boot, once it will be important in this process:

[root@localhost tmp]# chkconfig --level 2345 xinetd on

To unpack the packages previously obtained by downloading, we will use the same temporary folder and follow the steps as shown below:

[root@localhost tmp]# cd /tmp 
[root@localhost tmp]# tar xvfz nagios-plugins-1.4.16.tar.gz 
[root@localhost tmp]# tar xvfz nrpe-2.13.tar.gz

4) Installing the Plugins 

On the nagios-plugins directory created, you have to run the following command listed below:

[root@localhost tmp]# cd nagios-plugins-1.4.16
[root@localhost nagios-plugins-1.4.16]# ./configure --prefix=/usr/local/opmon --with-nagios-user=opuser --with-nagios-group=users

If no errors are found, run the “make” commands shown below on the same directory.

[root@localhost nagios-plugins-1.4.16]# make all ; make install

If all goes well, the following folder containing plugins will be created: /usr/local/opmon/libexec 

5) Installing the NRPE

On the created nrpe directory, run the following command as listed below.

[root@localhost nagios-plugins-1.4.16]# cd ../nrpe-2.13
[root@localhost nrpe-2.13]# ./configure --prefix=/usr/local/opmon --with-nrpe-user=opuser --with-nagios-user=opuser --with-nrpe-group=users --with-nagios-group=users --enable-command-args

If all goes well, run the “make” commands shown below on the same directory.

[root@localhost nrpe-2.13]# make all

In order to install the check_nrpe and the nrpe.

[root@localhost nrpe-2.13]# make install

In order to install the nrpe.cfg.

[root@localhost nrpe-2.13]# make install-daemon-config

In order to install the  xinetd.

[root@localhost nrpe-2.13]# make install-xinetd

6) Fine adjustments 

To get an easier setup, we will adjust the nrpe allowing it the use of arguments.

[root@localhost]# vim /usr/local/opmon/etc/nrpe.cfg

Look for the dont_blame_nrpe file and change it to 1.

dont_blame_nrpe=1

Change the permission of the directory for the opuser user.

[root@localhost]# chown -R opuser:users /usr/local/opmon/

Insert the following line at the end of the file /etc/services. 

[root@localhost]# vim /etc/services
nrpe        5666/tcp      # OpMon  Agent

7) Testing the Plugins 

To validate whether the plugins are working, some tests are necessary. Once everything is correct, the result displayed must be similar to the one below:

[root@localhost]# cd /usr/local/opmon/libexec/
[root@localhost libexec]# ./check_load
check_load: Could not parse arguments
Usage:
check_load [-r] -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15
[root@localhost libexec]# ./check_http -H www.google.com 
HTTP OK: HTTP/1.1 302 Found - 1009 bytes in 0.219 second response time |time=0.218719s;;;0.000000 size=1009B;;;

8) Starting the Agent

Basically there are 3 options to initialize the agent:  xinetd (recommended), inetd or daemon.

  • To initialize with the xinetd

To allow the OpMon to perform the monitoring, we need to release its IP for queries, thus, we need to edit the file, adding the IP  on line only_from. You can also add more IPs or used range. For example: OPMNON_IP24. If you want to release any IP, just remove the only_from line. [root@localhost]# vim /etc/xinetd.d/nrpe

[root@localhost]# vim /etc/xinetd.d/nrpe
service nrpe
{
 flags = REUSE
 socket_type = stream
 wait = no
 only_from = 127.0.0.1 IP_DO_OPMON
 user = opuser
 server = /usr/local/opmon/libexec/nrpe
 server_args = -c /usr/local/opmon/libexec/nrpe.cfg --inetd
 log_on_failure += USERID
 disable = no
}

To conclude, restart the xinetd

[root@localhost ]# service xinetd restart
Stopping xinetd:                  [ OK ]
Starting xinetd:                  [ OK ]
  • To initialize with the inetd

Insert the following line on the file /etc/inetd/.conf .

[root@localhost]# vim /etc/inetd.conf
nrpe stream tcp nowait opuser /usr/sbin/tcpd  /usr/local/opmon/bin/nrpe -c /usr/local/opmon/etc/nrpe.cfg --inetd

To conclude, restart the  inetd.

[root@localhost libexec]# service inetd restart
Stopping inetd:                    [ OK ] 
Starting inetd:                    [ OK ]
  • To initialize with the daemon

To allow the OpMon to perform the monitoring, we need to release its IP for queries, thus, we need to edit the file, adding the IP on line allowed_hosts. You can also add more IPs or used range. For example: OPMNON_IP24. If you want to release any IP, just remove the allowed_hosts line.

[root@localhost]# vim /usr/local/opmon/etc/nrpe.cfg
allowed_hosts=127.0.0.1,IP_DO_OPMON

To conclude, restart the  daemon

[root@localhost]# /usr/local/opmon/bin/nrpe -c /usr/local/opmon/etc/nrpe.cfg -d

9) Testing the  access locally

To verify if the port 5666 is available for connections, use the following command and check if the output is similar to the one below:

[root@localhost]# netstat -vantup | grep 5666
tcp 0 0 0.0.0.0:5666   0.0.0.0:*   LISTEN 2202/xinetd

To verify the communication of the NRPE:

[root@localhost]# /usr/local/opmon/libexec/check_nrpe -H 127.0.0.1
NRPE v2.13

Running a query load through the NRPE.

[root@localhost nrpe-2.13]# /usr/local/opmon/libexec/check_nrpe -H 127.0.0.1 -c check_load -a none
OK - load average: 0.02, 0.03, 0.00|load1=0.020;15.000;30.000;0;load5=0.030;10.000;25.000;0; load15=0.000;5.000;20.000;0;

10) Testing the access through the OpMon

From the console of the OpMon, it is possible to verify the NRPE communication when the following command is executed, setting the IP_DO_SERVIDOR where the agent was installed.

[root@opmon]# /usr/local/opmon/libexec/check_nrpe -H IP_DO_SERVIDOR
NRPE v2.13

Running a query load through the NRPE.

[root@opmon]# /usr/local/opmon/libexec/check_nrpe-H IP_SERVIDOR -c check_load -a none 
OK - load average: 0.02,0.03,0.00|load1=0.020;15.000;30.000;0;load5=0.030;10.000;25.000;0;load15=0.000;5.000;20.000;0;

All right, what now?

After completing the installation process, the next step is to have the server start monitoring. In order to do so, you can access our Plugins and Templates base by clicking here to learn more.

Updated on 01/09/2021

Was this article helpful?

Ficou com alguma dúvida?

Perguntas & Respostas

Participe da nossa comunidade e tire dúvidas ou compartilhe respostas e ideias.

Participar

Professional Support

Não encontrou a resposta que procura? Não se preocupe, estamos aqui para ajudar!

Abrir chamado

Treinamento Online

Através da plataforma Udemy, você encontra todos os treinamentos das nossas soluções.

Inscreva-se