Library

Docs
Beta

Products

Adding MATCH Statements in the SNMP Trap InterfaceAutomatic Agent DeploymentAutomatic Nagios Core Migration to Nagios XIHow To Add A New User In Nagios XIHow To Configure Contact Groups in Nagios XIHow To Customize Your Dashboards With Dashlets In Nagios XIHow To Install Nagios XI via SourceHow To Manage MIBs In Nagios XIHow To Monitor A Gateway Switch With Nagios XIHow To Monitor A System Using SSHHow To Monitor DNS Servers and Queries with Nagios XIHow To Monitor Printers with Nagios XIHow To Monitor Security Cameras using Nagios XIHow To Monitor Websites with Nagios XIHow To Monitor Windows Machines With NCPA In Nagios XIHow To Monitor Windows Using SNMP In Nagios XIHow To Monitor Windows Using WinRMHow To Monitor your Mac OS/X devices using Nagios XIHow To Perform Nagios XI Landing Page CustomizationHow To Repair Crashed DatabasesHow To Select The Right Nagios XI Download For Your EnvironmentHow To Use Capacity PlanningHow To Use Scheduled ReportsHow To View The Latest Alerts In Nagios XIHow To configure Email Notifications in Nagios XIHow To configure Nagios XI to support Multi TenancyHow To configure your Timezone in Nagios XIHow To evaluate Nagios XI using -Hyper VHow To install Nagios XI in AWSHow To install Nagios XI using ESXiHow To install Nagios XI using Hyper VHow To install Nagios XI using VMware WorkstationHow To install Nagios XI using VMwareHow To install additional Configuration Wizards in Nagios XIHow To integrate Slack with Nagios XI 2024How To transfer Nagios XI from CentOS 7 to CentOS 9How To understand Users and Contacts in Nagios XIHow To update/upgrade Nagios XIHow To use Auto Discovery to setup host and service checks in XIHow To use Bulk Host Cloning and the Import WizardHow To use Business Process Intelligence (BPI)How To use Dashboards in Nagios XIHow To use Hypermap in Nagios XIHow To use Minemap MonitoringHow To use Nagios XI to Monitor Active DirectoryHow To use Tactical Overview in Nagios XIHow To utilize Reports and Graphs in Nagios XIHow To utilize Standard Edition (SE) ReportsHow to Agentless Monitor a Windows Machine with Nagios XIHow to Configure Contacts in Nagios XIHow to Use Custom Includes Component in Nagios XIInstalling on Non Standard SystemsManaging Contact TemplatesManaging Host TemplatesManaging Service TemplatesMigrating Nagios XI to a different ServerMonitoring Amazon EC2Monitoring Linux using NCPAMonitoring Office 365 Subscription ServicesMonitoring WebLogic on WindowsMonitoring Windows using NCPANagios Integrating MNTOSNagios XI 10,000 Services and growing NWC14Nagios XI API’s NWC13Nagios XI Accessing And Utilizing The Core Config ManagerNagios XI Activating Your LicenseNagios XI Add NagVis Map To A ViewNagios XI Adding And Removing A Host Using The APINagios XI Adding And Removing A Service Using The APINagios XI Adding Services To Pre existing Switch or RouterNagios XI Adding Windows Disk Usage Checks In XINagios XI Admin TourNagios XI Administrative User AccountsNagios XI Administrator GuideNagios XI Advanced Features of Nagios XI NWC14Nagios XI Ansible TutorialNagios XI Architecture OverviewNagios XI Audit LogNagios XI Automated Host Management In Nagios XINagios XI BPI XML CacheNagios XI Backend APINagios XI Backing Up And Restoring Your Nagios XI SystemNagios XI Backup and Restore OptionsNagios XI Bandwidth Graphs Showing 0Mb/s in Non English SystemsNagios XI Best Practices NWC15Nagios XI Best Practices for Managing ConfigsNagios XI Business Process IntegrationNagios XI Changing Host Alive CheckNagios XI Changing The Check Interval Of A ServiceNagios XI Changing The System TimeNagios XI Check Interval ConsiderationsNagios XI Checking Program Loadtime With autoIT in Nagios XINagios XI Cleaner Cron ArchitecureNagios XI Cloning UsersNagios XI Command Subsystem ArchitectureNagios XI Configuration Wizards and TemplatesNagios XI Configure PHP Development EnvironmentNagios XI Configuring Core Contacts to Use XI’s phpmailer SMTP SettingsNagios XI Configuring DowntimeNagios XI Configuring FTP For NSClient++ DeploymentNagios XI Configuring Global Event HandlersNagios XI Configuring Inbound ChecksNagios XI Configuring NSClient++Nagios XI Configuring Notification PreferencesNagios XI Configuring Outbound ChecksNagios XI Configuring Passive Services With Nagios XINagios XI Configuring SSL for Nagios XINagios XI Connecting To Your Email ServerNagios XI Conversion for VirtualBoxNagios XI Cool Tips & Tricks NWC14Nagios XI Core Config Manager Bulk Modification ToolNagios XI Core Config Manager Bulk Renaming ToolNagios XI Core Config Manager Configuration SnapshotsNagios XI Core Config Manager Escalation WizardNagios XI Core Config Manager Host GroupsNagios XI Core Config Manager How It WorksNagios XI Core Config Manager Service GroupsNagios XI Core Configuration Mananger Display IssuesNagios XI Core Configuration Mananger Mass ChangesNagios XI Create Actions URL Link In Quick Actions MenuNagios XI Create Host And Service URLs With FiltersNagios XI Creating Nagios XI WizardsNagios XI Cron JobsNagios XI Custom Wizards, Components and Dashlets NWC12Nagios XI Customizing The Landing PageNagios XI DB Maintenance ArchitectureNagios XI Database OptimizationNagios XI Display All Scheduled ReportsNagios XI Distributed Monitoring With NRDPNagios XI Downgrading Nagios CoreNagios XI Downloading A System ProfileNagios XI Email Notifications With ColorNagios XI Enabling Ping ActionNagios XI Enterprise Edition ReportsNagios XI Event Manager ArchitectureNagios XI Excluding Hosts And HostgroupsNagios XI Exploring the Graph ExplorerNagios XI Exporting the Config DatabaseNagios XI Folder Watch WizardNagios XI Gauges Understanding ThresholdsNagios XI Generating GraphsNagios XI Generating Reports With Nagios XINagios XI Google Map IntegrationNagios XI Group Deployment of Service Checks NWC15Nagios XI GroupsNagios XI Host and Service Details OverviewNagios XI Hostgroup InheritanceNagios XI How SNMP Traps WorkNagios XI How SNMP Works A Quick GuideNagios XI How To Achieve High AvailabilityNagios XI How To Apply Configuration Using The APINagios XI How To Check For Windows Updates With Nagios XINagios XI How To Create A Virtual Instance In The Amazon EC2 Cloud EnvironmentNagios XI How To Delete A Data Source From An RRD FileNagios XI How To Install On Windows Using Hyper VNagios XI How To Install On Windows Using VMwareNagios XI How To Install On Windows Using vSphereNagios XI How To Monitor A Websensor EM08Nagios XI How To Monitor Apache ActiveMQ With Nagios XINagios XI How To Monitor Apache TomcatNagios XI How To Monitor Devices Using The NCPA Agent and WizardNagios XI How To Monitor Docker ContainersNagios XI How To Monitor GlassFishNagios XI How To Monitor JBoss/WildFlyNagios XI How To Monitor JMX With Nagios XINagios XI How To Monitor Jetty JMXNagios XI How To Monitor WebLogicNagios XI How To Monitor Website Defacement With Nagios XINagios XI How To Select A DownloadNagios XI How To Test Check Commands From The Command lineNagios XI How To Use CA Certificates With check_ldaps PluginNagios XI How To Use Capacity PlanningNagios XI How To Use Deadpool In Nagios XINagios XI How To Use The Actions ComponentNagios XI How To Use The Bulk Host Cloning & Import WizardNagios XI How To Write Custom ComponentsNagios XI How XI WorksNagios XI How to Authenticate and Import -Users with Active DirectoryNagios XI How to Change Default PasswordsNagios XI How to Configure Email And Text NotificationsNagios XI How to Generate SLA ReportsNagios XI How to Install & Configure the Oracle Client & PluginsNagios XI How to Integrate SNMP Traps With Nagios XINagios XI How to Integrate the Bischeck Plugin Extension with Nagios XINagios XI How to Manage Remote Nagios XI ServersNagios XI How to Manually Update Nagios XINagios XI How to Monitor Apache Cassandra Distributed DatabasesNagios XI How to Monitor an AKCP SensorProbe2 using SNMPNagios XI How to Restart A Windows Service With NRPENagios XI How to Upgrade Using the Web UINagios XI How to Use the NSCA AddonNagios XI Importing Config Files From Nagios Core into Nagios XINagios XI Importing Nagios XI into Microsoft Hyper VNagios XI Inbound Email CommandsNagios XI Installing NSClient++Nagios XI License EntitlementsNagios XI Integrating Mod Gearman With Nagios XINagios XI Integrating Mod_Security With Nagios XINagios XI Integrating NagVis With Nagios XINagios XI Integrating On Call Schedules with Nagios NWC13Nagios XI Integrating PuTTY SSH LinksNagios XI Integrating Slack With Nagios XINagios XI Integrating autoIT With NagiosNagios XI Introduction Getting Started with Nagios XI NWC14Nagios XI Introduction to Event HandlersNagios XI JavaScript and jQuery Tips, Tricks and How To NWC14Nagios XI Leveraging and Understanding Performance Data and Graphs NWC13Nagios XI License Maintenance Status CheckNagios XI Link Directly to Graph Explorer GraphsNagios XI Log Locations and DescriptionsNagios XI Log Monitoring with SwatchNagios XI Log Server Integration WizardNagios XI Logging InNagios XI MRTG Clean ConfigsNagios XI Macros and Custom Object VariablesNagios XI Manage MIBs ArchitectureNagios XI Managing ComponentsNagios XI Managing Mobile CarriersNagios XI Managing Plugins In Nagios XINagios XI Managing UsersNagios XI Manual Backup And Restore DatabasesNagios XI Manual Config File ManagementNagios XI Mass Acknowledgement in Nagios XI 2024Nagios XI Mass Delete Old RRD FilesNagios XI Maximizing Performance In Nagios XINagios XI Migrate Performance DataNagios XI Migrating From Nagios CoreNagios XI Mobile User InterfaceNagios XI Mod Gearman Queues and WorkersNagios XI Modifying The Contents Of /usr/local/nagios/etcNagios XI Monitor Active Directory with LDAPNagios XI Monitoring A MySQL ServerNagios XI Monitoring A Nagios XI ServerNagios XI Monitoring A Router Or SwitchNagios XI Monitoring A Website URLNagios XI Monitoring A Windows DesktopNagios XI Monitoring AIX With NagiosNagios XI Monitoring An FTP ServerNagios XI Monitoring An LDAP ServerNagios XI Monitoring Apache Tomcat With XINagios XI Monitoring DNS QueriesNagios XI Monitoring Hosts Using NRPE and NRPE Monitoring WizardNagios XI Monitoring Hosts Using SSHNagios XI Monitoring Linux ServersNagios XI Monitoring Linux Using NRPE and Linux Server Monitoring WizardNagios XI Monitoring Linux Using SNMPNagios XI Monitoring Microsoft SQLNagios XI Monitoring MongoDBNagios XI Monitoring OS/X with Nagios XINagios XI Monitoring Performance Counters in Nagios Using NCPANagios XI Monitoring Performance Counters in Nagios Using NSClient++Nagios XI Monitoring TCP/UDP PortsNagios XI Monitoring Unconfigured ObjectsNagios XI Monitoring Using the Full Power of Nagios XI Enterprise NWC15Nagios XI Monitoring VMware Virtualization Using vMA NWC14Nagios XI Monitoring VMware With Nagios XINagios XI Monitoring Websites With Nagios XINagios XI Monitoring Windows ServersNagios XI Monitoring Windows Using NSClient++Nagios XI Monitoring Windows With NCPANagios XI Monitoring Windows With SNMPNagios XI Monitoring the Nagios XI localhostNagios XI Moving Your XI InstallationNagios XI Multi Tech iSMS IntegrationNagios XI MultiTech MTR API IntegrationNagios XI MySQL/MariaDB Max ConnectionsNagios XI NSP Sorry Dave, I can’t let you do thatNagios XI Nagios AgentsNagios XI Nagios Network Analyzer Reports In XINagios XI Nagios Rapid Deployment Options NWC14Nagios XI Navigating The Nagios XI DashboardNagios XI Network Status Map Customization (Legacy)Nagios XI Network Status Map CustomizationNagios XI Non Administrative UsersNagios XI Offloading MySQL to Remote ServerNagios XI Optimizing The PHP Settings FileNagios XI Overview of ReportingNagios XI Passive Monitoring With NRDS_WinNagios XI Passive Monitoring with NRDSNagios XI Performance Data ArchitectureNagios XI Performance Data AveragingNagios XI Performance Graphs & Graph ExplorerNagios XI Ports And ProtocolsNagios XI Receiving SNMP Traps From Nagios Network AnalyzerNagios XI Recurring Downtime SystemNagios XI Redundancy And Security PlanningNagios XI Removing All Historical DataNagios XI Restarting A Linux Service With NRPENagios XI Restarting Linux Services With NCPANagios XI Restarting Windows Services With NCPANagios XI Restoring A Configuration SnapshotNagios XI Restoring Default ConfigurationNagios XI Running Auto Discovery JobsNagios XI SNMP Monitoring SeriesNagios XI SNMP Trap HardeningNagios XI SNMP Trap TutorialNagios XI SNMP Trap v3 ConfigurationNagios XI SNMP Traps with NXTINagios XI STRICT_TRANS_TABLESNagios XI Scheduled Backup Log LevelNagios XI Scheduling Reports and PagesNagios XI Scheduling ReportsNagios XI Securing Your Nagios Server NWC13Nagios XI Sending SNMP TrapsNagios XI Service DependenciesNagios XI Setup Nagios XI to Send SMS AlertsNagios XI Should You Change RRD Retention PeriodsNagios XI Solaris Monitoring OptionsNagios XI Special CharactersNagios XI Standard Edition ReportsNagios XI Switch and Router Wizard ArchitectureNagios XI System RequirementsNagios XI Terminology OverviewNagios XI Two Factor AuthenticationNagios XI Under the Hood NWC15Nagios XI Understanding And Using Configuration WizardsNagios XI Understanding And Using DashboardsNagios XI Understanding And Using XI ToolsNagios XI Understanding Email SendingNagios XI Understanding Multi TenancyNagios XI Understanding Notification EscalationsNagios XI Understanding Notification VariablesNagios XI Understanding The User Macros ComponentNagios XI Understanding User MacrosNagios XI Understanding User PermissionsNagios XI Understanding the Nagios XI Directory StructureNagios XI Update Components And WizardsNagios XI Update Default snmptt.conf EVENTNagios XI Upgrading Nagios CoreNagios XI User GuideNagios XI Upgrading The Linux NRPE AgentNagios XI Uploading and Managing MIBSNagios XI Users And ContactsNagios XI Using Auto DiscoveryNagios XI Using DUO Two Factor AuthenticationNagios XI Using Different Notification MethodsNagios XI Using NSClient++ For Passive ChecksNagios XI Using Nagios BPINagios XI Using Nagios XI As A Security Tool Software VersionsNagios XI Using Nagios XI As A Security Tool Website DefacementNagios XI Using Recurring DowntimeNagios XI Using SSL with XI Active DirectoryNagios XI Using Scripts / Plugins With NCPANagios XI Using Scripts / Plugins With NSClient++Nagios XI Using The Config Import Prep ToolNagios XI Using The Core Config Manager For Host ManagementNagios XI Using The Core Config Manager For Service ManagementNagios XI Using The Custom Includes ComponentNagios XI Using The Host And Service Object Notes ComponentNagios XI Using The SNMP Walk WizardNagios XI Using The Traceroute ActionNagios XI Using ViewsNagios XI Using rrdcached with Nagios XINagios XI Using the Negate PluginNagios XI Utilizing Data Visualizations in Systems Management -NWC14Nagios XI Utilizing a RAM Disk in Nagios XINagios XI Virtual Machine NotesNagios XI WatchGuard Wizard UsageNagios XI Web Interface ArchitectureNagios XI What Is A Performance CounterNagios XI Wizards AchitectureNagios XI XI Server ConsiderationsNagios Xi Masquerading As Another UserNetwork Monitoring With NagiosNon Admin Walkthrough of Nagios XIParent/Child Host RelationshipsStarting a Nagios XI TrialTemplate IntroductionThird Party Plugins in Nagios XITwilio SMS IntegrationUnderstanding Hosts and Services in Nagios XIUnderstanding Tools in Nagios XIUsing The Generic Plugin Monitoring Wizard In Nagios XIUsing the Nagios XI World MapViewing Configuration Snapshot differencesWebInject InstructionsWorking with Hosts on the Mobile InterfaceWorking with Services on the Mobile InterfaceXI 5.10.0 and newer Postgress to MySQL ConversionOvercoming lack of VMware SDK with VMware Wizard

