NRPE plugin, config check "not defined anywhere" errors.

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
fr1j0l3
Posts: 3
Joined: Thu Jul 24, 2014 2:44 pm

NRPE plugin, config check "not defined anywhere" errors.

Post by fr1j0l3 »

OK, I have the NRPE plugin installed on the nagios server, and on the remote machine I want to monitor.

I beleive I have the remote machine that the plugin is running on configured correctly, since I can run the following commands via comand line from the server, querying the remote machine, and get the right results.

(hostnames and IPs sanitized)

Code: Select all

blackbox (linux) # /usr/local/nagios/libexec/check_nrpe -H (remoteIPADDRESS) -c check_swap
SWAP OK - 100% free (8003 MB out of 8015 MB) |swap=8003MB;1603;801;0;8015
blackbox (linux) # /usr/local/nagios/libexec/check_nrpe -H (remoteIPADDRESS) -c check_load
OK - load average: 0.06, 0.16, 0.17|load1=0.060;15.000;30.000;0; load5=0.160;10.000;25.000;0; load15=0.170;5.000;20.000;0; 
blackbox (linux) # /usr/local/nagios/libexec/check_nrpe -H (remoteIPADDRESS) -c check_total_procs
PROCS CRITICAL: 345 processes | procs=345;150;200;0;
blackbox (linux) # 
So it looks like it is grabbing the correct values from the remote machine.

I think I am good to go, I setup the commands.cfg and the other configs:

Here's linux-box.cfg:

Code: Select all

blackbox (linux) # cat linux-box.cfg 
## Modified Linux Host Template ##
define host{
name                            linux-box               ; Name of this template
use                             generic-host            ; Inherit default values
check_period                    24x7        
check_interval                  5       
retry_interval                  1       
max_check_attempts              10      
check_command                   check-host-alive
notification_period             24x7    
notification_interval           30      
notification_options            d,r     
contact_groups                  admins  
register                        0                       ; DONT REGISTER THIS - ITS A TEMPLATE
}

## Default
define host{
use                             linux-box               ; Inherit default values from a template
host_name                       s000000		        ; The name we're giving to this server
alias                           BeanStation             ; A longer name for the server
address                         xxx.xxx.xx.xxx            ; IP address of Remote Linux host
}
define service{
        use                     generic-service
        host_name               s000000
        service_description     CPU Load
        check_command           check_nrpe!check_load
        }

define service{
        use                     generic-service
        host_name               s000000
        service_description     Total Processes
        check_command           check_nrpe!check_total_procs
        }

define service{
        use                     generic-service
        host_name               s000000
        service_description     Current Users
        check_command           check_nrpe!check_users
        }

define service{
        use                     generic-service
        host_name               s000000
        service_description     disk  Monitoring
        check_command           check_nrpe!check_disk_root
        }

define service{
        use                     generic-service
        host_name               s000000
        service_description     swap Monitoring
        check_command           check_nrpe!check_swap
        }

So that looks ok to me, I added this line to the nagios.cfg:

Code: Select all

cfg_file=/usr/local/nagios/etc/linux-box.cfg
And then here are the contents of the commands.cfg file:

Code: Select all

blackbox (linux) # cat commands.cfg 
###############################################################################
# NRPE CHECK COMMAND
#
# Command to use NRPE to check remote host systems
###############################################################################

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

blackbox (linux) # 
The $USER1 variable(?) is setup in the resource.cfg file (looks right?)

Code: Select all

# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/local/nagios/libexec


yet, when I try to run a verify on the config, I get all these errors.

Code: Select all

blackbox (linux) # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 

Nagios Core 4.0.7
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 06-03-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
Error: Service check command 'check_nrpe!check_load' specified in service 'CPU Load' for host 's00000' not defined anywhere!
Error: Service check command 'check_nrpe!check_users' specified in service 'Current Users' for host 's000000' not defined anywhere!
Error: Service check command 'check_nrpe!check_total_procs' specified in service 'Total Processes' for host 's000000' not defined anywhere!
Error: Service check command 'check_nrpe!check_disk_root' specified in service 'disk  Monitoring' for host 's000000' not defined anywhere!
Error: Service check command 'check_nrpe!check_swap' specified in service 'swap Monitoring' for host 's0000000' not defined anywhere!
	Checked 13 services.
	Checked 2 hosts.
	Checked 1 host groups.
	Checked 0 service groups.
	Checked 1 contacts.
	Checked 1 contact groups.
	Checked 24 commands.
	Checked 5 time periods.
	Checked 0 host escalations.
	Checked 0 service escalations.
Checking for circular paths...
	Checked 2 hosts
	Checked 0 service dependencies
	Checked 0 host dependencies
	Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   5

***> One or more problems was encountered while running the pre-flight check...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.


