search instagram arrow-down





NagiOS is a tool used to monitor IT infrastructure. In Server:

apt-get install -y nagios3 nagios-nrpe-plugin

site will be available at: http://localhost/nagios3.

cd /etc/nagios3/conf.d

On Client side: (Install NPRE)

apt-get install -y nagios-plugins nagios-nrpe-server

This next step is where you get to specify any manual commands that Monitoring server can send via NRPE to these client hosts.

Make sure to change allowed_hosts to your own values.

allowed_hosts=<Nagios Server IP>

Edit /etc/nagios/nrpe.cfg

service nagios-nrpe-server restart

Add Server Configurations on Monitoring Server


define host {
use generic-host
host_name lp
alias lp

define service {
use generic-service
host_name lp
service_description PING
check_command check_ping!100.0,20%!500.0,60%

define service {
use generic-service
host_name lp
service_description SSH
check_command check_ssh
notifications_enabled 0

define service {
use generic-service
host_name lp
service_description Current Load
check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0

define service{
use generic-service ; Name of service template to use
host_name lp
service_description Disk Space
check_command check_all_disks!20%!10%

define service{
use generic-service ; Name of service template to use
host_name lp
service_description chekc snmp
check_command snmp_procname
#check_command check_snmp -H -c public -o .

service nagios3 restart

start monitoring the client.

For easy deployment you can also use jumpbox Nagios also available on AWS.

Basic Troubleshooting:
Enabling External Commands in Nagios / Ubuntu (If you catch the error:Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!)
service nagios3 stop
dpkg-statoverride –update –add nagios www-data 2710 /var/lib/nagios3/rw
dpkg-statoverride –update –add nagios nagios 751 /var/lib/nagios3
service nagios3 start

Custom Command and Service for hostname.cfg:

define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C public -o $ARG1$

define service{
use generic-service
host_name lp2
service_description Memory
check_command check_snmp!.

The First and second arguments are already in command definition we only need to add the OID which is last arguments with exclamation mark ( !) before it.

NRPE – Nagios Remote Plugin Executor
It is used to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.). NRPE can also communicate with some of the Windows agent addons, so you can execute scripts and check metrics on remote Windows machines as well.
Example of NSPE:
Things to consider:
configuration file: /etc/nagios/nrpe.cfg:
dont_blame_nrpe=1 (To pass the optional command arguments to the nagios plugins)
Uncomment the following if you want to monitor these:

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_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
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

(Note command[check_disk] and /usr/lib/nagios/plugins/check_disk check_disk name should match on both side.)
Example of setting the service in Server:
vi lp2.cfg

define command {
command_name check_nrpe_load
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c “check_disk”

define service {
use generic-service
# hostgroup_name nrpe-services
host_name lp2
service_description My Disk space
check_command check_nrpe_load


Click to access NRPE-Troubleshooting-and-Common-Solutions.pdf

Leave a Reply
Your email address will not be published. Required fields are marked *

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: