Nagios 4.3.4: Adding Ubuntu 14.0/16.0/Debian Servers/Clients to Nagios Monitoring server
This article will help us to install Ubuntu Linux client connects using the NRPE (Nagios Remote Plugin Executor) which is used to execute on the client machines and sends the status of the services to the Nagios server.
Installing Dependencies and NRPE Client.
$ sudo apt-get update $ sudo apt-get install nagios-nrpe-server nagios-plugins
Â
Configure NRPE Client on Ubuntu
We needed to edit the NRPE configuration file on the client machine for which Nagios servers accept requests if the Nagios server IP is 192.168.1.200, then add this IP to should be added to the allowed host’s list.
Edit NRPE configuration file using vi or any other editor /etc/nagios/nrpe.cfg
$ sudo vi /etc/nagios/nrpe.cfg
Find the below line and make changes below
allowed_hosts=127.0.0.1, 192.168.1.200
We can add any Nagios servers which are allowed to monitor the client with comma-separated.
Now we have to restart the NRPE service. Now it’s ready to listen to requests from the Nagios server
$ sudo /etc/init.d/nagios-nrpe-server restart
Verify Connection to NRPE Configuration.
Let’s go to your Nagios 4.3.4 server and verify that your Nagios server can communicate with NRPE client services properly.
Execute the following command from the Nagios server plugin directory, and we are assuming that your NRPE client-server IP is 192.168.1.100.
$ check_nrpe -H 192.168.1.100 NRPE v2.15
Add Commands in the NRPE client configuration file for monitoring the services.
$ sudo vi /etc/nagios/nrpe.cfg
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10 command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20 command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1 command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
Restart the NRPE client Services
Use the following commands to start/stop/restart NRPE client services.
Every time we do any changes in the configuration file we needed to restart the service
sudo service nagios-nrpe-server stop sudo service nagios-nrpe-server start sudo service nagios-nrpe-server restart
In order to monitor Linux clients, we needed to add these clients and edit 2 configuration files in the Nagios server
Login to the Nagios server
Step 1. Edit hosts.cfg file to add the Linux client and add the client configuration
# vi /usr/local/nagios/etc/hosts.cfg define host{ use                linux-box         ; Inherit default values from a template host_name           New linux   ; The name we're giving to this server alias               CentOS 6         ; A longer name for the server address            192.168.1.84        ; IP address of Remote Linux host }
Step 2. Edit services.cfg file to add the Linux client host_name to the services which we want to monitor
#vi /usr/local/nagios/etc/services.cfg define service{     use             generic-service     host_name        Testbox,{ new_linux_machine_hostname_defined in hosts.cfg }     service_description   CPU Load    check_command    check_nrpe!check_load    } define service{ use generic-service host_name Testbox service_description 0. UP-Time check_command check_nrpe!check_uptime servicegroups Uptime } define service{ use generic-service host_name Testbox service_description 1. CPU Load check_command check_nrpe!check_load } define service{ use generic-service host_name Testbox service_description 2. Total Processes check_command check_nrpe!check_total_procs } define service{ use generic-service host_name Testbox service_description 4. Disk Drive Root Partition servicegroups Disk-Space check_command check_nrpe!check_disk } define service{ use generic-service host_name Testbox service_description 5. Memory Usage check_command check_nrpe!check_mem servicegroups Memory }
Needed to add the Hostname which is given in the hosts.cfg file for the services you want to monitor
Keywords: Nagios, Monitoring, Linux host, Adding Linux host, ubuntu client, Ubuntu NRPE
- Posted In:
- Cloud
Leave a Reply