any macro for viewing host parent?
Paul M. Dubuc
work at paul.dubuc.org
Tue Nov 9 23:30:32 CET 2010
diego.roccia at gmail.com wrote:
> Isn't it $_HOSTPARENT_HOST$ ?
Not if you put TWO underscores in front of the macro name. Then you get
$_HOST_PARENT_HOST$ which I think is much more readable (a nice suggestion I
found in Barth's book.)
> btw, in order to avoid the double declaration (and human errors) you
> could add in generic-host (ot whatever template you define)
>
> define generic-host {
> ...
> parents $_HOSTPARENT_HOST$
> }
>
> and in the real host definition you will define only the custom macro.
> Haven't tried it, but it should work
I don't think this will work because the macro isn't expanded in that context.
I think they only expand in the command object or (effectively) in arguments
in the check_command definition (because their expanded when passed to the
command).
Even if this did work it would work if all your hosts had the same parent.
All my hosts have different parents.
>
> On Tue, Nov 9, 2010 at 7:55 PM, Paul M. Dubuc<work at paul.dubuc.org> wrote:
>> Paul M. Dubuc wrote:
>>> John Alberts wrote:
>>>> I would like to have our notification emails for service alerts, include
>>>> the host parent. Â Is there any existing macro I can use to include
>>>> this? Â I couldn't find anything when googling. Â If not, any suggesions
>>>> how I might get it in an email?
>>>>
>>>
>>> The way we do this is to use a user-defined macro in the host definition like so:
>>>
>>>
>>> define host{
>>> use aps-launcher
>>> host_name APS-P52
>>>
>>> parents aps52
>>> __PARENT_HOST aps52
>>> }
>>>
>>> Then you can expand expand it, $_PARENT_HOST$, in the notification.
>>
>> I mean that would be $_HOST_PARENT_HOST$
>>
>>> Unfortunately this means you need to define the parent in 2 places. It Would be
>>> nice if there was built-in macro for this, but I don't think there is.
>>
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
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