SELENIUM checks successful (OK), but state 'critical'

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

SELENIUM checks successful (OK), but state 'critical'

Post by dlukinski »

Hello XI support

We've got SELENIUM service_check operational (with "ENTER" key press from previous posts)
BUT now we have Service state as 'critical' while completed OK

Screenshot and Selenium code attached
----------------------------------------------
CLI run

Code: Select all

[root@localhost libexec]# perl alfresco-3
ok 1 - open, /share/page/
ok 2 - set_timeout, 120000
ok 3 - type, id=page_x002e_components_x002e_slingshot-login_x0023_default-username, nagximon
ok 4 - type, id=page_x002e_components_x002e_slingshot-login_x0023_default-password, mypassword123
ok 5 - click, id=page_x002e_components_x002e_slingshot-login_x0023_default-submit-button
ok 6
ok 7 - click, css=input.alf-search-box-text
ok 8 - type, css=input.alf-search-box-text, 53202206
ok 9
ok 10 - click, //tr[4]/td[5]/a[2]/span
ok 11
ok 12 - click, id=HEADER_USER_MENU_POPUP_text
ok 13
ok 14 - click, id=HEADER_USER_MENU_LOGOUT_text
ok 15 - wait_for_page_to_load, 30000
Key: ALL, Value: 1470231206.37268:1
OK: Processes completed after 0 of page loading.|2|  |1..15
What makes XI misinterpret OK result?
You do not have the required permissions to view the files attached to this post.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: SELENIUM checks successful (OK), but state 'critical'

Post by mcapra »

It boils down to this final output:

Code: Select all

OK: Processes completed after 0 of page loading.|2|  |1..15
Specifically the 2 that comes after your main output message. The check_selenium plugin sees that 2 as the exit code from your Selenium test case and recognizes it as a failure. If you have verified the test runs as expected (looks like it has based on your output), this is probably a false negative.

One thing I notice is that you are not properly ending the testing phase's times. This will probably upset something in TimePerf2 and is why a false negative is being generated. Make sure to include $time->endTime("ALL"); as part of your test case's wrap-up.

Revise lines 61-65 like so:

Code: Select all

$sel->click_ok("id=HEADER_USER_MENU_LOGOUT_text");
$sel->wait_for_page_to_load_ok("30000");
$time->endTime("ALL"); #must end our time period
$time->getTimes();
$sel->stop();
Former Nagios employee
https://www.mcapra.com/
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: SELENIUM checks successful (OK), but state 'critical'

Post by dlukinski »

mcapra wrote:It boils down to this final output:

Code: Select all

OK: Processes completed after 0 of page loading.|2|  |1..15
Specifically the 2 that comes after your main output message. The check_selenium plugin sees that 2 as the exit code from your Selenium test case and recognizes it as a failure. If you have verified the test runs as expected (looks like it has based on your output), this is probably a false negative.

One thing I notice is that you are not properly ending the testing phase's times. This will probably upset something in TimePerf2 and is why a false negative is being generated. Make sure to include $time->endTime("ALL"); as part of your test case's wrap-up.

Revise lines 61-65 like so:

Code: Select all

$sel->click_ok("id=HEADER_USER_MENU_LOGOUT_text");
$sel->wait_for_page_to_load_ok("30000");
$time->endTime("ALL"); #must end our time period
$time->getTimes();
$sel->stop();

This worked, thank you

Please close this case
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: SELENIUM checks successful (OK), but state 'critical'

Post by mcapra »

Awesome! Closing this up.
Former Nagios employee
https://www.mcapra.com/
Locked