Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Guys,

I've tried to read up on possible soln(s) but can't seem to find what I'm looking for.
Also, I'm not a front-end guy, so have no understanding of eg javascript and associated techniques/jargon; strictly a back-end programmer.

Anyway, we want to setup an http check from a nagios server (no gui) to login to a remote website/page and time how long it takes.
Problem is that from a browser, using show src, there seems to be no difference whether logged in or not.
It appears (see below) that the username/passwd area is inside a frame loaded by javascript. (I think?)
Hopefully the below will help explain, obfuscated where reqd.

<title>My Frame</title> <script type="text/javascript"> function frameLoad() { var frame = document.getElementById('my-frame'); blah blah } more stuff ... <div id="content"> <div class="padded"> <iframe id="my-frame" src="/some/path/myframe" scrolling="no" width="100%" height="0" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" onload="frameLoad()" > </iframe> </div> </div>
So, I need to somehow 'trigger' the frame or get it? so that I can then put in user/passwd and submit it

If you need more info, just ask.
As I say, I'm not familiar with this sort of programming, so apologies if its a bit vague.

Cheers
Chris

PS Used to have pm acct yrs ago :) , but its been while since I posted last.

Replies are listed 'Best First'.
Re: www::scripter & javascript frame
by Corion (Patriarch) on Feb 15, 2012 at 07:07 UTC
    If you are in network operations, why not get a network trace to see what actually goes over the wire? Also consider the Mozilla Live Headers to see a lisg of HTTP requests being made. Most likely, the login information is being passed via cookie and you can simply request the "login frame" directly, just like your browwser does.
      Hi Corion

      Live HTTP Headers gave me the clue; using the std nagios check_http http://nagiosplugins.org/man/check_http I just amended the -u option to specify the fuller path to the frame instead of just the front page & it worked like a charm.
      :)
      I owe you a beer ...

      Cheers
      Chris

      PS If there is a way to mark this as solved, please do. In the meantime I'll edit the title of this reply

      Hi Corion,
      thx; I'll look into it.

      Incidentally, would www:scripter be the correct soln, or is there something better? I'm not deep into any code right now, so changing is not an issue.

      To clarify for anyone else, what I should have said is that although the browser sees the the whole page, inc login frame in the middle of the page just fine, 'Show source' just shows the surrounding html, but not the login frame at all... Thought I was going mad for while there ;)

      Cheers
      Chris