Webinject multiple output type for nagios

605 views
Skip to first unread message

Grimstone

unread,
Jan 11, 2011, 3:49:06 AM1/11/11
to WebInject
I would be very nice if webinject to have a setting to output
something like check_multi does. eg: For each step of the plugin to
ouput detailed info and of course the performance data like:

Step1: OK
Step2: OK
Step3: CRITICAL
Step4: UNKNOWN
..
.
..

TESTCASE CRITICAL|(and now the performance data)Step1=xxxseconds;$
{WARNING_THRESHOLD1};${CRITICAL_THRESHOLD1};${MIN1};${MAX1}
Step2=xxxseconds;${WARNING_THRESHOLD2};${CRITICAL_THRESHOLD2};${MIN2};$
{MAX2} Step3=xxxseconds;${WARNING_THRESHOLD3};${CRITICAL_THRESHOLD3};$
{MIN3};${MAX3} ... etc

Sven Nierlein

unread,
Jan 12, 2011, 3:03:40 AM1/12/11
to webi...@googlegroups.com
Hi,


When using the nagios report mode, webinject exits after the first failed check.
It usually makes no sense to test a login for example if the login form page could
not be loaded.
But why not use check_multi?

Sven

Grimstone

unread,
Jan 12, 2011, 6:00:35 AM1/12/11
to WebInject
In this case check multi cannot be used because in fact we are
collecting data from only one plugin. check_multi requires more
plugins.

The ideea to display all steps and steps below the failed one as
UNKNOWN is:
1. we have a more clear and quick wiev of the failed step.
2. SLA reporting.

Other display enhancement would be that both in performance data
section and in Status Information to show the Description of each
step.For performance data this wold be more friendly since grphs would
be named after the description of each step like: Main Page, Login
Page, Webmail Page , etc... I use to work with witbe and this
naming and visual enhancements were a great thing in witbe (i think
this was the only one at that app)

Other metrhod of doing this separate display would be that we define
each step as a separate nagios plugin but this would impact execution
time since other nagios checks might get between testcase checks...

Sven Nierlein

unread,
Jan 12, 2011, 10:46:42 AM1/12/11
to webi...@googlegroups.com
Its not that easy. Each "step" may result in several checks ex. content, return code etc..
Labeling performance data is already possible. Just set a "label" in your case and it will be used for the perf data:
http://search.cpan.org/~nierlein/Webinject-1.55/lib/Webinject.pm#example_test_case

Theodor Chirana

unread,
Jan 12, 2011, 11:42:56 AM1/12/11
to webi...@googlegroups.com
Sorry,
I just looked again over the options and i saw that label statement now. And that is perfect that a labes staement exists and webinject already knows how to evaluate it because for displaying each step in Status Information something simillar to the following nagios plugin guide can be used:

TEXT OUTPUT | OPTIONAL PERFDATA
LONG TEXT LINE 1
LONG TEXT LINE 2
...
LONG TEXT LINE N
| PERFDATA LINE 2
PERFDATA LINE 3
...
PERFDATA LINE N

where LONG TEXT LINE 1 would be the label from case with id=1, LONG TEST LINE 2 ..., etc..., and the overall evaluated status of that particular case, not considering if a step1 inside case1 is ok and step2 inside case1 is CRITICAL, because this means that the entire case with id=1 is failed. And that is how webinject curently evaluates each case. Right?

Regards,
Theodor

Sven Nierlein

unread,
Jan 12, 2011, 12:00:51 PM1/12/11
to webi...@googlegroups.com
Currently we have this:

TEXT OUTPUT | OPTIONAL PERFDATA
LONG TEXT LINE 1
LONG TEXT LINE 2
...
LONG TEXT LINE N

So all performance data is in the first line. This makes it compatible to nagios 2 and does not make a difference for nagios 3 because performance data is not for humans.
The long text is used for the complete text output. So when i got you right, you just want to strip the long plugin output down to display only the resulting case state instead of the full output?

Have a look at this examle, the perf data is on the first line with the result which nagios will display. The other output is the complete test result which will be displayed in nagios when you have a detailed look at the service. Is'nt that what you are looking for?


%> ./check_webinject t/data/04-repeated_tests.xml
WebInject CRITICAL - Test case number 1 failed|time=0.064;0;0;0;0 case1=0;0;0;0;0 case1=0;0;0;0;0 case1=0;0;0;0;0 case1=0;0;0;0;0 case1=0;0;0;0;0

Starting WebInject Engine (v1.56)...