I'm drawing a blank, I feel like I may have mis-typed something, or is there some other glaring error I have omitted?

Thanks for reading this wall.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE plugin, config check "not defined anywhere" errors.

Post by abrist »

Could you check the permissions on the config files?

Code: Select all

ls -la /usr/local/nagios/etc
ls -la /usr/local/nagios/etc/objects
Also, lets check for the folder/file directives:

Code: Select all

grep cfg /usr/local/nagios/etc/nagios.cfg
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
fr1j0l3
Posts: 3
Joined: Thu Jul 24, 2014 2:44 pm

Re: NRPE plugin, config check "not defined anywhere" errors.

Post by fr1j0l3 »

Permissions seem to be ok:

Code: Select all

blackbox (linux) # ls -la /usr/local/nagios/etc/
total 108
drwxrwxr-x. 3 ppit-nagios ppit-nagcmd  4096 Jul 24 16:00 .
drwxr-xr-x. 9 ppit-nagios ppit-nagcmd  4096 Jul 17 15:11 ..
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd 12015 Jul 17 14:32 cgi.cfg
-rw-r--r--. 1 ppit-nagios ppit-nagcmd   340 Jul 21 10:41 commands.cfg
-rw-r--r--. 1 ppit-nagios ppit-nagcmd  1075 Jul 21 10:40 hosts.cfg
-rw-r--r--. 1 ppit-nagios ppit-nagcmd    26 Jul 17 14:40 htpasswd.users
-rw-r--r--. 1 ppit-nagios ppit-nagcmd  2166 Jul 21 15:37 linux-box.cfg
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd 44585 Jul 21 15:37 nagios.cfg
drwxrwxr-x. 2 ppit-nagios ppit-nagcmd  4096 Jul 17 14:38 objects
-rw-rw----. 1 ppit-nagios ppit-nagcmd  1312 Jul 17 14:32 resource.cfg
-rw-r--r--. 1 root        root        15254 Jul 24 16:00 root_history.txt
-rw-r--r--. 1 ppit-nagios ppit-nagcmd  1089 Jul 21 14:57 services.cfg
blackbox (linux) # ls -la /usr/local/nagios/etc/objects/
total 56
drwxrwxr-x. 2 ppit-nagios ppit-nagcmd  4096 Jul 17 14:38 .
drwxrwxr-x. 3 ppit-nagios ppit-nagcmd  4096 Jul 24 16:00 ..
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd  7688 Jul 17 14:32 commands.cfg
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd  2143 Jul 17 14:38 contacts.cfg
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd  5375 Jul 17 14:32 localhost.cfg
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd  3096 Jul 17 14:32 printer.cfg
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd  3265 Jul 17 14:32 switch.cfg
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd 10621 Jul 17 14:32 templates.cfg
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd  3180 Jul 17 14:32 timeperiods.cfg
-rw-rw-r--. 1 ppit-nagios ppit-nagcmd  3991 Jul 17 14:32 windows.cfg
blackbox (linux) # 

here's the grep listing, I can't tell if anything is wrong here.

Code: Select all

blackbox (linux) # grep cfg /usr/local/nagios/etc/nagios.cfg 
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/linux-box.cfg
#cfg_file=/usr/local/nagios/etc/services.cfg
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg
# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
#cfg_dir=/usr/local/nagios/etc/servers
#cfg_dir=/usr/local/nagios/etc/printers
#cfg_dir=/usr/local/nagios/etc/switches
#cfg_dir=/usr/local/nagios/etc/routers
# object configuration files (see the cfg_file and cfg_dir options above).
resource_file=/usr/local/nagios/etc/resource.cfg
blackbox (linux) # 
The thing that sticks out to me is that I can run the commands on their own, it just dies on the config check. :?:
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: NRPE plugin, config check "not defined anywhere" errors.

Post by eloyd »

I'll bet you twenty bucks the problem is in the "grep cfg /usr/local/nagios/etc/nagios.cfg" output. Andy's on the right trail. It looks like Nagios is not including your commands.cfg file, which means - most likely - your config file settings are incorrect or your commands.cfg file is in the wrong location.

Fundamentally, Nagios is not able to parse the files that it needs to find the commands, even though it looks like you have the right settings.

When you run the check_nrpe command manually, are you doing it as root or as the ppit-nagios user?

Is root running the nagios service or is the ppit-nagios user?
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
fr1j0l3
Posts: 3
Joined: Thu Jul 24, 2014 2:44 pm

Re: NRPE plugin, config check "not defined anywhere" errors.

Post by fr1j0l3 »

Good points.

I was running it manually as root, (also running the config check as root).

I won't have a chance to check the system again until next week, will try to follow up then.

thanks.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: NRPE plugin, config check "not defined anywhere" errors.

Post by tmcdonald »

Any update on this?
Former Nagios employee
Locked