Macros in notes?

Martin Melin mmelin at gmail.com
Tue Nov 16 21:33:58 CET 2010


On Tue, Nov 16, 2010 at 4:33 PM, Mark A. Lappin <MarkL at lmfj.com> wrote:
>
> What I would like to do, for my network printers, switches, routers, and some other devices, is add more information to the extended info page.  I have been playing around with notes and to get decently readable output, I end up with a bunch of ugly looking HTML which I have been duplicating on every host definition.  Trying to include printer make, model, print queue, location, primary users, toner part number etc;  routers nearest service center, circuit identifier, etc.  Works great, hard to maintain.

Agreed. IMHO information like that shouldn't be kept in the Nagios
config. A trick we've used a few times is to have a wiki installed,
then have notes_url be http://wiki/$HOSTNAME$

This also means you can let more people update information on hosts,
printers etc. without having to give them access to Nagios' configs
and reloading after each change.

>
> So I was/have been trying (unsuccessfully) to use macros in my host definition and on the template put in the more complex HTML that would fill in from the macros
>
> The below configs show what I was attempting.  I do not get any configuration warnings, I don't however get the value that I have set in the host, I get the literal output: $_HOSTprnMake$.   So I'm thinking (1) Nagios doesn't support what I'm trying to do and I can't use macros in notes   or   (2)  I have a syntax error that I'm not seeing.  I'm hoping somebody here can give me some insight into which case it might be - especially for #1 before I really start beating my head against the wall.

I'm pretty sure but haven't confirmed that all custom macro names are
converted to uppercase. If that's done when defining custom macros but
not when referring to macros, $_HOSTprnMake$ should instead be
$_HOSTPRNMAKE$. Let me know if that works.

Cheers,
Martin Melin

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
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