-------------------------------------------------------
Test: t/data/04-repeated_tests.xml - 1
test response code 200
GET Request: /code/200
Verify Response Code: "200"
Failed HTTP Response Code Verification (received 400, expecting 200)
TEST CASE FAILED
Response Time = 0 sec
-------------------------------------------------------
Test: t/data/04-repeated_tests.xml - 1
test response code 200
GET Request: /code/200
Verify Response Code: "200"
Failed HTTP Response Code Verification (received 400, expecting 200)
TEST CASE FAILED
Response Time = 0 sec
-------------------------------------------------------
Test: t/data/04-repeated_tests.xml - 1
test response code 200
GET Request: /code/200
Verify Response Code: "200"
Failed HTTP Response Code Verification (received 400, expecting 200)
TEST CASE FAILED
Response Time = 0 sec
-------------------------------------------------------
Test: t/data/04-repeated_tests.xml - 1
test response code 200
GET Request: /code/200
Verify Response Code: "200"
Failed HTTP Response Code Verification (received 400, expecting 200)
TEST CASE FAILED
Response Time = 0 sec
-------------------------------------------------------
Test: t/data/04-repeated_tests.xml - 1
test response code 200
GET Request: /code/200
Verify Response Code: "200"
Failed HTTP Response Code Verification (received 400, expecting 200)
TEST CASE FAILED
Response Time = 0 sec
-------------------------------------------------------

Start Time: Wed Jan 12 17:56:20 2011
Total Run Time: 0.064 seconds

Test Cases Run: 5
Test Cases Passed: 0
Test Cases Failed: 5
Verifications Passed: 0
Verifications Failed: 5

Theodor Chirana

unread,
Jan 12, 2011, 12:28:52 PM1/12/11
to webi...@googlegroups.com
You are close .
Yes this is the general idea but... to be 100% nagios compatible the output should look like this:

