Issue with command definition

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.
smalldragoon2
Posts: 7
Joined: Wed Feb 23, 2011 3:54 am

Issue with command definition

Post by smalldragoon2 »

Hello
I'm a new user of nagios, I already managed to create multiple devices , services..etc...
Now I have an error that I don't understand

i have create a new command

define command {
command_name check_snmpv1
command_line $USER1$/check_snmp -C public -H $HOSTADDRESS$ -o $ARG1$ -w $ARG2$ -c $ARG3$ -l $ARG
5$ -u $ARG4$
}

this command is in a file ( commands.cfg ) which is read by nagios ( I'm sure of this as all the other commands are in this file ..)

I created some services with this command , but I have the following error while verifying the nagios.cfg

-------------
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/usr/local/etc/nagios/hostgroups.cfg'...
Processing object config directory '/usr/local/etc/nagios/objects'...
Processing object config file '/usr/local/etc/nagios/objects/timeperiods.cfg'...
Processing object config directory '/usr/local/etc/nagios/objects/hosts'...
Processing object config file '/usr/local/etc/nagios/objects/hosts/localhost.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/hosts/Cerber.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/hosts/Downloads.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/hosts/HP3052N.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/hosts/Free_fr_GW.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/hosts/esx01.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/hosts/esx02.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/hosts/ESX00.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/hosts/bc-mgmt1.cfg'...
Processing object config directory '/usr/local/etc/nagios/objects/services'...
Processing object config file '/usr/local/etc/nagios/objects/services/localhost.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/services/CERBER.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/services/ESX00.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/services/HP3052N.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/services/Downloads.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/services/Free_fr_GW.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/services/IBM.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/printer.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/contacts.cfg'...
Processing object config directory '/usr/local/etc/nagios/objects/backup'...
Processing object config directory '/usr/local/etc/nagios/objects/backup/services'...
Processing object config directory '/usr/local/etc/nagios/objects/backup/hosts'...
Processing object config file '/usr/local/etc/nagios/objects/templates.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/commands.cfg'...
Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Error: Service check command 'check_snmpv1' specified in service 'Chassis Cooling - Bay 1' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Chassis Cooling - Bay 2' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Domain 1: Utilization' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Domain 2: Utilization' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Module Cooling - Bay 1' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Module Cooling - Bay 1 Fans' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Module Cooling - Bay 2' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Module Cooling - Bay 2 Fans' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Module Cooling - Bay 3' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Module Cooling - Bay 3 Fans' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Module Cooling - Bay 4' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Power Module Cooling - Bay 4 Fans' for host 'bc-mgmt1' not defined anywhere!
Error: Service check command 'check_snmpv1' specified in service 'Temperature' for host 'bc-mgmt1' not defined anywhere!
Checked 34 services.
Checking hosts...
Warning: Host 'bc-mgmt1' has no default contacts or contactgroups defined!
Checked 9 hosts.
Checking host groups...
Checked 9 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 1
Total Errors: 13
------------------------

any insight ? I guess I'm missing something basic but i don't see what...
Thx
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Issue with command definition

Post by mguthrie »

Is the file that you added the command definition to included in the main nagios.cfg file?
smalldragoon2
Posts: 7
Joined: Wed Feb 23, 2011 3:54 am

Re: Issue with command definition

Post by smalldragoon2 »

yes, look at the last line
it says "Processing object config file '/usr/local/etc/nagios/objects/commands.cfg'..."

this is why I don't understand ...
smalldragoon2
Posts: 7
Joined: Wed Feb 23, 2011 3:54 am

Re: Issue with command definition

Post by smalldragoon2 »

up ? anyone has an idea???
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Issue with command definition

Post by mguthrie »

Can I see a sample config of one of those services that's calling the command?
smalldragoon2
Posts: 7
Joined: Wed Feb 23, 2011 3:54 am

Re: Issue with command definition

Post by smalldragoon2 »

Sure ! :D
here it is

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

define command {
command_name check_snmpv1
command_line $USER1$/check_snmp -C public -H $HOSTADDRESS$ -o $ARG1$ -w $ARG2$ -c $ARG3$ -l $ARG
5$ -u $ARG4$
}

check_snmp is found and available, not check_snmpv1 !!!
smalldragoon2
Posts: 7
Joined: Wed Feb 23, 2011 3:54 am

Re: Issue with command definition

Post by smalldragoon2 »

up !
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Issue with command definition

Post by tonyyarusso »

Could you include the *service* definition in addition to the command one?
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
smalldragoon2
Posts: 7
Joined: Wed Feb 23, 2011 3:54 am

Re: Issue with command definition

Post by smalldragoon2 »

here is the export of all the cfg files loaded in the direcotry services
--

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.4
# Date:       2011-02-21 12:06:05
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       Cerber
        hostgroup_name                  freebsd-servers
        service_description             ALIVE
        display_name                    ALIVE
        use                             generic-service
        check_command                   check-host-alive
        register                        1
        }