WebInject Instructions

Introduction

The Web Transactions configuration wizard in Nagios XI uses WebInject to handle transaction logic. Please reference the WebInject instructions below when setting up the Web Transactions wizard.

Table of Contents

  1. Software Architecture

  2. Configuration

  3. Test Case Setup

  4. Pass/Fail Criteria

  5. Output/Results

  6. Session Handling

  7. User Interface

Software Architecture

Summary

WebInject consists of the WebInject Engine (test runner) and an optional User Interface (GUI). The WebInject Engine can be run on its own from the command line, or called from the GUI.

Configuration

Configuration File (config.xml)

There is a configuration file named 'config.xml' that is used to store configuration settings for your project. You can use this to specify which test case files to run (see below) and to set some constants and settings to be used by WebInject.

If you use WebInject in console mode, you can specify an alternate config file name by using the option -c or --config. See the "Command Line Options" section of this manual for more information.

All settings and constants must be enclosed in the proper tags, and simply need to be added to the config.xml file (order does not matter).

Available config settings are:

Proxy Server (proxy)

Specifies a proxy server to route all HTTP requests through.

<proxy>http://127.0.0.1:8080</proxy>

You can also do proxy authentication like this:

<proxy>http://username:[email protected]:8080</proxy>
User-Agent (useragent)

