Macros in notes?
Paul M. Dubuc
work at paul.dubuc.org
Tue Nov 16 21:44:27 CET 2010
Mark A. Lappin 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.
>
> 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.
It's #1. Nagios only supports macro expansion for command objects (maybe
others I don't know). Using macro expansions will work in the arguments (if
any) that you pass to the check_command because they're expanded for the
command object.
Being able to do what you are trying to do here would be nice. I would like
to use macros for constructing host and service names.
>
> define host{
> use generic-printer
> host_name 11314-AR
> alias 11314-AR-4200N
> address 192.168.98.31
> action_url http://192.168.98.31
> hostgroups network-printers
> _prnMake HP
> _prnModel Laserjet 2300n
> _prnMainQueue "\\\\lmfj-print\\11314-AR"
> }
>
>
> define host{
> name generic-printer ; The name of this host template
> use generic-host ; Inherit default values from the generic-host template
> check_period 24x7 ; By default, printers are monitored round the clock
> check_interval 5 ; Actively check the printer every 5 minutes
> retry_interval 1 ; Schedule host check retries at 1 minute intervals
> max_check_attempts 10 ; Check each printer 10 times (max)
> check_command check-host-alive ; Default command to check if printers are "alive"
> notification_period workhours ; Printers are only used during the workday
> notification_interval 30 ; Resend notifications every 30 minutes
> notification_options d,r ; Only send notifications for specific host states
> contact_groups admins ; Notifications get sent to the admins by default
> register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE
> notes<table border=1 width=100% cellpadding=3 cellspacing=0 bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#000000">\
> <tr bgcolor="lightblue"><td align="center">Make</td></tr>\
> <tr><td align="center">$_HOSTprnMake$</td></tr>\
> </table>
> }
>
>
> Any advice/input is very much appreciated.
>
> --Mark
>
>
>
> Mark A. Lappin, CCNA, MCITP: Enterprise Administrator | Lee Michaels Fine Jewelry
> Director of Information Technology
> 11314 Cloverland Ave | Baton Rouge, LA 70809
> Ph: 225.291.9094 ext 245 | Fax: 225.368.3675 | Mobile: 225-362-2770
> www.lmfj.com
>
------------------------------------------------------------------------------
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