Nagios-users digest, Vol 1 #1735 - 34 msgs

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Thu Nov 6 07:02:31 CET 2003


Dear Sir,

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

On Wed, Nov 05, 2003 at 08:19:31PM -0800, nagios-users-request at lists.sourceforge.net wrote:
> 
> Date: Wed, 5 Nov 2003 20:32:01 -0500 (EST)
> From: Subhendu Ghosh <sghosh at sghosh.org>
> To: Ashwin Kotian <ashwin_jk at yahoo.com>
> Subject: Re: [Nagios-users] Plugin to monitor/test web logins
> 
> Then you need to write your own as it will need to do some screen 
> scraping...
> 
> -sg
> On Wed, 5 Nov 2003, Ashwin Kotian wrote:
> 
> > Yes I did.....but the authentication is only with
> > regards to basic authentication such as using the
> > .htaccess method.
> > 
> > What I'm looking for is with regards to web-based
> > authentication mechanisms.
> > 
> > Thanks

If by web based auth you mean filling in a form that has a 'logon' or 
equivalent button then Mr Ghosh's advice is what you need.

In this case, the client is sending an HTTP Post with the name value 
pairs defined in the form tag of the web page.

Since you say you are not a programmer, take heart, languages like Perl, 
Python and Ruby flatter many into thinking they are.

The WWW::Automate module from CPAN seems to require only a few lines of 
Perl to do stuff eg


      use WWW::Automate;
      my $agent = WWW::Automate->new();

      $agent->get($url);

      $agent->follow($link);

      $agent->form($number);
      $agent->field($name, $value);
      $agent->click($button);

      $agent->back();

      $agent->add_header($name => $value);

      print "OK" if $agent->{content} =~ /$expected/;

(

Actually this is a mighty fine module that will do exactly what you
want: the manual page confims what the method names suggest: ->get the
page you want, parse the ->form(number that you want), ->set(username 
and password values), ->click(the logon button), ->back to the web 
server and check the content with the last statement.

Have a look at the manual page at 
http://search.cpan.org/~skud/WWW-Automate-0.20/lib/WWW/Automate.pm and 
see if you can imagine it doing what you want. I think you will be able 
to copy and paste the examples for your application.
)

It seems to me that you need either

. some code to send the HTTP POST request and process the result 

. something like the wonderful Rational Robot product to automate the
transaction and do something when it fails (the something most useful I
have seen is through the Tivoli TAPM that allows the timing of a
transaction that takes place with an arbitrary Windows client GUI -
Lotus Notes, a Java thin/thick client, anything)

A search of the web (STFW) for web automation may find other 
alternatives.

Yours sincerely.


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


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
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