Specifies a User-Agent string to be sent in outgoing HTTP headers. If this setting is not used, the default User-Agent string sent is "WebInject". A User-Agent string is how each request identifies itself to the web server.

<useragent>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)</useragent>
HTTP Authentication (httpauth)

Specifies authorization headers to your request for HTTP Basic Authentication. HTTP provides a simple challenge-response authentication mechanism which may be used by a server to challenge a client request and by a client to provide authentication information. This configuration parameter takes a list of 5 colon delimited values that correspond to: servername:portnumber:realm-name:username:password

<httpauth>www.fakedomain.com:80:my_realm:foo:welcome</httpauth>

Note: You may include multiple <httpauth></httpauth> elements in your config files to support multiple sets of HTTP Authentication credentials.

Base URL (baseurl)

Creates the constant {BASEURL} which can be used in test cases (see 'Variables and Constants' section below).

<baseurl>http://myserver</baseurl>
Base URL 1 (baseurl1)

Creates the constant {BASEURL1} which can be used in test cases (see 'Variables and Constants' section below). This works in the same way as the 'baseurl' example above.

Base URL 2 (baseurl2)

Creates the constant {BASEURL2} which can be used in test cases (see 'Variables and Constants' section below). This works in the same way as the 'baseurl' example above.

HTTP Logging (globalhttplog)

