availability reporting.

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Sat Feb 28 08:19:39 CET 2004


Dear Sir,

I am writing to thank you for your letter and say,

> From: "Neil" <neil-on-nagios at restricted.dyndns.org>
> Date: Fri, 27 Feb 2004 02:07:28 -0600
> Subject: [Nagios-users] availability reporting
> 
> Hey guys, 
> 
> Someone before suggested to me to use wget or lynx to get availability of a 
> host. I tried copying the URL from the nagios webpage, and I was able to 
> extract the report. Problem is, when I load the generated .html page, I get 
> and authentication prompt. I opened the source and found out that it could 
> be the link to css style sheets that's triggering it from prompting an 
> authentication window. 
>

why not supply the credentials to lynx like so (in the programming
language of champions 'P-e-r-l')

my $lynx_cmd  = $lynx_path . ' -auth=' . $pwstring . q( -dump -nolist
-width=132 'http://localhost/nagios/cgi-bin/avail.cgi) ?
   $lynx_cmd .= '?' . eval($qs) . q(') ;
    my @avail_rep = `$lynx_cmd` ;

where $qs is the actual set of name value pairs your browser would
append to the cgi path and $pwstring is 'User_Foo:Foo_password'.

But this is only suitable for dumping the content if you want to mail
it periodically or view in glorious mononchrome.

> Anyways, can someone here provide an URL that I can use with lynx, wget or 
> fetch in my crontab? And how do I get nice colors without having the css 
> style sheet point to a path? 

This approach is more colourful but still doesn't allow for the 

- initial drag in of the CSSs or

- anything alse the report includes

However as long as you start by browsing a Nag page, this looks like the
real thing.

   my $avail_cgi = '/usr/local/nagios/sbin/avail.cgi' ;
    $ENV{'REQUEST_METHOD'} = 'GET' ;
    $ENV{'REMOTE_USER'}    = 'foo' ;
    $ENV{'QUERY_STRING'} = eval $qs ;
    my @html = `$avail_cgi` ;
    print @html ;

This is within a Perl (CGI module) script. It depends heavily on the
Nagios::Config module on CPAN to parse the service and host names from
the Nag config so they can be put in chooser boxes to generate the query
string ($qs above).

Please, I mention this because I thought it could help you along
only. The script I use is unfit for human consumption so I would rather
not share it.

If you can interest someone in providing a 'management fulfilling
experience' in connecting Nag to Cry&*_l R(&#@rts (this is a family
program) or E!!el, you will do the project a great favour and send
Tivoli share prices tumbling.

> 
> Or, you can share the way you approached this requirement. :) 
>
 
> Thanks, 
> 
> Ronneil 
> 

-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
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