[Nagios-users] any macro for viewing host parent?
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? Thanks -- John Alberts Hosted Services Exlibris USA john.albe...@exlibrisgroup.com -- 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@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
Re: [Nagios-users] any macro for viewing host parent?
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. Unfortunately this means you need to define the parent in 2 places. 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@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
Re: [Nagios-users] any macro for viewing host parent?
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. 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@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
Re: [Nagios-users] any macro for viewing host parent?
On 11/09/2010 12:55 PM, Paul M. Dubuc wrote: Unfortunately this means you need to define the parent in 2 places. Would be nice if there was built-in macro for this, but I don't think there is. Yeah, I thought about doing it this way as well, but as you said, you then have to define the parent in 2 places which can be messy and get tedious. I guess if no one else chimes in with a magical solution that we can't think of, I guess I'll be doing it this way as well. :) -- John Alberts Hosted Services Exlibris USA john.albe...@exlibrisgroup.com -- 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@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
Re: [Nagios-users] any macro for viewing host parent?
Isn't it $_HOSTPARENT_HOST$ ? 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 On Tue, Nov 9, 2010 at 7:55 PM, Paul M. Dubuc w...@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. 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@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 -- Diego Roccia diego.roccia (at) gmail (dot) com -- 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@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
Re: [Nagios-users] any macro for viewing host parent?
diego.roc...@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. Dubucw...@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@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
Re: [Nagios-users] any macro for viewing host parent?
I like the double-underscore thing :) About my advice, I performed a test and it seems you're right. I used custom vars in extra notes, check_commands, custom CGIs for RT integration, and others places, so I assumed it would have worked in this case, too On Tue, Nov 9, 2010 at 11:30 PM, Paul M. Dubuc w...@paul.dubuc.org wrote: diego.roc...@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. Dubucw...@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. -- Diego Roccia diego.roccia (at) gmail (dot) com -- 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@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