WebInject CRITICAL - Test case number 2 failed | time=0.064;0;0;0;0
<CASE 1 LABEL> OK
<CASE 2 LABEL> CRITICAL - Failed HTTP Response Code Verification (received 400, expecting 200)
<CASE 3 LABEL> UNKNOWN  /* UNKNOWN because test case 2 was failed>
....
....
<CASE N LABEL> UNKNOWN | <PERFDATA FOR CASE 2>
<PERFDATA FOR CASE 3>
<PERFDATA FOR CASE 4>
.....
....
<PERFDATA FOR CASE N>

where cases are <id> statements contained in a <testcases> statement.

and yes the short long text would be more suitable .

And Sven this discussion tends to be more of a feature idea. I am very happy that there is a tool for nagios that knows how to make
automatic web app tests and collect perfdata. If the output would be more friendly but also detailed and concise the tool will be great.

Other enhancements wihch I consider usefull would be more than 4 verifypositive,verifynegative, etc...
.

Sven Nierlein

unread,
Jan 12, 2011, 3:36:37 PM1/12/11
to webi...@googlegroups.com
On 1/12/11 18:28, Theodor Chirana wrote:
> <CASE 1 LABEL> OK
> <CASE 2 LABEL> CRITICAL - Failed HTTP Response Code Verification (received 400, expecting 200)
> <CASE 3 LABEL> UNKNOWN /* UNKNOWN because test case 2 was failed>

There can be more than one test for each case. And webinject does not know why case 3 fails it just can tell what failed. Don't expect too much intelligence, its just a dump script :-)
Ideas for better readability are welcome.

> And Sven this discussion tends to be more of a feature idea. I am very happy that there is a tool for nagios that knows how to make
> automatic web app tests and collect perfdata. If the output would be more friendly but also detailed and concise the tool will be great.

i know :-)

> Other enhancements wihch I consider usefull would be more than 4 verifypositive,verifynegative, etc...

Just pushed that change to git.

Theodor Chirana

unread,
Jan 13, 2011, 3:13:54 AM1/13/11
to webi...@googlegroups.com
On 1/12/2011 10:36 PM, Sven Nierlein wrote:
On 1/12/11 18:28, Theodor Chirana wrote:
<CASE 1 LABEL> OK
<CASE 2 LABEL> CRITICAL - Failed HTTP Response Code Verification (received 400, expecting 200)
<CASE 3 LABEL> UNKNOWN  /* UNKNOWN because test case 2 was failed>
There can be more than one test for each case. And webinject does not know why case 3 fails it just can tell what failed. Don't expect too much intelligence, its just a dump script :-)
Ideas for better readability are welcome.

    And that is perfect to see what failed. Can I hope this will be available in the future?
   
   On the other hand the label on the perfdata side work just fine.:
Status Information TESTCASE OK - All tests passed successfully in 0.22 seconds
 1. Main page for whoswho OK
 2. Search for a name OK
 3. Results of the search OK
 4. Employee page OK

Performance Data time=0.22;0;30;0;0 Main page for whoswho=0.062;10;20;0;0 Search for a name=0.023;10;20;0;0 Results of the search=0.016;10;20;0;0 Employee page=0.006;10;20;0;0
Won't it look better if we've had output like above ? :) (id.label result)


      
And Sven this discussion tends to be more of a feature idea. I am very happy that there is a tool for nagios that knows how to make
automatic web app tests and collect perfdata. If the output would be more friendly but also detailed and concise the tool will be great.
i know :-)

Other enhancements wihch I consider usefull would be more than 4 verifypositive,verifynegative, etc...
Just pushed that change to git.
How many options are available now? 8 ? 10? unlimited?

Grimstone

unread,
Jan 13, 2011, 3:11:46 PM1/13/11
to WebInject
Ok.. good job. I saw there are a lot of verifypositive,etc.. 9999.
I you can explain a little bit the code I might be able to help and
develop a option that would show in LONG TEXT OUTPUT the label and
exit state of each case. And even do some html formatting (see how
nagios handles html or css output) and do soem coloring of the text
like green when it is ok, red when it is warning .. standard nagios
colors.
And another crazy ideea maibe we can switch the entire code to
python.... if you like it of course

On Jan 13, 10:13 am, Theodor Chirana <off...@adaptcom.ro> wrote:
> On 1/12/2011 10:36 PM, Sven Nierlein wrote:> On 1/12/11 18:28, Theodor Chirana wrote:
> >> <CASE 1 LABEL>  OK
> >> <CASE 2 LABEL>  CRITICAL - Failed HTTP Response Code Verification (received 400, expecting 200)
> >> <CASE 3 LABEL>  UNKNOWN  /* UNKNOWN because test case 2 was failed>
> > There can be more than one test for each case. And webinject does not know why case 3 fails it just can tell what failed. Don't expect too much intelligence, its just a dump script :-)
> > Ideas for better readability are welcome.
>
>      And that is perfect to see what failed. Can I hope this will be
> available in the future?
>
>     On the other hand the label on the perfdata side work just fine.:
> Status Information      TESTCASE OK - All tests passed successfully in 0.22
> seconds
> * 1. Main page for whoswho OK
>   2. Search for a name OK
>   3. Results of the search OK
>   4. Employee page OK*

Sven Nierlein

unread,
Jan 13, 2011, 4:25:38 PM1/13/11
to webi...@googlegroups.com
On 1/13/11 21:11, Grimstone wrote:
> Ok.. good job. I saw there are a lot of verifypositive,etc.. 9999.
right, that should be enough.

> I you can explain a little bit the code I might be able to help and
> develop a option that would show in LONG TEXT OUTPUT the label and
> exit state of each case. And even do some html formatting (see how
> nagios handles html or css output) and do soem coloring of the text
> like green when it is ok, red when it is warning .. standard nagios
> colors.

This should be optional. Nagios does not always print html, thats a config option
from the cgi.cfg. But using the lable is a good idea. Maybe a shotlog and a fullog
option. Something like that should be possible.


> And another crazy ideea maibe we can switch the entire code to
> python.... if you like it of course

Thats a really crazy idea. I don't think that will happen.

Grimstone

unread,
Jan 14, 2011, 4:43:41 AM1/14/11
to WebInject
The option is escape_html_tags = 0 and nagios will interpret the html
code it receives. Maibe could be available in webinject with a option
like -html

Grimstone

unread,
Jan 17, 2011, 4:42:47 AM1/17/11
to WebInject
I have the first real alerts from the webinject scenarios.. they are
ok but ... the output is enourmous, more exactly everithing. I think a
short output will be very good especially in the nagios interface.

Sven Nierlein

unread,
Jan 17, 2011, 4:48:32 AM1/17/11
to webi...@googlegroups.com
On 1/17/11 10:42, Grimstone wrote:
> I have the first real alerts from the webinject scenarios.. they are
> ok but ... the output is enourmous, more exactly everithing. I think a
> short output will be very good especially in the nagios interface.

Its on my Todo list. I just had no time yet to think about it...

Sven

Reply all
Reply to author
Forward
0 new messages