Page 3 of 8

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

Posted: Wed Nov 25, 2015 2:59 pm
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]#

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

Posted: Wed Nov 25, 2015 3:01 pm
by rkennedy
Can you post the entire /usr/local/nagios/etc/services.cfg file for us to review?

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

Posted: Wed Nov 25, 2015 3:04 pm
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

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

Posted: Wed Nov 25, 2015 3:12 pm
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.

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

Posted: Wed Nov 25, 2015 3:18 pm
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
}
~

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

Posted: Wed Nov 25, 2015 3:47 pm
by al_orange
Not sure if this helps...

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

Posted: Wed Nov 25, 2015 7:58 pm
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

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

Posted: Mon Nov 30, 2015 12:14 pm
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$
        }

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

Posted: Mon Nov 30, 2015 12:26 pm
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.

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

Posted: Mon Nov 30, 2015 1:00 pm
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. :-)