January 4, 2021
Estimated Post Reading Time ~

NRPE Installation and Client Configuration [ Nagios ]



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]


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.