Expanding Custom Variables
Mike Lindsey
mike-nagios at 5dninja.net
Wed Jun 29 23:56:40 CEST 2011
On 6/29/11 12:18 PM, Stringham, Steven wrote:
> I am trying to monitor multiple volumes on a NetApp system. The
format of the command requires a
> hostname:volumename format. I want to reduce my commands/service
definitions to a minimum. My initial
> thought was to have a generic service definition, that gets more
specific with a sub definition. When the
> command is run, it seems like it is not passing the custom variable,
but rather leaving a single $ behind where
> the variable ought to be.
I'm not sure that custom macros are evaluated at the command level?
Perhaps set your command_line to pull in the variable from the service:
define service {
name NA_SnapMirror
check_command netapp_snapmirror!$_SERVICEnavolume$
use GenericService_Core
normal_check_interval 1000
max_check_attempts 300
register 0
contact_groups CoreServers
}
define service {
use NA_SnapMirror
_navolume myvolumename
service_description SnapMirror_groups
hosts myhostname
}
define command {
command_name netapp_snapmirror
command_line $USER1$/check_naf.py -H $HOSTADDRESS$ -C $USER8$
snapmirror,$HOSTNAME$:$ARG1$,$USER25$
}
...
Alternately, if you have enable_environment_macros=1 in nagios.cfg, you
could instead put "$NAGIOS__SERVICEnavolume" and pass the reference to
the script.
One of the two should work for you. If not, then I'd recommend
restarting in debug mode, debug_level=18 will get you debug information
about both the configuration load process, and the service check
execution, so you should be able to figure out the problem - just fire
it up in a reduced config set, so you only have this in there and don't
get spammed by normal operations.
What version, btw?
--
Mike Lindsey
--
Mike Lindsey
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Nagios-users mailing list
Nagios-users at 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
More information about the Users
mailing list