As a unix admin, I've played with a lot of systems to keep an eye on my servers to see if they're working correctly. One thing that's particularly irksome is making sure that all the customizations and features of your web servers are in place. For example, making sure that server side includes (ssi) works, but that ssi-exec is forbidden.
The obvious way to handle this is to write a web page that uses some normal ssi and also tries to run an ssi-exec command. Then you write a script that loads that page and checks for successfull ssi output from the normal command and also checks for the correct error message for the forbidden ssi exec.
This is a pain because you have to not only write the test pages but you also have to write the scripts that parse them.
The solution I've eventually reached is to write all my test web pages according to a strict format that not only encodes the tests but also the expected results. Then the scripts that I use to check the page don't have to know anything about the page to determine if the tests passed or failed.
The specific syntax I use for my test web pages isn't really that important, but here's what I use.
Heres an example:
<HTML> <HEAD><TITLE>SSI</TITLE></HEAD> <BODY> <H1>SSI TEST</H1> <H2>Basic SSI</H2> <H3>Foo</H3> <!--#set var="a_var" value="Foo"--> <H3><!--#echo var="a_var"--></H3> <H2>Exec Forbidden</H2> <H3>[an error occurred while processing this directive]</H3> <H3><!--#exec cmd="ls" --></H3> </BODY> </HTML>
I've written a perl module that I use internally that parses this kind of html and creates a handy object containing test results. It's still pretty rough, but it works. I've also written a nagios plugin that uses this module (and WOW does it make my job easier).
SO! My question to you monks is: is there any reason NOT to post this module to CPAN?
In reply to Module Idea by pileofrogs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |