WebInject Installation and Monitoring Web Applications | Arkit

Are you looking forward to monitor web application by authenticating against application? Here you go. Few times when you observe web application state they are in running state, however application page will be blank. In this case we can’t ensure that by monitoring application service status. You need an sophisticated validation, using Webinject web application Monitoring in Nagios works for better solution.

Webinject Web Application Monitoring

Web application environment

  • Base URL:  https://www.server-computer.com:7010/console/login/LoginForm.jsp
  • After Successful Login redirected URL : https://www.server-computer.com:7010/console/console.portal?_nfpb=true&_pageLabel=HomePage1
  • Before Login Keyword: Administration
  • After Web App Login Keyword: Information

Webinject Test Case

  1. Check Web Site URL status code is 200
  2. Grab the Keyword
  3. Login to web application
  4. Check the keyword

How to Gather postbody parameters for Webinject

Here i am using Firefox browser for gathering the information required. Load your web application URL and press F12 key it goes into developer mode, Navigate to Network (Tab). Now enter credentials in web application and login to application.

firefox debug mode

As shown in above screen shot, you will find all the post parameters you required

From Headers tab grab the URL and parameters from parameters tab

Nagios Webinject Web Application Monitoring

Install WebInject CPAN Package

cpan -i Webinject

make config.xml file

<testcasefile>testdata.xml</testcasefile>
<useragent>WebInject Application Tester</useragent>
<timeout>10</timeout>
<globaltimeout>30</globaltimeout>
<reporttype>nagios</reporttype>
<max_redirect>5</max_redirect>

Write testdata.xml file

<testcases repeat="1">
<case
  id="1"
  url="https://www.server-computer.com:7010/console/login/LoginForm.jsp"
  verifyresponsecode="200"
  verifypositive="Administration"
  errormessage="Can not display the login page."
  logrequest="no"
  logresponse="no"
/>
<case
  id="2"
  method="post"
  url="https://www.server-computer.com:7010/console/j_security_check"
  posttype="application/x-www-form-urlencoded"
  postbody="j_username=username&j_password=password&j_character_encoding=UTF-8"
  verifyresponsecode="200"
  verifynegative="Authentication Denied"
  errormessage="Login failed."
  logrequest="no"
  logresponse="no"
/>
<case
  id="3"
  url="https://www.server-computer.com:7010/console/console.portal?_nfpb=true&_pageLabel=HomePage1"
  verifyresponsecode="200"
  verifypositive="Information"
  errormessage="Content Not found"
  logrequest="no"
  logresponse="no"
/>
</testcases>

testdata.xml Explanation

  • Repeat = 1 Run the test case one time, you can change this number based your requirement
  • Verifyresponsecode – will verify the website response code
  • Verifypositive – will verify keyword
  • Posttype only accept “application/x-www-form-urlencoded”, “multipart/form-data”, “text/xml”, “application/soap+xml”
  • Postbody details we already captured using debug/developer mode

Webinject Test Case Results

Starting WebInject Engine (v1.94)...
-------------------------------------------------------
Test: testdata.xml - 1
GET Request: https://www.server-computer.com:7010/console/login/LoginForm.jsp
Verify Response Code: "200"
Passed HTTP Response Code Verification
Verify: 'Administration'
Passed Positive Verification
TEST CASE PASSED
Response Time = 0.067 sec
-------------------------------------------------------
Test: testdata.xml - 2
POST Request: https://www.server-computer.com:7010/console/j_security_check
Verify Response Code: "200"
Passed HTTP Response Code Verification
Verify Negative: 'Authentication Denied'
Passed Negative Verification
TEST CASE PASSED
Response Time = 0.426 sec
-------------------------------------------------------
Test: testdata.xml - 3
GET Request: https://www.server-computer.com:7010/console/console.portal?_nfpb=true&_pageLabel=HomePage1
Verify Response Code: "200"
Passed HTTP Response Code Verification
Verify: 'Information'
Passed Positive Verification
TEST CASE PASSED
Response Time = 0.066 sec
-------------------------------------------------------

That’s it. Based one your requirement change testdata.xml file to use webinject web application monitoring using Nagios.

Related Articles

Thanks for your wonderful Support and Encouragement