Page 1 of 1

NRPE in Nagios 2.11 to NRPE in Nagios 4.0.7

Posted: Mon Aug 11, 2014 10:09 pm
by bryceee
Hi

I am new to Linux and Nagios.
We have built a new Ubuntu server version 14.0.4 and have installed Nagios 4.0.7 and version NRPE 2.15 from source. The old version was from apt-get/RPM
Our old version of Nagios was 2.11 and is running NRPE version 2.8.1
I can log in to the Nagios GUI fine,

After I have copied over all the hosts from the old server and have included an example below.
define host {
use generic-host
host_name WFL_IFFP
alias WFL GAL Sync Server
address x.x.x.x (removed ip address)
}

define service {
host_name WFL_IFFP
service_description Standard Win2k3 Services Check
check_command nt_check_win2k3_std
use generic-service
}

When I run
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
I get alot of the following errors
Error: Service check command 'nt_check_win2k3_std' specified in service 'Standard Win2k3 Services Check' for host 'WFL_IFFP' not defined anywhere!
I know this is because I have nothing in my nrpe.cfg file.

Looking at the old nrpe,cfg file the config looks like the following
define command{
command_name nt_check_win2k3_std
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_win2k3_std
}

The new nrpe.cfg file looks completely different
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).

#include_dir=<somedirectory>
#include_dir=<someotherdirectory>



# COMMAND DEFINITIONS
# Command definitions that this daemon will run. Definitions
# are in the following format:
#
# command[<command_name>]=<command_line>
#
# When the daemon receives a request to return the results of <command_name>
# it will execute the command specified by the <command_line> argument.
#
# Unlike Nagios, the command line cannot contain macros - it must be
# typed exactly as it should be executed.
#
# Note: Any plugins that are used in the command lines must reside
# on the machine that this daemon is running on! The examples below
# assume that you have plugins installed in a /usr/local/nagios/libexec
# directory. Also note that you will have to modify the definitions below
# to match the argument format the plugins expect. Remember, these are
# examples only!


# The following examples use hardcoded command arguments...

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200


How can I get the config from the old nrpe.cfg to the new servers nrpe.cfg?

Can I just edit them and put the correct path in and copy it into the new file like so?
define command{
command_name nt_check_win2k3_std
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c nt_check_win2k3_std
}

I appreciate any assistance on how I can get the old config into the new server, if I need to change the syntax/ layout of the old nrpe.cfg that is fine. I just need to know what it should look like.
thanks in advance

Bryce

Re: NRPE in Nagios 2.11 to NRPE in Nagios 4.0.7

Posted: Tue Aug 12, 2014 5:04 pm
by sreinhardt
Yes you should be able to copy the old one from (likely) /etc/nagios3/nrpe.cfg to /usr/local/nrpe/etc/nrpe.cfg or modify the files as you see fit. Unfortunately you could have installed from source to different directories, so those paths are only a best guess, but in general should be correct.

Re: NRPE in Nagios 2.11 to NRPE in Nagios 4.0.7

Posted: Wed Aug 13, 2014 12:01 am
by bryceee
I have reinstalled nagios 4.0.7 and nrp 2.15.

I realized then i was following the nagios.sourceforge.net/docs/nrpe/NRPE.pdf, that i configured the remote host server config on the nagios monitoring box.
I have now configured the monitoring section on the monitoring box.
I have noticed that there is no nrpe.cfg on the nagios monitoring server after doing this should there be?


On the old server there is a check_nrpe.cfg and a nrpe.cfg
the check_nrpe.cfg contains
# this command runs a program $ARG1$ with arguments $ARG2$
define command {
command_name check_nrpe
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}

# this command runs a program $ARG1$ with no arguments
define command {
command_name check_nrpe_1arg
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

The sourceforge guide said to use the following
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
I have done the sorceforge method have done

and the nrpe.cfg on the old nagios monitoring server contains the following. I now realize that it probably should of been named command_definitions.cfg
# 'check_nrpe' command definition

define command{
command_name nt_check_disk_c
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_c
}

define command{
command_name nt_check_disk_d
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_d
}

define command{
command_name nt_check_disk_e
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_e
}

define command{
command_name nt_check_disk_f
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_f
}

define command{
command_name nt_check_disk_g
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_g
}

define command{
command_name nt_check_disk_h
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_h
}

define command{
command_name nt_check_disk_i
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_i
}

define command{
command_name nt_check_disk_j
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_j
}

define command{
command_name nt_check_disk_k
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_k
}

define command{
command_name nt_check_disk_l
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_l
}

I can see these commands on the existing remote machines, where do i have to look to see where nagios is referencing the nrpe.cfg on the old server?, which if i am correct is defining the commands / checks?
I appreciate any help.

Bryce

Re: NRPE in Nagios 2.11 to NRPE in Nagios 4.0.7

Posted: Wed Aug 13, 2014 4:11 am
by bryceee
I do appologise for multiple posts.

I have figured out where I need to put all the old
command definitions
define command{
command_name nt_check_disk_c
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_c
}

define command{
command_name nt_check_disk_d
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c nt_check_disk_d
}

when I add them to /usr/local/nagios/etc/objects/commands.cfg it works.
I have only added two so far.

is there away I can reference a separate file , like you do in the nagios.cfg that will have the 485 different checks to the commands.cfg?
I just figure it would be easier to edit this file that to have it in the commands.cfg file.

again I appreciate the help
Bryce

Re: NRPE in Nagios 2.11 to NRPE in Nagios 4.0.7

Posted: Wed Aug 13, 2014 4:50 pm
by abrist
bryceee wrote:is there away I can reference a separate file , like you do in the nagios.cfg that will have the 485 different checks to the commands.cfg?
Just add your commands to a separate config and the add that config to nagios.cfg in the format of:

Code: Select all

 cfg_file=<path to config>

Re: NRPE in Nagios 2.11 to NRPE in Nagios 4.0.7

Posted: Wed Aug 13, 2014 9:51 pm
by bryceee
I would just like to say thank you to everyone who provided assistance and for taking the time and patience with a Nagios and Linux newbie.
I have it working now.

Bryce

Re: NRPE in Nagios 2.11 to NRPE in Nagios 4.0.7

Posted: Thu Aug 14, 2014 9:00 am
by eloyd
The best way to say thank you is to take what you learn and pass it on to someone else.