define service {
        host_name                       Cerber
        hostgroup_name                  DMZ
        service_description             SSH
        use                             generic-service
        check_command                   check_ssh
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.4
# Date:       2011-02-21 12:06:05
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       Downloads
        hostgroup_name                  windows-servers
        service_description             ALIVE
        display_name                    ALIVE
        use                             generic-service
        check_command                   check-host-alive
        max_check_attempts              3
        check_interval                  3
        retry_interval                  3
        passive_checks_enabled          1
        check_period                    24x7_sans_holidays
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.4
# Date:       2011-02-21 12:06:05
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       ESX00
        hostgroup_name                  DMZ,ESXs
        service_description             PING
        use                             generic-service
        check_command                   check_ping!100.0,20%!500.0,60%
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.4
# Date:       2011-02-21 12:06:05
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       Free_fr_GW
        hostgroup_name                  EXTERNAL
        service_description             ALIVE
        use                             generic-service
        check_command                   check-host-alive
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.4
# Date:       2011-02-21 12:06:05
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       HP3052N
        service_description             Printer alive
        use                             generic-service
        check_command                   check-host-alive
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.4
# Date:       2011-02-21 12:06:05
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       bc-mgmt1
        service_description             Chassis Cooling - Bay 1
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.3.20.0!1600:1200,2100:2600!1200:0,2600:3000!RPM!Chassis Cooling - Bay 1
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Chassis Cooling - Bay 2
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.3.21.0!1600:1200,2100:2600!1200:0,2600:3000!RPM!Chassis Cooling - Bay 2
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Domain 1: Utilization
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.1!2600:2400!2880:2600!W!Power Domain 1: Utilization
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Domain 2: Utilization
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.10.1.1.1.10.2!2600:2400!2880:2600!W!Power Domain 2: Utilization
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Module Cooling - Bay 1
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.6.1.1.6.1!6200:5400,6700:7000!5300:0,7000:7500!RPM!Power Module Cooling - Bay 1
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Module Cooling - Bay 1 Fans
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.6.1.1.4.1!2:1!1:0!Fans present!Power Module Cooling - Bay 1
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Module Cooling - Bay 2
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.6.1.1.6.2!6200:5400,6700:7000!5300:0,7000:7500!RPM!Power Module Cooling - Bay 2
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Module Cooling - Bay 2 Fans
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.6.1.1.4.2!2:1!1:0!Fans present!Power Module Cooling - Bay 2
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Module Cooling - Bay 3
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.6.1.1.6.3!6200:5400,6700:7000!5300:0,7000:7500!RPM!Power Module Cooling - Bay 3
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Module Cooling - Bay 3 Fans
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.6.1.1.4.3!2:1!1:0!Fans present!Power Module Cooling - Bay 3
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Module Cooling - Bay 4
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.6.1.1.6.2!6200:5400,6700:7000!5300:0,7000:7500!RPM!Power Module Cooling - Bay 4
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Power Module Cooling - Bay 4 Fans
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.6.1.1.4.2!2:1!1:0!Fans present!Power Module Cooling - Bay 4
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

define service {
        host_name                       bc-mgmt1
        service_description             Temperature
        use                             generic-service
        check_command                   check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.1.5.1.0!33!38!C!Input temperature
        notes                           View PNP RRD grap
        action_url                      /pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.4
# Date:       2011-02-21 12:06:05
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       localhost
        service_description             Current Load
        use                             local-service
        check_command                   check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
        register                        1
        }

define service {
        host_name                       localhost
        service_description             Current Users
        use                             local-service
        check_command                   check_local_users!20!50
        register                        1
        }

define service {
        host_name                       localhost
        service_description             HTTP
        use                             local-service
        check_command                   check_http
        notifications_enabled           0
        register                        1
        }

define service {
        host_name                       localhost
        service_description             PING
        use                             local-service
        check_command                   check_ping!100.0,20%!500.0,60%
        register                        1
        }

define service {
        host_name                       localhost
        service_description             Root Partition
        use                             local-service
        check_command                   check_local_disk!20%!10%!/
        register                        1
        }

define service {
        host_name                       localhost
        service_description             SSH
        use                             local-service
        check_command                   check_ssh
        notifications_enabled           0
        register                        1
        }

define service {
        host_name                       localhost
        service_description             Swap Usage
        use                             local-service
        check_command                   check_local_swap!20!10
        register                        1
        }

define service {
        host_name                       localhost
        service_description             Total Processes
        use                             local-service
        check_command                   check_local_procs!250!400!RSZDT
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Issue with command definition

Post by mguthrie »

Were the command configs written successfully to file with NagiosQL?

Also, if you have spaces in your arguments, try putting them into quotes and see if that makes a difference.
check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.3.20.0!1600:1200,2100:2600!1200:0,2600:3000!RPM!Chassis Cooling - Bay 1
check_snmpv1!.1.3.6.1.4.1.2.3.51.2.2.3.20.0!1600:1200,2100:2600!1200:0,2600:3000!RPM!'Chassis Cooling - Bay 1'
Locked