Can plugin inherit $USER$ variable ?

Marc Powell marc at ena.com
Wed Sep 20 19:45:14 CEST 2006



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Hari Sekhon
> Sent: Wednesday, September 20, 2006 12:06 PM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Can plugin inherit $USER$ variable ?
> 
> I've written a wrapper for a plugin but would like it to inherit the
> $USER$ variable for use in the script so I don't have to hard code it.
> 
> Does anybody know if this can be done without passing it as a
parameter
> to the new plugin?

You'll need to pass any $USERx$ variables as parameters to your script
or read them directly from resource.cfg within your script. The only
other method would have been via environment variable but Nagios
specifically does not export that variable set.

http://nagios.sourceforge.net/docs/2_0/macros.html

Macros as Environment Variables

Starting with Nagios 2.0, most macros have been made available as
environment variables. This means that scripts that are run from Nagios
(i.e. service and host check commands, notification commands, etc.) can
reference these macros directly as standard environment variables. For
purposes of security and sanity, $USERn$ and "on-demand" host and
service macros are not made available as environment variables.
Environment variables that contain macros are named the same as their
corresponding macro names (listed below), with "NAGIOS_" prepended to
their names. For example, the $HOSTNAME$ macro would be available as an
environment variable named "NAGIOS_HOSTNAME".

--
Marc 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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