Skip to content

NRPE Installation and Client Configuration [ Nagios ]

Disclaimer:
This is just a custom guide to install and configure Nagios Remote Plugin Executor  on Centos 7.x, this could be more technical and advanced, if you do not understand or don’t know what you are doing, I kindly request you to take extreme caution and the components used here on GCP are billable. SKYDEVOPS/I/WE do not take any responsibility if the guide causes any serious damage or issues, which you have to take full responsibility.

Installation Guide:

  1. Installation of check_nrpe on the Nagios server
  2. Installation of NRPE on the Nagios client
  3. Installation of Plugins on the Nagios client
  4. installation od xinetd on the Nagios Client
  5. Configuration of Hosts and Services configurations on Nagios Server
  • Installation on Nagios Server
    • To Installation and configuration of Nagios Server on Centos 7.x, use the following link [ Nagios Server Installation Guide ]
    • Installation and configuration of check_nrpe:
  • Installation on Nagios Client
# Install Pre-Requesites
$ sudo yum install -y gcc glibc glibc-common openssl openssl-devel perl wget

# Download the latest NRPE
$ cd /opt
$ sudo wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.2.1/nrpe-3.2.1.tar.gz

# Extract NRPE
$ sudo tar xf nrpe-3.2.1.tar.gz

# Compile and Install NRPE
$ sudo ./configure && sudo make all && sudo make install
  • Nagios Plugin Installation on the Client
$ cd /opt
$ sudo wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
$ sudo tar xf nagios-plugins-2.2.1.tar.gz
$ cd nagios-plugins-2.2.1
$ sudo ./configure && sudo make all && sudo make install
  • Installation of xinetd super deamon on the Nagios Client

[code lang=”bash” gutter=”true” collapse=”false”]

$ sudo yum install xinetd -y

[/code]

  • configuring xinetd server

[code lang=”bash” gutter=”true” collapse=”false”]

$ sudo vi /etc/xinetd.d/nrpe

service nrpe
{
flags = REUSE
type = UNLISTED
port = 5666
socket_type = stream
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg –inetd
log_on_failure += USERID
disable = no
only_from = 10.1.0.181 135.126.11.119
}

[/code]

  • Configuration files on Nagios Client

[code lang=”bash” gutter=”true” collapse=”false”]

# Create necessary configuration files

$ sudo mkdir -p /usr/local/nagios/etc
$ sudo cp /opt/nrpe-3.2.1/sample-config/nrpe.cfg /usr/local/nagios/etc
$ sudo touch /usr/local/nagios/etc/hosts.cfg
$ sudo touch /usr/local/nagios/etc/services.cfg

[/code]

  • Added Hosts and Service config to main Nagios configuration

[code lang=”bash” gutter=”true” collapse=”false”]

# Edit the main Nagios Server config to add hosts and services confs

$ sudo vi /usr/local/nagios/etc/nagios.cfg

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

[/code]

  • Defining client configuration on the Server

[code lang=”bash” gutter=”true” collapse=”false”]

# defining hosts
define host {
use linux-server
host_name ngwebsrv
alias SKY Nginx web server
address 135.226.152.213
max_check_attempts 5
check_period 24×7
notification_interval 30
notification_period 24×7
}

[/code]

  • Defining check_nrpe command

[code lang=”bash” gutter=”true” collapse=”false”]

# Defining check_nrpe command
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

[/code]

  • Defining services for the client

[code lang=”bash” gutter=”true” collapse=”false”]

# CPU Load example
define service{
use generic-service
host_name ngwebsrv
service_description CPU Load
check_command check_nrpe!check_load
}

# USER Check example
define service{
use generic-service
host_name ngwebsrv
service_description Current Users
check_command check_nrpe!check_users
}

# Total Process
define service{
use generic-service
host_name ngwebsrv
service_description Total Processes
check_command check_nrpe!check_total_procs
}

[/code]

  • Restart the Nagios server and you can start monitoring the clients on the server

[code lang=”bash” gutter=”true” collapse=”false”]

$ sudo systemctl restart nagios

[/code]

Shashi View All

-== Superman ==-

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: