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

I'm trying to write a down and dirty plugin for nagios that will go out and log into a website using lynx, make sure each screen is what it should be along the way(greping and comparing as I go) then return a value at the end telling me if the system is ok, or broken. I have figured out how to pipe in commands to the application, or pipe out the screen output, but not both in sort of an interactive way. I saw something about forking, but that didn't seem to be what I was looking for. I've been digging through the Oreilly book, searching online, and looking at other peoples' scripts, but I can't seem to find a similar type of program. Is this possible and if so, how do I do it, or is there something I haven't found I should reference on how to do it. Thanks,

Replies are listed 'Best First'.
Re: perl lynx site check script
by Happy-the-monk (Canon) on Oct 29, 2004 at 00:27 UTC

    I would prefer an easier way to do the task:
    use LWP::Simple to fetch your web page and Test::HTML::Content to test whether the HTML is what it should be.

    There's more along these lines: to fiddle with the way the web pages should be navigated there is WWW::Mechanize::Shell which is on the lines of your lynx approach.
    Or else there is HTTP::Recorder to record your browsing session and create a WWW::Mechanize (Perl) macro to redo what you just did on the web pages.
    You can reuse or tweak these scripts later.

    Cheers, Sören