Error: Service check command...not defined anywhere!

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.
al_orange
Posts: 55
Joined: Mon Nov 23, 2015 7:27 pm

Re: Error: Service check command...not defined anywhere!

Post by al_orange »

Argh. Followed directions. Getting a different error now.

Code: Select all

[root@nagios etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
Error: Invalid service object directive 'hostname'.
Error: Could not add object property in file '/usr/local/nagios/etc/services.cfg' on line 38.
   Error processing object config files!


***> One or more problems was encountered while processing the config files...

     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.

[root@nagios etc]#
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Error: Service check command...not defined anywhere!

Post by rkennedy »

Can you post the entire /usr/local/nagios/etc/services.cfg file for us to review?
Former Nagios Employee
al_orange
Posts: 55
Joined: Mon Nov 23, 2015 7:27 pm

Re: Error: Service check command...not defined anywhere!

Post by al_orange »

rkennedy wrote:Can you post the entire /usr/local/nagios/etc/services.cfg file for us to review?

Code: Select all

define service{
        use                     generic-service
        host_name               ora_linux7_xen2.xyz.local
        service_description     CPU Load
        check_command           check_nrpe!check_load
        }

define service{
        use                     generic-service
        host_name               ora_linux7_xen2.xyz.local
        service_description     Total Processes
        check_command           check_nrpe!check_total_procs
        }

define service{
        use                     generic-service
        host_name               ora_linux7_xen2.xyz.local
        service_description     Current Users
        check_command           check_nrpe!check_users
        }

define service{
        use                     generic-service
        host_name               ora_linux7_xen2.xyz.local
        service_description     SSH Monitoring
        check_command           check_nrpe!check_ssh
        }

define service{
        use                     generic-service
        host_name               ora_linux7_xen2.xyz.local
        service_description     FTP Monitoring
        check_command           check_nrpe!check_ftp
        }

define service{
        use                     generic-service
        hostname                ora_linux7_xen2.xyz.local
        service_description     Check Swap
        check_command           check_nrpe!check_swap
        }

define service{
        use                     generic-service
        hostname                ora_linux7_xen2.xyz.local
        service_description     Check Processes
        check_command           check_nrpe!check_procs


~
"/usr/local/nagios/etc/services.cfg" 49L, 1488C
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Error: Service check command...not defined anywhere!

Post by hsmith »

Can you post the command? It looks like you are missing a lot of information in that service check.

What yours looks like:

Code: Select all

define service{
check_nrpe!check_users
What mine looks like:

Code: Select all

check_nrpe!check_users!-a '-w 5 -c 10'
Can you post the check command for check_nrpe if you haven't already? My mistake if you have, but I looked through and didn't notice it.
Former Nagios Employee.
me.
al_orange
Posts: 55
Joined: Mon Nov 23, 2015 7:27 pm

Re: Error: Service check command...not defined anywhere!

Post by al_orange »

Code: Select all

[nagios@ora_linux7_xen2 etc]$ vi /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        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       = 127.0.0.1 172.17.60.1
}
~
al_orange
Posts: 55
Joined: Mon Nov 23, 2015 7:27 pm

Re: Error: Service check command...not defined anywhere!

Post by al_orange »

Not sure if this helps...
Attachments
help.png
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Error: Service check command...not defined anywhere!

Post by Box293 »

hsmith wrote:Can you post the command? It looks like you are missing a lot of information in that service check.

What yours looks like:

Code: Select all

define service{
check_nrpe!check_users
What mine looks like:

Code: Select all

check_nrpe!check_users!-a '-w 5 -c 10'
Can you post the check command for check_nrpe if you haven't already? My mistake if you have, but I looked through and didn't notice it.
We are after the command definition for check_nrpe.

It's on your Nagios server, most likely in the file: /usr/local/nagios/etc/commands.cfg
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
al_orange
Posts: 55
Joined: Mon Nov 23, 2015 7:27 pm

Re: Error: Service check command...not defined anywhere!

Post by al_orange »

Here is my commands.cfg:

Code: Select all

###############################################################################
# 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$
        }
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Error: Service check command...not defined anywhere!

Post by hsmith »

You're not giving the check_nrpe command enough information to run. Look at my earlier post for an example.

As far as your services.cfg that you posted, change where it says hostname to host_name to make that error go away.
Former Nagios Employee.
me.
al_orange
Posts: 55
Joined: Mon Nov 23, 2015 7:27 pm

Re: Error: Service check command...not defined anywhere!

Post by al_orange »

hsmith wrote:You're not giving the check_nrpe command enough information to run. Look at my earlier post for an example.

As far as your services.cfg that you posted, change where it says hostname to host_name to make that error go away.
Thanks for all your help. This seemed to fix the issue. Now I just gotta figure out how to give the proper arguments in the check_nrpe command for the rest of the commands. :-)
Locked