Enables logging of HTTP requests/responses for all test cases. The HTTP requests sent and HTTP responses received are written to the http.log file. The available values you can set this to are:

  • yes - log HTTP for all test cases
<globalhttplog>yes</globalhttplog>
  • onfail - log HTTP for test cases that fail only
<globalhttplog>onfail</globalhttplog>

Note: If you also turn on logging for any individual test cases, it will produce duplicate log entries for the same request/response. Also, output logging is suppressed when running in a Plugin Mode (reporttype).

Comments (comment)

Allows you to comment out parts of your config file. Anything contained within comment tags will not be processed.

<comment>this will be ignored</comment>
Response Delay Timeout (timeout)

Sets a response delay timeout (in seconds) for every test case. If the response in any test case takes longer than this threshold, the HTTP request times out and the case is marked as failed. The default timeout if you do not specify one is 180 seconds.

<timeout>10</timeout>

Note: This timeout setting may not always work when using SSL/HTTPS.

Plugin Mode (reporttype)

This setting is used to enable output formatting that is compatible for use with specific external programs. The available values you can set this to are:

  • nagios - Output of WebInject in console mode will be compatible for use as a plugin for the Nagios monitoring program.
<reporttype>nagios</reporttype>
  • mrtg - Output of WebInject in console mode will be compatible for use as a plugin (external monitoring script) for the MRTG (Multi Router Traffic Grapher) program.
<reporttype>mrtg</reporttype>
  • external - Calls an external Perl module for post processing. You may write a Perl module that will be called after WebInject is finished running. Your module may access any of WebInject's global variables. This can be used to integrate with other external programs or to do any type of data processing at the end of your test run.
<reporttype>standard:Plugin.pm</reporttype>

Sample Plugin.pm - this will send an email after WebInject runs:

$message = "Passed: $casepassedcount,  Failed: $casefailedcount"; 
exec(qq~ echo $message | mailx -s "WebInject Results" corey\@webinject.org ~);
  • standard - Standard formatted output mode (omitting this setting defaults to 'standard' mode).
<reporttype>standard</reporttype>

Note: Most output logging is suppressed when running in a Plugin Mode (reporttype).

Global Timeout (globaltimeout)

This setting is used when running in Nagios Plugin Mode (in combination with nagios reporttype). The value [given in seconds] will be compared to the global time elapsed to run all the tests. If the tests have all been successful, but have taken more time than the 'globaltimeout' value, a warning message is sent back to Nagios.

<globaltimeout>10</globaltimeout>
Plotter Path (gnuplot)

Defines the path/location of the gnuplot executable on your system. This is only necessary to set if would like to have WebInject use gnuplot to create response time graphs and you have gnuplot installed somewhere on your system that is not on your PATH.

<gnuplot>/usr/bin/gnuplot</gnuplot>
Standalone Mode Plotting (standaloneplot)

Tells WebInject to create response time graphs when running in standalone/console mode (webinject.pl). Unless this is set to 'on', plotting/graphing is only available in GUI mode. A PNG image (plot.png) is generated in the current [webinject] directory.

<standaloneplot>on</standaloneplot>

Test Case Files

If you are using the GUI (webinjectgui.pl or webinjectgui.exe) to run your tests, you can not pass a test case filename from the command line (or use any other command line options). Instead, they are read out of config.xml. One of the configuration file settings in config.xml is used to name the test case files which you have created. You may specify any amount of test case files to process by placing each file name inside the proper (<testcasefile>) xml tags. If there is no configuration setting used to name your test case file(s), it will default to using a file named 'testcases.xml' in the current [webinject] directory. The files are processed in the order they appear in your config file.

A configuration file listing 3 test case files to process (tests_1.xml, tests_2.xml, tests_3.xml) may look something like:

tests_1.xml tests_2.xml tests_3.xml

Note: You can also use relative path names to point to test case files located in other directories or subdirectories.

Command Line Options

You can run the WebInject Engine (webinject.pl) in standalone/console mode by calling it directly from the command line rather than from the [webinjectgui] GUI. When you do this, you can optionally pass it a test case file name and several command line options.

Usage:

webinject.pl [-c|--config config_file] [-o|--output output_location] [-n|--no-output] [testcase_file [XPath]]

or

webinject.pl --version|-v

Available Command Line Options
  • -c or --config : This option is followed by a config file name. This is used to specify an alternate configuration file besides the default (config.xml). To specify a config file in a different directory, you must use the relative path to it.
    Note: relative path from the webinject directory.

  • -o or --output : This option is followed by a directory name or a prefix to prepended to the output files. This is used to specify the location for writing output files (http.log, results.html, and results.xml). If a directory name is supplied (use either an absolute or relative path and make sure to add the trailing slash), all output files are written to this directory. If the trailing slash is ommitted, it is assumed to a prefix and this will be prepended to the output files. You may also use a combination of a directory and prefix.

    To clarify, here are some examples:

    To have all your output files written to the /foo directory:

    perl webinject.pl -o /foo/

    To have all your output files written to the foo subdirectory under your WebInject home directory:

    perl webinject.pl -o ./foo/

    To create a prefix for your output files (this will create output files named foohttp.log, fooresults.html, and fooresults.xml in the WebInject home directory):

    perl webinject.pl -o foo

    To use a combination of a directory and a prefix (this will create output files named foohttp.log, fooresults.html, and fooresults.xml in the /bar directory):

    perl webinject.pl -o /bar/foo

    Note: MS Windows style directory naming also works.
    Note: You must still have write access to the directory where WebInject resides, even when writing output elsewhere.

  • -n or --no-output : Suppresses all output to STDOUT except the results summary.

  • -v or --version : Displays the version number and other information.

Note: Command line options are only available when launching the WebInject Engine (webinject.pl) on its own, not from the GUI.

Test Case Setup

Summary

Test cases are written in XML files (using XML elements and attributes) and passed to the WebInject engine for execution against the application/service under test. This abstracts the internals of WebInject's implementation away from the non-technical tester, while using an open architecture [written in Perl] for those that require more customization or modifications.

There are several parameters (attributes) you can use in your cases, depending on what you are trying to accomplish. The only required parameters are the 'id' and the 'url'. If no verification parameters (verifypositive, verifynegative, verifyresponsecode, etc) are provided, the test case will be marked as "FAILED" if the HTTP request returns an HTTP Response Code that is not in the 100-399 range. See the "Pass/Fail Critera" section of this manual for more information.

Minimal Example

A minimal test case may look something like:

<case
    id="1"
    url="http://myserver/test/test.html"
/>

Available Parameters

id

Test case identifier used to identify the test case and set it's execution order.

description1

Text description for results report.

description2

Text description for results report.

method

HTTP request method, can be "get" or "post". This defaults to "get" if the parameter is omitted.

url

Full HTTP URL to request. You can use an IP Address or Host Name.

posttype

This parameter specifies the content type encoding used in submitting a form to the server ("Content-Type" field in the HTTP Header). This is only used in an HTTP POST (method="post"). The possible values are:

  • "application/x-www-form-urlencoded"
  • "multipart/form-data"
  • "text/xml"
  • "application/soap+xml"

Defaults to "application/x-www-form-urlencoded" if this parameter is omitted.

postbody

This is the data (body) of the request to be sent to the server. This is only used in an HTTP POST (method="post").

If you are sending "application/x-www-form-urlencoded" data, this parameter contains the string of text data you wish to send.

If you are sending "multipart/form-data" (used for form-based file upload as specified in RFC 1867), this parameter contains a string that represents the Perl code used to define the "Content" parameter of the Perl "POST" function. This string will be evaluated by the Perl interpreter using "eval". More details about the syntax can be found in the Perl documentation of the HTTP::Request::Common module. (sorry if this is a little cryptic, the example below should help).

If you are sending "text/xml" or "application/soap+xml" (used for web services), this parameter contains a link to an external file that contains the text (xml payload) that will be sent in the body of your request. This is done using the file=> syntax.
Example: postbody="file=>soap_payload.xml"

verifyresponsecode

HTTP response code for verification. Verification fails if the HTTP response code you specified does not match the HTTP response code you receive.

verifypositive

String in response for positive verification. Verification fails if this string does not exist in the HTTP response. This is matched as a Perl regular expression, so you can do some complex verification patterns if you are familar with using regex matching.

Note: Because your verification string is used as a regex, the following characters within it must be escaped with a backslash: {}[]()^$.|*+?\

verifypositive1

Additional positive verification. This works the same as 'verifypositive'.

verifypositive2

Additional positive verification. This works the same as 'verifypositive'.

verifypositive3

Additional positive verification. This works the same as 'verifypositive'.

verifynegative

String in response for negative verification. Verification fails if this string exists in the HTTP response. This is matched as a Perl regular expression, so you can do some complex verification patterns if you are familar with using regex matching.

Note: Because your verification string is used as a regex, the following characters within it must be escaped with a backslash: {}[]()^$.|*+?\

verifynegative1

Additional negative verification. This works the same as 'verifynegative'.

