webtranslation to monitor webpage

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
pkrk
Posts: 27
Joined: Tue Sep 05, 2017 8:12 am

webtranslation to monitor webpage

Post by pkrk »

HI,
I'm trying to check webtransaction with jboss , but i'm unable to monitoring it, once is only able to check the first page

the verifypositive just can read the first page , and not the second.


Code: Select all

<testcases repeat="1">

    <testvar varname="LOGIN_URL">http://myserver/login.php</testvar>
    <testvar varname="LOGIN1">bob</testvar>
    <testvar varname="PASSWD1">sponge</testvar>
    <testvar varname="SUCCESSFULL_TEST_TEXT">Welcome Bob</testvar>
     
    <case
        id="1"
        description1="login test case"
        description2="verify string login"
        method="post"
        url="${LOGIN_URL}"
        postbody="login=${LOGIN1}&passwd=${PASSWD1}"
        verifypositive="${SUCCESSFULL_TEST_TEXT}"
    />

</testcases>
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: webtranslation to monitor webpage

Post by scottwilkerson »

Can you give an example of the second case? I just see one case here which will just test one page.

Depending on your apps structure these can be complicated as you may need to pass variables from one case into the next case.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
pkrk
Posts: 27
Joined: Tue Sep 05, 2017 8:12 am

Re: webtranslation to monitor webpage

Post by pkrk »

can't I do everything with one case?

I got this
verifypositive="${SUCCESSFULL_TEST_TEXT}"
that should verify is sentence is on page , but it doesn't , I'm trying to do it with jboss server
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: webtranslation to monitor webpage

Post by cdienger »

A second case/url would need to be created to test the second page.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pkrk
Posts: 27
Joined: Tue Sep 05, 2017 8:12 am

Re: webtranslation to monitor webpage

Post by pkrk »

but the first case does not work , the user/passwod , if i change the password for fake one , the check is still valid
can you please let me know why?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: webtranslation to monitor webpage

Post by mcapra »

If you're just testing a simple page login with POST vars, you might be able to use check_http instead of writing complex web transactions. See this example where check_http is used to test login for a Confluence setup:
https://support.nagios.com/forum/viewto ... 71#p235371
Former Nagios employee
https://www.mcapra.com/
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: webtranslation to monitor webpage

Post by cdienger »

Does mcapra's suggestion help? I'd agree that this would be a better route to go if you can since it would be easier to configure.

I would need more information to troubleshoot the web tranasction issue - the actual xml file containing the cases and a tcpdump would be helpful. Tcpdumps can be gathered with:

Code: Select all

yum -y install tcpdump
tcpdump -s 0 -i any host ip.of.web.server -w output.pcap
Let it run long enough to run the check and use CTRL+C to stop it. Both the xml and pcap file can contain sensitive information so avoid posting it directly on the forum and PM it to me if needed.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pkrk
Posts: 27
Joined: Tue Sep 05, 2017 8:12 am

Re: webtranslation to monitor webpage

Post by pkrk »

I need to used webtrasanction , once i need to login with user and password , and further on to do other action , such as check deployments etc ...

but just the simple check user/password does not work
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: webtranslation to monitor webpage

Post by dwhitfield »

We would need more information to troubleshoot the web transaction issue - the actual xml file containing the cases and a tcpdump would be helpful. Tcpdumps can be gathered with:

Code: Select all

    yum -y install tcpdump
    tcpdump -s 0 -i any host ip.of.web.server -w output.pcap


Let it run long enough to run the check and use CTRL+C to stop it. Both the xml and pcap file can contain sensitive information so avoid posting it directly on the forum and PM it to me if needed. Alternatively, if you're a customer, you can email it to [email protected]
pkrk
Posts: 27
Joined: Tue Sep 05, 2017 8:12 am

Re: webtranslation to monitor webpage

Post by pkrk »

Hi,

For example the code below doesn't work , i try with nagiosxi to login and password and does not work , but if i try just with case 1 it works

Code: Select all

<testcases repeat="1">

<case
        id="1"
        url="http://nagios01/nagiosxi/login.php"
        verifyresponsecode="200"
        verifypositive="con"
        errormessage="Can not display the login page."
/>


<case
      id="2"
      method="post"
      url="http://nagios01/nagiosxi/login.php"
      postbody="usernameBox=nagiosadmin&passwordBox=nagiosadmin"
      verifyresponsecode="302"
      verifynegative="Authorization failed"
      errormessage="Login failed."
/>

</testcases>
~
Locked