Getting to Macros from script

Marc Powell mpowell at ena.com
Fri Jul 25 18:07:30 CEST 2003


No, it has nothing to do with Nagios itself. Nagios just reads the environment variable in the same way that you need to. It will be a shell environment variable available to your script in whatever manner the language you are using accesses shell environment variables. If you are using Perl, it's stuffed in %ENV and is accessible via $ENV{'REMOTE_USER'}

Spelled out --

my $logged_in_as = $ENV{'REMOTE_USER'};

This presumes, of course, that the script is beneath the same .htaccess file as the rest of the Nagios cgi's as you mention below.

--
Marc

________________________________________
From: Gary.Blydenburgh at ftid.com [mailto:Gary.Blydenburgh at ftid.com] 
Sent: Friday, July 25, 2003 10:18 AM
To: Marc Powell


Would the REMOTE_USER variable be referenced as an argument to the script in the commands.cfg file? 
If so would I refernce it as $REMOTE_USER$? 



"Marc Powell" <mpowell at ena.com> 
07/25/2003 09:28 AM 
        
        To:        "Martin, Stanley G [GMG]" <Stanley.G.Martin at mail.sprint.com>, nagios-users at lists.sourceforge.net 
        cc:        (bcc: Gary Blydenburgh/Intdata) 
        Subject:        RE: [Nagios-users] Getting to Macros from script






        -----Original Message-----
       From: Martin, Stanley G [GMG] [mailto:Stanley.G.Martin at mail.sprint.com]
       Sent: Fri 7/25/2003 8:12 AM
       To: nagios-users at lists.sourceforge.net
       Cc:
       Subject: [Nagios-users] Getting to Macros from script


        1) The Author defaults to the user logged in.  How do I get to that
       variable?

        Since Nagios uses .htaccess, it's stuffed into the CGI environment variable REMOTE_USER by the webserver and accessible by any httpd spawned process.


        2) I can run my script from one of my other websites, but when I drop it
       into the ~nagios/sbin directory, I get an execution failure.  How can I
       get my script to run from under the nagios directory structure?

        This is kind of an odd question since we didn't write your script nor do we have any idea of it's requirements. All I can suggest are basic troubleshooting ideas : verify permissions are correct, try running it as the user your web server runs as, verify paths in your script are sane and check you httpd error log for clues.



        --

        Marc 




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
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