Are user macros allowed in custom object variables?
Posted: Fri Oct 28, 2011 12:25 pm
When I try to use a $USERn$ macro as a value in a _CUSTOM_VAR, it doesn't work. In the example below, the method that doesn't work tries to send a $ as the community string. Are the $'s in the custom variable value being scrubbed or cleaned or something?
# This works--------------------------------------------
host.cfg:
define host{
use generic-switch
host_name switch01.domain.com
alias A switch
address 1.2.3.4
hostgroups switches
parents router01.domain.com
_SNMP_COMMUNITY public
}
service.cfg:
define service{
use generic-service
hostgroup_name switches
service_description Uptime
check_command check_snmp!-C $_HOSTSNMP_COMMUNITY$ -o sysUpTime.0
}
command.cfg:
define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}
# This does not-----------------------------------------
resource.cfg:
$USER6$=public
host.cfg:
define host{
use generic-switch
host_name switch01.domain.com
alias A switch
address 1.2.3.4
hostgroups switches
parents router01.domain.com
_SNMP_COMMUNITY $USER6$
}
service.cfg:
define service{
use generic-service
hostgroup_name switches
service_description Uptime
check_command check_snmp!-C $_HOSTSNMP_COMMUNITY$ -o sysUpTime.0
}
command.cfg:
define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}
# This works--------------------------------------------
host.cfg:
define host{
use generic-switch
host_name switch01.domain.com
alias A switch
address 1.2.3.4
hostgroups switches
parents router01.domain.com
_SNMP_COMMUNITY public
}
service.cfg:
define service{
use generic-service
hostgroup_name switches
service_description Uptime
check_command check_snmp!-C $_HOSTSNMP_COMMUNITY$ -o sysUpTime.0
}
command.cfg:
define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}
# This does not-----------------------------------------
resource.cfg:
$USER6$=public
host.cfg:
define host{
use generic-switch
host_name switch01.domain.com
alias A switch
address 1.2.3.4
hostgroups switches
parents router01.domain.com
_SNMP_COMMUNITY $USER6$
}
service.cfg:
define service{
use generic-service
hostgroup_name switches
service_description Uptime
check_command check_snmp!-C $_HOSTSNMP_COMMUNITY$ -o sysUpTime.0
}
command.cfg:
define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}