Allow access to custom variables outside Nagios

Andreas Ericsson ae at op5.se
Mon Jun 18 10:55:07 CEST 2012


On 06/15/2012 03:13 PM, VALIYEV Ruslan wrote:
> Hi all,
> 
> We have custom variables like this:
> 
> define host { use                 linux-server host_name
> host.foo.com address             192.168.1.44 _serverfunction
> Oracle EBS R12 Application Server _serveradmin        Admins_Linux 
> _serviceadmin       Admins_Oracle _userorg            ACME }
> 
> Now we have our own script to send out the notifications. And,
> apparently, custom variables are not exported outside Nagios for
> safety.
> 

That's $USER..$ macros, and they're not exported in the UI for
security reasons (although some of them find their way there anyway
through plugin output).

> To give an example of when we’re able to get the var data: my
> $o_hostname         = $ENV{NAGIOS_HOSTNAME};
> 
> And this one doesn’t return anything: my $o_hostfunction     =
> $ENV{NAGIOS__HOSTSERVERFUNCTION};
> 

First of all, you'd be better off not using environment macros at
all. When you do use them, Nagios has to calculate ALL macros
instead of just the ones you use, and some of many of them are
quite expensive.

Secondly, try replacing your script with something that echoes the
output of 'set' and 'env' to a tempfile and see what you get there.
It's possible the documentation regarding their names is wrong.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
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 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