Page 2 of 2
Re: Add selenium check over Nagios XI.
Posted: Mon Aug 10, 2015 3:54 pm
by tmcdonald
Thanks
@spurrellian!
@njain213, I am with
@spurrellian on this one, I don't think selenium is specifically necessary.
Re: Add selenium check over Nagios XI.
Posted: Tue Aug 11, 2015 3:15 am
by njain213
Hi,
We are currently using websitepulse for application monitoring.
Please find the steps in the attached word documents that we want to perform for application monitoring.
Can you please guide me what should I use for these steps ?(either selenium or anything else.)
Thanks
Naman
Re: Add selenium check over Nagios XI.
Posted: Tue Aug 11, 2015 4:40 am
by spurrellian
Hi Njain213,
From looking at the documentation you've sent you can do this in Selenium
First of all follow the documentation in to setup your environment
1.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Note that when you record your synthetic transaction in firefox add the 'verifyTextPresent' command to the bottom of the check
(Documentation here -
http://www.seleniumhq.org/docs/02_selen ... extpresent )
check_string.png
2. Remember to export as perl
3. Upload onto NagiosXI server
5. Run the perl clean up script
You should have something like this - This is a check to see if I can log on the forum and check that a string is present
****************************************************************************************************************************************************
Code: Select all
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;
use TimePerf2;
my $time= TimePerf2->new(60,90,120);
my $sel = Test::WWW::Selenium->new( host => "SERVERNAME",
port => 4444,
browser => "*iexplore",
browser_url => "https://support.nagios.com/" );
$time->startTime("ALL");
$sel->set_timeout_ok("120000");
if ( ! $sel->open_ok("/") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->set_speed("1500") ) { }
elsif ( ! $sel->click_ok("xpath=(//a[contains(text(),'Support Forums')])[2]") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->click_ok("link=Login") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( ! $sel->type_ok("id=username", "***********") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->type_ok("id=password", "************") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->click_ok("id=autologin") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->click_ok("name=login") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( ! $sel->click_ok("link=General Support") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( ! $sel->click_ok("link=Nagios XI") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( ! $sel->click_ok("xpath=(//a[contains(text(),'2')])[4]") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( ! $sel->wait_for_page_to_load_ok("120000") ) {}
elsif ( ! $sel->is_text_present_ok("[b]Please find the steps in the attached word documents that we want to perform for application monitoring[/b]") ) {print "Location: " . $sel->get_location() . "\n";}
elsif ( !$time->endTime("ALL") ) { }
else { $time->getTimes(); }
$sel->stop();
****************************************************************************************************************************************************
6. Setup a new service in Nagios against the selenium command
$USER1$/check_selenium --script=$USER1$/SCRIPT_NAME
7. I have a Windows 7 workstation running Selenium and IE that's added as a host in Nagios. Apply the selenium service against that host
selenium.PNG
Hopefully this helps?
Thanks
Paul
Re: Add selenium check over Nagios XI.
Posted: Tue Aug 11, 2015 4:14 pm
by hsmith
spurrellian wrote:Hi njain213,
Are you trying to check a string exists within a webpage? If so you don't necessarily need to use selenium.
You can do that with the following plugin if you require a ntlm login?
https://exchange.nagios.org/directory/P ... on/details
I used the following to check content of a page
$USER1$/check_ntlmauth.pl -u websiteaddress.com -l "USERNAME" -p "PASSWORD" -c 30 -w 20 -v -e STRINGYOURSEARCHINGFOR
We also use selenium for web checks so if you need more information let me know
Thanks
Paul
Thank you for all of your help on this issue!
njain213,
Can you please let us know when you find out if this works for you or not?
Thank you!
Re: Add selenium check over Nagios XI.
Posted: Thu Aug 13, 2015 5:36 am
by njain213
Hi,
As we came to know that integration of Nagios XI with selenium helps in Application monitoring so We are planning to buy Nagios Xi for our application monitoring.
Before purchasing it, I want to give a small demo of it to the management.
I have done with document of nagios integration with Selenium given on the link below:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Now as per my previous mail, I am trying to do all the steps given on the attached screenshots.
You have told me to follow the document (Documentation here -
http://www.seleniumhq.org/docs/02_selen ... extpresent ) but I am not unable to do all the things in it as unable to select all the commands given as per your screenshot.
Moreover from where I will get info about the commands given in dropdown.(basically which command is used for which purpose)
Thanks
Naman
Re: Add selenium check over Nagios XI.
Posted: Thu Aug 13, 2015 3:51 pm
by hsmith
njain213 wrote:You have told me to follow the document (Documentation here -
http://www.seleniumhq.org/docs/02_selen ... extpresent ) but I am not unable to do all the things in it as unable to select all the commands given as per your screenshot.
What do you mean you are unable to do all of the things that are listed there?
Re: Add selenium check over Nagios XI.
Posted: Mon Aug 17, 2015 12:24 am
by njain213
I mean in the command option,there are lot of commands given and from where I will get the description for each command.
How will I come to know that this command do that work.
For example: To login into any application, I will use login command and record it in Selenium IDE.
There are lot of commands given in Selenium IDE so I have asked about description of each command in my previous mail.
Moreover I believe for every step mentioned in the screenshots that I have attached earlier,we have to record new case through selenium IDE.Am I correct on this?
Thanks
Naman
Re: Add selenium check over Nagios XI.
Posted: Mon Aug 17, 2015 2:06 pm
by jdalrymple
njain213 wrote:I mean in the command option,there are lot of commands given and from where I will get the description for each command.
How will I come to know that this command do that work.
http://release.seleniumhq.org/selenium- ... rence.html
njain213 wrote:For example: To login into any application, I will use login command and record it in Selenium IDE.
There are lot of commands given in Selenium IDE so I have asked about description of each command in my previous mail.
Moreover I believe for every step mentioned in the screenshots that I have attached earlier,we have to record new case through selenium IDE.Am I correct on this?
The point of the IDE is to simplify the creation of the Selenium script. Paul's instructions from above are spot on. Pay attention to the IDE when you're clicking around in Firefox and hopefully you'll come to a better understanding of what it's doing.
Also worth mentioning, the status of your problem is currently outside of the scope of Nagios - you're simply trying to create a Selenium test suite which has nothing to do with Nagios. Paul has given you great advice and if you find that it's in any way lacking I suggest reaching out at the
Selenium group for additional support. We're happy to try to help with the Nagios stuff, however we are not Selenium experts.