Objective
The objective is to describe the necessary steps to a manual replication (copy) of the monitoring agent on Linux environments from the same platform, without the need to compile 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 distributions.
Solution
In order to optimize the installing process of the agent HP-UX, the OpServices has created an automated installation package, containing the NRPE + NagiosPlugins + OpServicesPlugins. For those who want to perform the installation of this package, click here and follow the steps.
For those who have any compatibility issue or are interested in doing a manual installation, just click aqui and follow the steps. However, for those who just want to perform a manual replication (copy), 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.
Troubleshooting
In case you find any problem or error during the process, find your answer in our knowledge base, clicking here.
1) 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"
2) Preparing the requirements
Copy from the source server the directory /usr/local/opmon/libexec to the same destination of the target server. Run on the target server, the commands listed below.
[root@/usr/local/opmon/libexec]# chmod 755 * [root@/usr/local/opmon/libexec]# chown opuser:users *
3) 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
4) 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;;;
5) 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 only_from = 127.0.0.1 IP_DO_OPMON
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
6) 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/xinetd456
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]# /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; 7) Testando o Acesso pelo 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_DO_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 set, 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 Plugin base by clicking here to learn more