Xymon Mailing List Archive search

urlplus.pl http/https monitoring extension script

list Ralph Mitchell
Mon, 28 Jan 2008 12:43:21 -0600
Message-Id: <user-202c0178144d@xymon.invalid>

On Jan 28, 2008 11:07 AM, Gary Baluha <user-ae3e15c22de1@xymon.invalid> wrote:
That looks like the kind of thing I've been doing in bash scripts using
curl.  I've thought about switching to a different language, but I don't
know enough Perl to get started.  Maybe I'll take another look...  :)
For the kind of work that this script is doing, there weren't really any
reasons to require perl over shell script.  I picked perl because I've been
doing a lot of perl scripting lately, but also because it should be easier
to convert the perl code to C at some point, if I feel that is necessary.

As far as speed goes, I've found there isn't much of a difference between
perl and shell, though in certain cases I've seen shell script a little
quicker.  I'm sure the usual "your mileage may vary" quote is worth throwing
out at this point ;-)

Yeah, my mileage varies - I've got around 100 scripts running checks on 655
hosts (the number varies daily) generating over 2700 messages.  I've got a
fairly steady load average of around 6.5 on a single-cpu 733MHz DL380.  I'm
supposed to be getting a faster system, while at the same time the company
keeps trying to "replace Hobbit/Big Brother with XXX", so I'm not holding my
breath on that.

I'm not doing anything really perl-crazy with this script, and I think I
have it pretty well commented, so it should be a decent reference if you
want to get in to perl.  Either way, I'd be interested in comparing notes in
what our two scripts do, and possibly combining features from yours into
this one.
I think most of my scripts are fairly simple-minded - grab a page, grep for
something, flag red/green - but some of them dig a lot deeper.  Login,
navigate through some pages, logout again.  I won't name the worst one I
have to deal with, but the first page does a redirect using a "meta refresh"
tag, the next page does "self.location=/web/guest/home" in javascript,
followed by "window.location=/c/portal/login"  to get to the login page.
After posting the login form, I get another "self.location" that takes me to
a page containing another form that self-submits via onLoad in the <body>
tag.  After all that it's relatively trivial to extract the logout url to
exit cleanly from the site.  Loads of fun...

Ralph Mitchell