Page 1 of 2

Issue with command definition

Posted: Thu Feb 24, 2011 10:40 am
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

Re: Issue with command definition

Posted: Thu Feb 24, 2011 11:47 am
by mguthrie
Is the file that you added the command definition to included in the main nagios.cfg file?

Re: Issue with command definition

Posted: Thu Feb 24, 2011 12:07 pm
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 ...

Re: Issue with command definition

Posted: Fri Feb 25, 2011 8:16 am
by smalldragoon2
up ? anyone has an idea???

Re: Issue with command definition

Posted: Fri Feb 25, 2011 12:52 pm
by mguthrie
Can I see a sample config of one of those services that's calling the command?

Re: Issue with command definition

Posted: Sun Feb 27, 2011 3:11 pm
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 !!!

Re: Issue with command definition

Posted: Tue Mar 01, 2011 6:36 am
by smalldragoon2
up !

Re: Issue with command definition

Posted: Tue Mar 01, 2011 11:46 am
by tonyyarusso
Could you include the *service* definition in addition to the command one?

Re: Issue with command definition

Posted: Tue Mar 01, 2011 11:55 am
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
#
###############################################################################

Re: Issue with command definition

Posted: Tue Mar 01, 2011 3:03 pm
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'