problem using macros

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
Tal
Posts: 12
Joined: Wed Jun 06, 2012 1:40 pm

problem using macros

Post by Tal »

Nagios Core 3.4.1
Platform Ubuntu 10.04

It seems to me that the standard macro definitions are missing from my install. I cannot find anything on how to check the available macros (resources.cfg?) Reading the http://nagios.sourceforge.net/docs/3_0/macrolist.html
$HOSTADDRESS$ is listed as a standard macro, so I do not understand why I'm getting this error:

Processing object config file '/usr/local/nagios/etc/switches/heclab_wplab_switches.cfg'...
Error: Invalid command object directive '-H'.
Error: Could not add object property in file '/usr/local/nagios/etc/switches/heclab_wplab_switches.cfg' on line 33. (Marked below in blue)
Error processing object config files!

#
# Begin HostGroup 'Switches' (Cisco)
#

define hostgroup {
hostgroup_name Switches
alias Cisco

members oak.hec.lab.stk.samuelmerritt.edu
}


# oak.hec.lab.stk.samuelmerritt.edu - {--osmatch--}

define host {
host_name oak.hec.lab.stk.samuelmerritt.edu
alias oak.hec.lab.stk
address 10.24.167.21
check_command check-host-alive
max_check_attempts 3
checks_enabled 1
failure_prediction_enabled 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 5
contact_groups admins
}

# Cisco CatOS switch (will work for 5500 and many others), full set of possible options is given:
define command {
command_name check_snmp_netint_catos
command_line check_snmp_netint.pl -2 -f -C "$USER5$" -X (my community string)
-H $HOSTADDRESS$ -N 1.3.6.1.2.1.31.1.1.1.1 --cisco=show_portnames --stp
-n $ARG1$ -w $ARG2$ -c $ARG3$ -d 200 -e -q -k -y -M -B -mm
-P $SERVICEPERFDATA$ -T $LASTSERVICECHECK$
}
define service{
use std-switch-service
servicegroups snmp,netstatistics
hostgroup_name cs2960
service_description GigabitEthernet0/1
check_command check_snmp_network_interface_cisco2960!"GigabitEthernet0/1$"!0,0,0,0,0,0!0,0,0,0,0,0
}






any help or insight would be appreciated
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: problem using macros

Post by agriffin »

The error is actually caused by the line breaks you put into your config file. You can't split up your command over multiple lines.
Tal
Posts: 12
Joined: Wed Jun 06, 2012 1:40 pm

Re: problem using macros

Post by Tal »

thanks agriffin that resolved my issue
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: problem using macros

Post by agriffin »

No problem, glad I could help!
Locked