verifynegative2

Additional negative verification. This works the same as 'verifynegative'.

verifynegative3

Additional negative verification. This works the same as 'verifynegative'.

verifynextpositive

String in response for positive verification on next test case. Verification fails if this string does not exist in the HTTP response of the next test case that is executed.

verifynextnegative

String in response for negative verification on next test case. Verification fails if this string exists in the HTTP response of the next test case that is executed.

logrequest

Set to "yes" to log (in http.log) the HTTP request sent for the current test case. Logging disabled if this parameter is omitted or not equal to "yes".

logresponse

Set to "yes" to log (in http.log) the HTTP response received for the current test case. Logging disabled if this parameter is omitted or not equal to "yes".

parseresponse

Parse a string from the HTTP response for use in subsequent requests. This is mostly used for passing Session ID's, but can be applied to any case where you need to pass a dynamically generated value. It takes the arguments in the format "leftboundary|rightboundary", and an optional third argument "leftboundary|rightboundary|escape" when you want to force escaping of all non-alphanumeric characters. See the "Session Handling and State Management - Parsing Response Data & Embedded Session ID's" section of this manual for details and examples on how to use this parameter.

Note: You may need to prepend a backslash before certain reserved characters when parsing (sorry that is rather vague).

Note: Newlines (\n) are also valid boundaries and are useful when you need to use the end of the line as a boundary.

parseresponse1

Additional parameter for response parsing.

parseresponse2

Additional parameter for response parsing.

parseresponse3

Additional parameter for response parsing.

parseresponse4

Additional parameter for response parsing.

parseresponse5

Additional parameter for response parsing.

sleep

Number of seconds to sleep after the test case. This used to add spacing between cases in order to throttle the rate it sends requests.

Note: The WebInject GUI runs in a single process/thread. Therefore, the GUI will not be responsive during the time it is "sleeping".

errormessage

If a test case fails, this custom 'errormessage' will be appended to the 'TEST CASE FAILED' line (on STDOUT and the HTML Report). This may be useful to give a bit more information on what a failed test means, like "couldn't connect to the application" or "couldn't access the login page".

addheader

This is used to add an addition header to an outgoing HTTP request.

Example: addheader="SOAPAction: urn:example-org:demos#Method"

You may add multiple headers, separating each with a pipe character.

Example: addheader="Foo: bar|Boo: far"

Full Examples

Sample test cases using multiple parameters:

<case
    id="1"
    description1="short description"
    description2="long description"
    method="post"
    url="http://myserver/test/login.jsp"
    postbody="username=corey&password=welcome"
    verifypositive="verify this string exists"
    verifynegative="verify this string does not exist"
    logrequest="yes"
    logresponse="yes"
    sleep="3"
/>

<case
    id="2"
    description1="short description"
    description2="long description"
    method="get"
    url="http://myserver/test/send.jsp?value={TIMESTAMP}"
    verifypositive="verify this string exists"
    verifynextpositive="{TIMESTAMP}"
/>

Here is a sample test case showing a "multipart/form-data" encoded form-based file upload:

<case 
    id="1" 
    description1="sample test case - POST" 
    description2="verify file upload" 
    method="post" 
    url="http://cgi-lib.berkeley.edu/ex/fup.cgi" 
    postbody="( upfile => ['config.xml'], note => 'MYCOMMENT' )" 
    posttype="multipart/form-data" 
    logrequest="yes" 
    logresponse="yes" 
    verifypositive="MYCOMMENT" 
/>

Numbering Test Cases

Test Cases are numbered using the "id=" parameter. They will be sorted and executed in sequential order based on these numbers, not the physical position of the Test Case within your file. You are allowed to leave gaps in the numbering and have them in any order in the file.

Parent XML Tags

Make sure your entire set of test cases is wrapped with the proper parent tags:

Your file should begin with:

<testcases>

and end with:

</testcases>

There is also a "repeat" attribute you can set within the parent tag to specify the number of times you would like a file of test cases to run.

For example, to have a test case file run 5 times, your file should open with:

<testcases repeat="5">

Valid XML

You may only use valid XML in your test cases. Malformed XML or mixed content will not be accepted by the parser that is used to read the test cases.

However, you may find it necessary to use such characters within an XML Attribute to define your test case. Most of these situations are handled programmatically behind the scenes for you as a user. For example, the "&" character would normally not be acceptable to an XML parser since it is a reserved character. Since this character is used in URL query strings (which are necessary in many/most test cases), it is handled as a special case and you may use them within your test case XML.

There are two special cases to be aware of:

less than (<) character:

Anywhere you use this character in your test cases (except of course, enclosing your actual XML tags), you must escape it with a backslash (failure to do so will make the test case parser croak).

For example, the following testcase parameter will not work like this:

verifypositive="<OPTION SELECTED>APPLE"

Instead, it should be written like:

verifypositive="\<OPTION SELECTED>APPLE"
quotes (single or double):

If you need to use quotes anywhere within a test case parameter, you need to make sure that the quotes are nested properly. The quotes (single or double) used to encapsulate your attribute must be different from the quotes you use within your attribute (both single and double quotes are valid to encapsulate an XML attribute).

For example:

verifypositive=" "this" "

will not work

verifypositive=' 'this' '

will not work

verifypositive=" 'this' "

is valid

verifypositive=' "this" '

is valid

Variables and Constants

Certain constants and variables can be passed from your test cases to the WebInject engine. They may be used in a test case as a keyword contained within curly braces, and are evaluated/substituted at runtime.

  • {TIMESTAMP} : Substituted with the current timestamp (floating seconds since the epoch, accurate to microseconds)
  • {PARSEDRESULT}: Substituted with the result of the response parsing from a 'parseresponse' test case parameter
  • {PARSEDRESULT1} : Substituted with the result of the response parsing from a 'parseresponse1' test case parameter
  • {PARSEDRESULT2} : Substituted with the result of the response parsing from a 'parseresponse2' test case parameter
  • {PARSEDRESULT3} : Substituted with the result of the response parsing from a 'parseresponse3' test case parameter
  • {PARSEDRESULT4} : Substituted with the result of the response parsing from a 'parseresponse4' test case parameter
  • {PARSEDRESULT5} : Substituted with the result of the response parsing from a 'parseresponse5' test case parameter

