Alex, 

Thanks, but I set _EMAILID in my contact definition so by echoing it in my 
script 
via defining a service that calls that script as a plugin which has a contact 
defined as test-admin 
surely I have set it. 

According to the docs, nagios prefixes custom macros with NAGIOS__CONTACT if 
it's a contact definition macro which it is. So the environment variable 
becomes  $NAGIOS__CONTACTEMAILID - note the two underlines are correct and the 
_ prefix in the definition is stripped. As documented it states it's to avoid 
name collision with $NAGIOS_<nagios_macro> such as the macro $HOSTALIAS$ would 
expand to $NAGIOS_HOSTALIAS as an environment variable that can be used in 
scripts such as eventhandlers. But I could also have _HOSTALIAS which would 
expand to NAGIOS__SERVICEHOSTALIAS to make a distinction with 
NAGIOS_HOSTALIAS... 

And as mentioned when i take that _EMAILID and put in my service definition 
instead, the same script that now does echo "EMAILID=$NAGIOS__SERVICEEMAILID" 
works but the only difference is I've moved the EMAILID from part of a contact 
definition to a service definition yet the docs supports custom macros in a 
contact definitions. 

By docs I'm referring to the documentation link on the nagios web interface and 
search for macros. 

Regards,
Deborah 
________________________________________
From: Alex Griffin [agrif...@nagios.com]
Sent: 25 April 2012 18:16
To: Nagios Users List
Subject: Re: [Nagios-users] Use of customized macro in CONTACT definition

You said you tried to echo “EMAILID=$NAGIOS__CONTACTEMAILID”, but
echoing this string will not set EMAILID to the value of
$NAGIOS_CONTACTEMAILID. You should set EMAILID, and then echo it afterwards.

Otherwise, looking over your settings they seem to be fine.

Alex Griffin
---
Tech Team
agrif...@nagios.com

Deborah Martin wrote:
> Hi,
>
> I’m trying to define a customized contact macro so that I can pass it to
> an event handler
>
> My contact definition is :-
>
> define contact{
>
> contact_name test-admin
>
> alias test-admin
>
> service_notification_period 24x7
>
> host_notification_period 24x7
>
> service_notification_options w,u,c,r
>
> host_notification_options d,u,r
>
> service_notification_commands notify-by-email
>
> host_notification_commands host-notify-by-email
>
> email deborah.mar...@kognitio.com <mailto:deborah.mar...@kognitio.com>
>
> _EMAILID deborah.mar...@kognitio.com <mailto:deborah.mar...@kognitio.com>
>
> }
>
> Then in my script test I just do echo “EMAILID=$NAGIOS__CONTACTEMAILID”
>
> This doesn’t work. But if I put the same customized macro into a service
> definition and change the test script to “EMAILID=$NAGIOS__SERVICEEMAILID”
>
> it works fine.
>
> According to the docs, I’m specifying this correctly. I’m using nagios
> 3.2.0 on SLES10.
>
> So, am I doing something that should work and is a bug and if so is it
> fixed in a later nagios version or have I done something silly here…?
>
> Thanks,
>
> Deborah
>
>
> This e-mail and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they are
> addressed. If you are not the intended recipient, please delete this
> e-mail immediately. Any unauthorised distribution or copying is strictly
> prohibited.
>
> Whilst Kognitio endeavours to prevent the transmission of viruses via
> e-mail, we cannot guarantee that any e-mail or attachment is free from
> computer viruses and you are strongly advised to undertake your own
> anti-virus precautions. Kognitio grants no warranties regarding
> performance, use or quality of any e-mail or attachment and undertakes
> no liability for loss or damage, howsoever caused.
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>
> _______________________________________________
> 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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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
This e-mail and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.  If 
you are not the intended recipient, please delete this e-mail immediately.  Any 
unauthorised distribution or copying is strictly prohibited.

Whilst Kognitio endeavours to prevent the transmission of viruses via e-mail, 
we cannot guarantee that any e-mail or attachment is free from computer viruses 
and you are strongly advised to undertake your own anti-virus precautions. 
Kognitio grants no warranties regarding performance, use or quality of any 
e-mail or attachment and undertakes no liability for loss or damage, howsoever 
caused.



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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

Reply via email to