Are macros allowed to be used inside custom variables?  I'm using Nagios 
3.2.3.  I was experimenting with using custom variables in host 
definitions for clusters.  I couldn't figure out if there was a way to 
make this work.

It didn't seem to matter how I escaped the $s or not, whether I used 
$_hostwarn$ or just $_warn$, or if I defined new commands with the 
custom variables in place of $ARGn$.

I already have cluster checks which don't use custom variables and work 
fine, and other service checks which use custom variables from the host 
for parameters and also work fine.

One of my working cluster checks returns this:
CLUSTER OK: dmz_cluster_1: 3 ok, 0 warning, 0 unknown, 0 critical

However, I set up another check for the same cluster using custom 
variables, and it returns this instead:
CLUSTER CRITICAL: dmz_cluster_1_foo: 1 ok, 0 warning, 0 unknown, 0 critical

Here's an example of what I was trying to accomplish:

define host {
        use             esx-server
        name            esx-cluster
        host_groups     esx_clusters
        check_command   check_cluster!host!@$_warn$:!@$_crit$:!$_hostcluster$
        register        0
}

define host {
        use             esx-cluster
        host_name       esx_cluster_1
        alias           esx_cluster_1
        parents         parent1,parent2,parent3
        _warn           1
        _crit           2
        _hostcluster 
$HOSTSTATEID:parent1$,$HOSTSTATEID:parent2$,$HOSTSTATEID:parent3$
        _servicecluster 
$SERVICESTATEID:parent1:Ping$,$SERVICESTATEID:parent2:Ping$,$SERVICESTATEID:parent3:Ping$
}

define service {
        use                     standard_service
        host_name               esx_cluster_1
        service_description     cluster_health
        display_name            cluster_health
        check_command           
check_cluster!service!@$_warn$:!@$_crit$:!$_servicecluster$
}

define command {
        command_name    check_cluster
        command_line    $USER1$/check_cluster --$ARG1$ --label=$HOSTNAME$ 
--warning=$ARG2$ --critical=$ARG3$ --data=$ARG4$
}


-- 
-Chris

Nothing in this message is intended to make or accept an offer or to form a 
contract, except that an attachment that is an image of a contract bearing the 
signature of an officer of our company may be or become a contract. This 
message (including any attachments) is intended only for the use of the 
individual or entity to whom it is addressed. It may contain information that 
is non-public, proprietary, privileged, confidential, and exempt from 
disclosure under applicable law or may constitute as attorney work product. If 
you are not the intended recipient, we hereby notify you that any use, 
dissemination, distribution, or copying of this message is strictly prohibited. 
If you have received this message in error, please notify us immediately by 
telephone and delete this message immediately.

Thank you.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to