(See the "Parsing Response Data & Embedded Session ID's" section for details and examples on how to use these {PARSEDRESULT} variables)

  • {BASEURL} : Substituted with the value for 'baseurl' specified in your config file
  • {BASEURL1} : Substituted with the value for 'baseurl1' specified in your config file
  • {BASEURL2} : Substituted with the value for 'baseurl2' specified in your config file

{BASEURL} Example:

If you a have a test case that uses the parameter:

    url="http://myserver/test/login.jsp"

You could create this line in your config.xml file:

    <baseurl>http://myserver</baseurl>

You can then rewrite the test case parameter as:

    url="{BASEURL}/test/login.jsp"

This is helpful if you want to point your tests at different environments by changing a single setting.

Setting Variables/Constants Within Test Case Files:

You may also set constants in your test case file that you can reference from your test cases. This makes it convenient to change data in a single place that is easy to reference from multiple test cases.

The following example of a test case file shows how you can use them:

    <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>

Pass/Fail Criteria

Verifications

In each test case, you can set Verifications that will pass or fail depending on the existence of a specified text string (or regex) in the content of the HTTP response you receive.

'verifypositive' - This Verification fails if the string you specified does not exist in the HTTP response you receive.
'verifynegative' - This Verification fails if the string you specified exists in the HTTP response you receive.

'verifypositive1', 'verifypositive2', 'verifypositive3', 'verifynegative1', 'verifynegative2', 'verifynegative3' work the same way.

'verifynextpositive' and 'verifynextnegative' work the same way, but the verification takes place on the next test case rather than the current one.

HTTP Response Code

In each test case, you can set a Verifications that will pass or fail depending on the HTTP response code.

'verifyresponsecode' - This Verification fails if the HTTP response code you specified does not match the HTTP response code you receive.

If you do not specify this test case parameter, the HTTP Response Code Verification is marked as "Failed" if the HTTP request returns an HTTP response code that is not in the success range (100-399). It is marked as "Passed" if the HTTP Response Code is in the success range (100-399).

Test Case Status

If any of the Verifications defined within a test case fail, or if the HTTP Response Code Verification fails, the test case is marked as "FAILED". If all of the Verifications defined within a test case pass, and the HTTP Response Code Verification passes, the test case is marked as "PASSED". These items are updated in real-time during execution.

Output/Results

Results Display

Results of the test execution are displayed in tabbed windows on the User Interface if you are running the WebInject GUI. Not all of the status details displayed in 'results.html' are shown in the Status window on the UI. Response times, runtime statistics, and a response time graph (when gnuplot is configured) are displayed in the Monitor window on the UI.

Results File (HTML)

An HTML file (results.html) is generated to display detailed results of the test execution. It is written into the directory that WebInject runs from and is overwritten each time the tool runs. The file contains data passed from the test case file (test case identifiers/descriptions, etc) as well as information generated from the test engine (test case pass/fail status, execution times, etc). This is where the most detailed results data can be found.

Note: Most output logging is suppressed when running in a Plugin Mode (reporttype).

Results File (XML)

An XML file (results.xml) is generated to display results of the test execution. It is written into the directory that WebInject runs from and is overwritten each time the tool runs. The file contains data passed from the test case file (test case identifiers/descriptions, etc) as well as information generated from the test engine (test case pass/fail status, execution times, etc).

Note: Most output logging is suppressed when running in a Plugin Mode (reporttype).

Results in STDOUT

If you are running the WebInject Engine (webinject.pl) as a standalone test runner (text/console application), results are sent [in plain text format] to the STDOUT channel as the tests execute. The same level of detail that is written to results.html is also written here.

Note: The results sent to STDOUT will be different if when running in a Plugin Mode (reporttype).

HTTP Log File

A log file (http.log) is generated to capture HTTP requests that are sent to the web server of the system under test and HTTP responses that are received from the system under test. Whether or not HTTP logging is turned on depends on a setting in the configuration file and if you have logging parameters turned on in each test case. See the "Configuration - Configuration File (config.xml)" and "Test Case Setup - Available Parameters" sections of this manual for more information on logging to the http.log file.

Note: Most output logging is suppressed when running in a Plugin Mode (reporttype).
Note: "Content-Length" and "Host" HTTP headers are automatically added to outgoing HTTP POST requests, but are not shown in http.log.

Session Handling

Summary

HTTP is a stateless protocol, meaning each request is discrete and unrelated to those that precede or follow. Because of the stateless nature of the protocol itself, web applications or services use various other methods to maintain state. This allows client connections to be tracked and connection-specific data to be maintained. If your server requires the client to maintain state during a session, then your test tool must be able to handle this as well.

Cookies

One way to maintain session state is with HTTP Cookies. WebInject automatically handles Cookies for you (like a browser would). When a "Set-Cookie" is sent back in the HTTP header from the web server, the Cookie is automatically stored and sent back with subsequent requests to the domain it was set from.

Parsing Response Data

Embedded Session ID's ("Cookieless" session management) is another approach to maintaining state. Session ID's are written to the content of the HTTP response that is sent to the client. When the client makes a subsequent HTTP request, the Session ID string must be sent back to the server so it can identify the request and match it with a unique session variable it is storing internally. The client sends the string embedded in the URL or embedded in the post body data of each HTTP request.

In order to do this, WebInject provides a method of parsing data from an HTTP response to be resent in subsequent requests. This is done using the 'parseresponse' parameter and the {PARSEDRESULT} variable in your test cases.

There are also 5 additional parsing parameters/variables available if you need to parse multiple values from a single response. They work the same as these and are named:

parseresponse1/{PARSEDRESULT1}  
parseresponse2/{PARSEDRESULT2}  
parseresponse3/{PARSEDRESULT3}  
parseresponse4/{PARSEDRESULT4}  
parseresponse5/{PARSEDRESULT5}

Note: This parsing mechanism may be used for any situation where you need to resend data to the server that was sent to you in a previous response. There are other circumstances besides maintaining session where this may be useful.

Example of maintaining the ViewState with ASP.NET:

ASP.NET may use a "__VIEWSTATE" variable to maintain state between requests. When you request a page that uses this, you will see it as a hidden form field within the HTML source:

<html>
...
<form method="post" action="default.aspx">
<input type="hidden" name="__VIEWSTATE" value="dDwtMTA4NzczMzUxMjs7Ps1HmLfiYGewI+2JaAxhcpiCtj52" />
...
</html>

To maintain state, you need to grab this value so you can resend it in subsequent requests. To do this, you would add the following parameter to your test case:

parseresponse='__VIEWSTATE" value="|"|escape'

This will grab whatever is between the left boundary (__VIEWSTATE" value=") and the right boundary (") and assign to the system variable named {PARSEDRESULT}. Since the 'escape' argument was used, it will also escape all of the non-alphanumeric characters with their url hex values (.NET requires this). (Notice I switched to using single quotes for the parameter value so it wouldn't get confused with the double quotes I was using in my boundaries.)

Whenever you use the {PARSEDRESULT} variable in a subsequent test case, it will be substituted with the last value you parsed:

postbody="value=123&__VIEWSTATE={PARSEDRESULT}"

Will be sent to the server as:

value=123&__VIEWSTATE=dDwtNTA4NzczMzUxMjs6Ps1HmLfiYGewI%2b2JaAxhcpiCtj52
Example of parsing the Session ID from an HTTP response header and sending it as part of the URL:

You may receive a Session ID in a HTTP response header that needs to be parsed and resent to the server as part of a URL rather than in a cookie.

To parse the Session ID from a header that contains:

Set-Cookie: JSESSIONID=16CD67F723A6D2218CE73AEAEA899FD9; Path=/

You would add the following parameter to your test case:

parseresponse="JSESSIONID=|;"

This will grab whatever is between the left boundary (JSESSIONID=) and the right boundary (;) and assign to the system variable named {PARSEDRESULT}.

Now whenever you use the {PARSEDRESULT} variable in a subsequent test case, it will be substituted with the last value you parsed:

url="http://myserver/search.jsp?value=123&;JSESSIONID={PARSEDRESULT}"

Will be sent to the server as:

http://myserver/search.jsp?value=123&;JSESSIONID=16CD67F723A6D2218CE73AEAEA899FD9

User Interface

General

Summary

The User Interface (webinjectgui.pl or webinject.exe) is a small [Perl/Tk] GUI wrapper used to run the WebInject Engine (webinject.pl).

Status Bar

The status bar shows visual progress of the current iteration of the test case file being processed. If you are using the "repeat" attribute to run multiple iterations of a test case file, the status bar will reset as each iteration starts. If you have multiple test case files configured to run, the status bar will reset as each new test case file is loaded for execution.

Engine Status Window

This window shows the status of the WebInject engine as it runs. It displays when execution begins, the current test case file it is processing, and when execution finishes.

Status Light

The status light is the small box next to the status bar. While your tests are running, the light will turn amber. After your tests complete, the status light will turn either red or green. If all test cases passed, the light turns green. If any verifications failed, it turns red.

Disable Monitor

This checkbox is used to completely disable the Monitor Window and all of it's underlying real-time monitoring functionality (including graph generation). This can not be selected during a test run. It must be enabled or disabled before execution begins.

Status Window

Minimal Output

Selecting this option before you run your test cases will suppress details of each test case from being displayed in the output window. The only information displayed for each case is "PASSED" or "FAILED".

Response Timer Output

Selecting this option before you run your test cases will display the server response time for each case as it runs.

Monitor Window

Response Time Graph

This graph displays response times in seconds for TTLB (time to last byte) of HTTP requests sent during execution. The timer contains the round trip time for the request/response. As responses are received, a new graph is generated and displayed to the Monitor Window in real-time, replacing the previous one.

The x-axis represents response time in seconds

The y-axis represents the time of day. Initially the values shown correspond to the minutes after the hour, but then adjust to the appropriate setting as time elapses.

The scale of the axes adjusts automatically to fit the data being displayed.

Response Times

This shows response times in seconds for TTLB (time to last byte) of HTTP requests sent during execution. The timer contains the round trip time for the request/response. Values for Min, Max, and Avg responses are displayed.

Runtime Counts

This shows counter values for the current execution. Values for the total number of test cases run (total), passed, and failed are displayed.

Line Graph

Selecting this changes the graph style to a line graph. It is effective as of the next time the graph image is updated. This is the default graph style.

Impulse Graph

Selecting this changes the graph style to an impulse graph. It is effective as of the next time the graph image is updated.

No Graph

Selecting this turns off generation and display of the graph. Normally, as responses are received a new graph is generated and displayed to the Monitor Window in real-time, replacing the previous one. This can take time and resources (CPU), especially when there is a large data set to be plotted. Resource usage will be most apparent when response times are quick, as the graph will need to be re-generated at a faster rate. If you do not want any time and resources spent creating the graphs, you may select this "No Graph" option. It can be changed during execution to turn on and off graphing as necessary. Response time data is still collected while this option is selected.

Clear Graph

Clicking this button clears (resets) the graph. It is effective as of the next time the graph image is updated.

Nagios Enterprises, LLC

© All rights reserved. 2026