WEB User Experience Monitoring (WUX)

Introduction to WUX with Pandora FMS

WEB User Experience Monitoring (User Experience Monitoring, UX Monitoring or simply WUX in Pandora FMS terminology) is the process of collecting, analyzing and evaluating data on how users interact with a website or web application in real time. Its goal is to detect performance, usability and accessibility issues in order to improve user experience.

Pandora FMS WUX performs synthetic monitoring (Synthetic Monitoring) using a specialized backend for this purpose (Selenium®). This means that Pandora FMS uses a real browser to interact with remote websites (Google Chrome®, Mozilla Firefox®, etc.).

  • It detects problems before real users experience them. It collects real-time browsing data from real users (webscrapping).
  • It measures metrics such as load time, interactions, errors and user behavior (web analytics).
  • Examples: Measuring page load, response times, screenshots (of the web), testing on different devices, testing complex applications that require logging, JavaScript® interaction, text inputs, passing data from one field to another as if done by a user, mouse clicks, waiting times, and so on.

What is the difference between WUX and the other WEB monitoring that Pandora FMS performs with the WEB Server?

The WEB Server uses basic HTTP requests, and while it can simulate sessions, it is not a real browser, so it cannot run JavaScript or emulate a modern browser. Normal WEB tests are fine for simple WEB tests, WUX is much more powerful.

What different WUX versions does Pandora FMS have?

  • Agent-based WUX (Selenium version 2), up to version 740.
  • WUX centralized in the WUX Server (Selenium 3), up to version 780.
  • WUX centralized as plugin of Discovery PFMS (Selenium 4), since version 780.

In versions prior to 780, WUX ran as part of Pandora FMS server (WUX Server). Although it is still possible, the setup is more complex than using WUX in centralized mode with Discovery PFMS.

WUX centralized in Discovery PFMS is also based on Selenium 4 and may be used (optionally) from an agent as plugin. Transactional files (.side) that worked in a WUX Server will work in WUX Discovery PFMS.

Information on how to use WUX Server (Selenium 3) may be found in the annex WUX monitoring.

WUX / Discovery architecture

The operation of this plugin for Selenium 4 is carried out thanks to Pandora FMS Discovery Server. As mentioned, previously a dedicated server known as WUX Server was used exclusively and it is also possible to use Discovery PFMS for this purpose.

It is now able to perform executions using Selenium 4, hence its name, and it also supports Selenium 3 transactions (which may have been previously executed in an environment thanks to a WUX Server).

Regarding transaction executions, there are 4 different methods for connecting to Selenium, which will be discussed in more detail below, along with the requirements that must be met to ensure correct operation.

Prerequisites

The main requirement is that the server from which the plugin is executed must be able to connect to Selenium 4 stack, and this in turn must be able to communicate with the URLs of the websites to be monitored.

This WUX plugin has four different Selenium connection methods to be run in each transaction, so you will have to adjust the requirements to the desired execution mode for each case.

Local Driver

The plugin will use the drivers for Google Chrome or Mozilla Firefox found on the computer where it is executed. By default, these components will be searched for in the following paths, although different paths may be specified if necessary.

Google Chrome binary:

/usr/share/pandora_server/util/selenium_headless_drivers/chrome/google-chrome

Chromedriver:

/usr/share/pandora_server/util/selenium_headless_drivers/chromedriver

Mozilla Firefox binary:

/usr/share/pandora_server/util/selenium_headless_drivers/firefox/firefox

Geckodriver:

/usr/share/pandora_server/util/selenium_headless_drivers/geckodriver

These drivers may be downloaded from Pandora FMS library in a package and unzipped in the default path.

In order for browsers to start in this mode, their specific dependencies must also be installed on the system.

  • Mozilla Firefox: gtk3, alsa-lib, libX11-xcb.
  • Google Chrome: nss, libdrm, mesa-libgbm.

Remote Driver

The plugin will connect to a Selenium 4 server indicated by its URL, so it will be necessary to have access from the server running the plugin to Selenium 4 server through its listening port (by default 4444 TCP).

Local Docker

The plugin will start a Docker container on the server where it runs using an image containing the specified drivers for the local driver mode, allowing to separate the dependencies from the real machine.

By default, image pandorafms/pandora_selenium_headless will be used (although it will be possible to specify a different one for each execution), and the drivers will be searched inside the Docker in the following paths:

  • Google Chrome binary: /tmp/lib/chrome/google-chrome.
  • Chromedriver: /tmp/lib/chromedriver.
  • Mozilla Firefox binary: /tmp/lib/firefox/firefox.
  • Geckodriver: /tmp/lib/geckodriver.

Remote Docker

The plugin will connect through SSH with username and password to a remote server, on which it will run a copy of the plugin itself (copied at the time) in local docker mode. Therefore, along with the above mode requirements, also allow connectivity to the remote server through SSH with the specified credentials on the specified port (default 22 TCP).

The user specified for SSH connection must have sufficient permissions to start the Docker container and access the files copied to the temporary directory. A temporary directory will be used to copy the files to the remote server (by default /tmp), although a different path may be specified for each run.

Optional requirements

For all execution modes it will be possible, if desired, to make use of Google Chrome or Mozilla Firefox profiles for each transaction. If this feature is used, it must be ensured that the server where the transaction is started (either local or remote) contains the paths to these profiles.

In Docker execution modes (local, remote), it will be the host server that must have the paths to the profile folders, as the plugin will build those folders as volumes of the container it starts.

It will also be possible to monitor connection statistics to the main URL of the SIDE indicated in each execution. To do so, it will be necessary to have the curl executable installed on the computer where the plugin is launched.

Note that if the test execution is done in remote driver mode, statistics will not be obtained from Selenium 4 server, but from the server running the plugin.

Using WUX with Discovery PFMS

Discovery PFMS plugin install

To be able to use WUX monitoring with Selenium 4, you should previously install .disco in the Discovery section of Pandora FMS Web Console. This may be done from the Manage disco packages view, selecting the .disco file to download from Pandora FMS library for this plugin:

Transaction recording with Selenium IDE

In order to run these transactions, they must be previously saved using the Selenium IDE extension available for Google Chrome or Mozilla Firefox browsers. After opening the extension, you will be asked to choose whether you wish to save in a new project, open an existing one, create a new project or simply close the extension.

If you choose the first option, you will be prompted to name the project you are creating and then enter the base URL for recording.

If you choose the third option, you will only be asked to enter the project name, so if you do not have any previous recordings, you will also have to manually enter the base URL address to start recording.

Once the extension is ready with these previous steps, the next thing to do is to click REC located in the upper right section of the screen. A new window will open in the selected browser and will load the page indicated in the URL base section. From this moment on, any action performed on this window will be saved in the Selenium IDE extension project.

Once all the actions to be monitored later in the transaction execution have been performed, click Stop recording (where the REC button was previously located) to stop recording. You will be prompted to enter a name for the transaction test. A project in a recording is made up by one or several tests, that will be executed in a sequential way later, in case there is more than one, when loading it later in Pandora FMS. A new agent will be created for each test in a project.

Subsequently, a view similar to the following will appear:

If desired, there is the possibility of adding additional commands manually, such as stage separators, comments or wait commands (wait).

In the section Commands of the SIDE files is the complete list of supported commands.

To add them to the current recording, right-click on any of the existing commands and click Insert new command:

This will insert an empty command line above the clicked command, which may be edited to add the command manually. Just enter the desired command in the Command field:

For example, to add a stage start command should be used:

//phase_start:phase_name

Compared to previous versions, it will not be necessary to indicate the end of stage to close it, this will be automatically detected when a new phase_start command appears or, failing that, the transaction ends.

When the recording is finished and you have finished configuring the additional commands that you wish to use, you can generate the .side file, whose content will be the one that can be used in the configuration of the plugin execution. To do this, click on the diskette icon at the top right of the Selenium IDE window, name the file in a path that may be easily found and save it.

Once the .side file has been generated, if you open it, you will see that it is actually a JSON file. This content in JSON format is what must be copied and pasted in the Selenium IDE JSON box of the Test setup step of the plugin configuration, which you will see below.

Transaction execution from Discovery

To be able to execute the recordings from Discovery tool in Pandora FMS Web Console, you should create a task using Selenium 4 from the Applications menu (Management → Discovery → Applications):

A name must be specified for the task and a group must be assigned to it. It is possible to add a description and modify other important parameters such as interval time or type of execution:

The following parameters will appear in the next step:

These will allow you to choose one of the four available execution modes mentioned above, in addition to indicating in which web browser the transaction will be executed. For compatibility purposes, it is recommended for it to be the same browser where the transaction was saved with Selenium IDE.

Once the type of execution has been indicated, depending on which of the options has been chosen, different configuration options will appear.

Local Docker

By default, the image to be used is indicated, so do not fill in anything unless you want to use a different image. If it is necessary to use the profile of a specific user in the transaction execution, the user must be indicated. You may also specify the path for the browser profiles used.

Remote Docker

The data required to connect through SSH to the remote server that will execute the task must be specified. For data connection, the fields IP address or FQDN, SSH port, and access credentials will be required.

The temporary path will host the files needed to carry out the execution, and the rest of the fields are the same as in the execution of Local Docker.

Local Driver

In this type of execution you may indicate the path to the drivers needed to carry out the execution and that may be downloaded from Pandora FMS library.

As for the tokens that may be found at the bottom:

  • Virtual display: Used for the execution to use a virtual desktop. If not specified, the server running the task is required to have a physical desktop (monitor) attached.
  • Headless driver: For the browser used to run in this mode, which is suitable for non-desktop environments.

It is recommended to leave both tokens checked.

Remote Driver

In the fourth available mode, connection URL to the remote driver must be specified. The operation of the user and profile parameters is the mentioned above.

After selecting the connection mode, a last step must be configured before finalizing task configuration.

It is possible to specify acceptance of unsecured certificates and monitoring of time statistics. There are also other configuration parameters such as the screen resolution at which the transaction will be executed, the global timeout time and the waiting time between recording commands.

Finally, as indicated in the transaction recording step, the JSON content of the .side format must be entered in the last field named Selenium IDE JSON.

After the task is configured, it will run automatically after a few seconds, or it will be necessary to force the task to run manually, depending on how the task was configured in the first step.

When the execution is finished, you may check the summary view, which will indicate which agents were created from the task, which ones belong to test agents and how many there are of each type.

Discovery PFMS Task Results

In the case of the example, the Selenium project has been named Selenium 4 and has two different tests called Test 1 and Test 2. If during task configuration, the option Monitor time statistics is checked, an agent will be created with the name of the project that will host performance data.

On the other hand, recorded transaction agents will also be created, one for each test. In this case, there will be two agents with names Test 1 and Test 2:

Monitor results

After execution, agents will be created with the transaction data and will contain the modules for transaction execution. The agent with the performance data will also contain the modules for this information and Monitor time statistics option must be previously enabled in the last step of task configuration.

Modules that are added to test agents are at least the following three:

  1. Global status: It indicates whether the test was completed correctly or failed at some point.
  2. Global time: This is a numerical module that indicates the number of seconds it took to complete the test.
  3. Last error screenshot: If the test failed, a screenshot of what appears in the browser at the time the failure took place is stored in this module.

In the Global status description and Last error screenshot modules, the text of the error returned by the Selenium engine is indicated.

If stages have been configured in the transaction, modules indicating the status and time of each stage are created in addition to the previous ones. It is important to know that the Global time does not have to be a sum of the time modules of each stage, since the Global time also includes the times used by the browser to open and close, to name a few examples.

As for performance data, they indicate the time in milliseconds it took to perform each of the operations until reaching the site. In this case they would be:

  • URL stat DNS: Time for DNS resolution of the URL.
  • URL stat TSSL: Time to establish SSL connection.
  • URL stat TST: Time to receive the first byte.
  • URL stat TT: Total transaction time to access the URL.
  • URL stat TTC: TCP connection time.
  • URL stat TTCP: Time until connection is ready to transfer data.
  • URL status: It monitors whether the connection to the URL can be made.

On these modules, as in any other, you may create alerts, reports and other actions in the rest of Pandora FMS menu.

There is also a view in the agent dedicated only to WUX data. It may be found in the tabs at the top right:

In addition to widgets for Dashboards that make specific reference to WUX modules:

The recording shown above is a simple recording. In case the recording was configured to be divided into different phases, they will also be differentiated in the WUX data view:

And the same with widgets:

Finally, it is also possible to capture data from the web (webscrapping), which will be described later.

Manual execution (from an agent, as a plugin)

For manual execution you may configure a Software agent within Pandora FMS server itself that hosts the Selenium 4 plugin to perform these executions and to generate XML files for each one of them, to obtain different agents, each one with its corresponding modules.

To do this, the Selenium 4 plugin may be configured as an agent plugin using absolute paths, so that the path to the plugin file and the necessary configuration files may be indicated.

The template that can be used to configure the agent plugin using Selenium 4 looks like this:

module_plugin /var/spool/pandora/data_in/discovery/pandorafms.selenium.4/bin/pandora_selenium -c /path/to/configuration/file -s /path/to/side/file -t task_name -i agent_interval -g ID_group -x

It is important to take into account that the configuration file of the task and the .SIDE file loaded in the machine must be configured manually beforehand.

To prepare the configuration file, you may go to the “Parameters and configuration” section, where the data template to be filled in is located. In the case of the .SIDE file, just copy the file generated by the Selenium IDE extension.

It is important to apply the -x parameter, since it is in charge of generating the execution data in XML format to be processed later. In the case of default executions through Discovery, the data format received is JSON:

If you wish, it is also possible to execute the plugin from a Software Agent that is not installed in the same server as Pandora FMS. For that, it is necessary to download locally in the server that hosts the Software Agent the .disk package of the plugin, rename it to modify its format to .zip and decompress the content to have access to the binary and to the rest of the files that it may need to work.

As for the necessary configuration, the file should also be created manually, as mentioned above, and -x parameters should also be used for sending data in XML format and -S to indicate the IP address and the port of the Tentacle server that will receive the XML, which is usually the same machine that hosts Pandora FMS server. The execution would have a similar aspect to the following:

module_plugin /path/to/binary/file/pandora_selenium -c /path/to/configuration/file -s /path/to/side/file -t task_name -i agent_interval -g ID_group -x -S IP_address_Tentacle_server:Tentacle_port

It is important to remember that each XML generated with this type of executions would correspond to a different agent, so modules would not be hosted inside the agent where the plugin is running.

Finally, it should be noted that, although it is possible to perform this type of executions, either manually from the terminal or from the Software Agent, the recommendation is to always carry them out from PFMS Discovery section, since the original operation method is designed to work in this way, and the task configuration is considerably simpler.

Parameters and configuration

Short parameter / long parameter Description
-v

--verbose
Optional. Displays information about the progress of the plugin execution by STDERR.
-c <task_configuration_file_path>

--conf <task_configuration_file_path>
Path to the configuration file of the task to be executed.
-s <side_file_path>

--side <side_file_path>
Path to the SIDE file to be executed.
-t <task_name>

--task <task_name>
Unique name of the task. It is used to generate temporary elements that do not overwrite those of other tasks that may be running on the same computer.
-i <agents_interval>

--interval <agents_interval>
Optional. Monitoring interval of the agents generated by the plugin. By default: 300.
-g <group_id>

--group <group_id>
Optional. ID of the group where you want to create the agents generated by the plugin. By default: 0.
-x

--xml_mode
Optional. If specified, the plugin will generate XML files for the agents instead of doing it through its STDOUT output.
-S <server:port>

--server <server:port>
Optional. For agent generation by XML. IP address and port of the Tentacle server to which to send the XML files.
-T <temp_folder>

--temp <temp_folder>
Optional. For agent generation by XML. Temporary directory for the XML files that are generated before being sent to the indicated Tentacle server.

Configuration file (--conf)

{
"worker_mode" : "<local | remote>",
"run_mode" : "<driver | docker>",
"browser" : "<chrome | firefox>",
"driver_url" : "http://<selenium_ip>:<selenium_port>/wd/hub",
"ssh_address" : "<ssh_ip>",
"ssh_port" : "<ssh_port>",
"ssh_user" : "<ssh_user>",
"ssh_password" : "<ssh_password>",
"ssh_password_encrypt" : "<1 | 0>",
"ssh_temp_folder" : "<ssh_temp_folder_path>",
"docker_image": "<docker_image>",
"chromedriver_path": "<chromedriver_path>",
"chrome_binary_path": "<chrome_binary_path>",
"chrome_user_data_dir" : "<chrome_user_data_dir>",
"chrome_profile" : "<chrome_profile>",
"geckodriver_path": "<geckodriver_path>",
"firefox_binary_path": "<firefox_binary_path>",
"firefox_profile" : "<firefox_profile>",
"accept_insecure_certs" : "<1 | 0>",
"monitor_stats" : "<1 | 0>",
"browser_width" : "<width>",
"browser_height" : "<height>",
"global_timeout" : "<seconds>",
"wait_between_commands" : "<seconds>"
}

Each configuration element:

worker_mode It indicates whether the transaction will be launched locally or remotely.
run_mode It indicates whether the plugin will run with drivers or in Docker.
browser It indicates the web browser to be used for the transaction.
driver_url It indicates the URL to Selenium 4 server
to execute the transaction.
Only in remote/driver mode.
ssh_address It indicates the IP address of the server to which it will connect by SSH to execute the plugin.
Only in remote/docker mode.
ssh_port Optional.
It indicates the port number for SSH connection.
By default: 22.
Only in remote/docker mode.
ssh_user It specifies the user for SSH connection.
Only in remote/docker mode.
ssh_password It indicates the user's password ssh_user.
Only in remote/docker mode.
ssh_password_encrypt Optional.
It indicates whether the above password is sent encrypted (1) or not (0).
Only in remote/docker mode.
Passwords may be encrypted by executing
the plugin from Pandora FMS Discovery server.
ssh_temp_folder Optional.
It specifies the path to the temporary directory for the necessary files
during execution on the SSH server.
By default: /tmp.
Only in remote/docker mode.
docker_image Optional.
It indicates the name of the Docker image to run the transaction.
By default: pandorafms/pandora_selenium_headless.
Only in docker mode.
chromedriver_path Optional.
It specifies the path to chromedriver binary.1)
Only in local/driver mode.
chrome_binary_path Optional.
It specifies the path to Google Chrome binary.2)
Only in local/driver mode.
chrome_user_data_dir Optional.
It specifies the path to the data directory (data dir) of Google Chrome that you wish to use.
chrome_profile Optional.
It specifies the name of the Google Chrome profile to be used.
It must be inside the data_dir.
If not specified, the browser's default profile will be used.
geckodriver_path It specifies the path to the geckodriver binary.3)
Only in local/driver mode.
firefox_binary_path It specifies the path to the Mozilla Firefox binary.4)
Only in local/driver mode.
firefox_profile Optional.
It specifies the path to Mozilla Firefox profile directory you wish to use.
If not specified, the browser's default profile will be used.
accept_insecure_certs Optional.
If set to 1, insecure SSL certificates from URLs accessed
during the transaction will be automatically accepted as valid.
monitor_stats Optional.
If it is indicated with value 1, connection statistics modules
will be generated to the main URL of the indicated SIDE file.
browser_width Optional.
It indicates the width of the web browser in pixels for the transaction.
By default: 1920.
browser_height Optional.
It indicates the height of the browser in pixels for the transaction.
By default: 1080.
global_timeout Optional.
It indicates the global timeout in seconds for tasks performed by the plugin,
such as connecting to Selenium server, starting browser drivers, etc.
It is also the default timeout used for Selenium commands to be executed.
By default: 5.
wait_between_commands Optional.
It indicates the time in seconds that the plugin
will wait between each SIDE command it executes.
This value may be adjusted with the SIDE itself
by means of the setSpeed command.
By default: 0.

For example:

{
    "worker_mode" : "local",
    "run_mode" : "driver",
    "browser" : "chrome",
    "driver_url" : "",
    "ssh_address" : "",
    "ssh_port" : "",
    "ssh_user" : "",
    "ssh_password" : "",
    "ssh_password_encrypt" : "",
    "ssh_temp_folder" : "",
    "docker_image": "",
    "chromedriver_path": "",
    "chrome_binary_path": "",
    "chrome_user_data_dir" : "",
    "chrome_profile" : "",
    "geckodriver_path": "",
    "firefox_binary_path": "",
    "firefox_profile" : "",
    "accept_insecure_certs" : "0",
    "monitor_stats" : "1",
    "browser_width" : "1920",
    "browser_height" : "1080",
    "global_timeout" : "10",
    "wait_between_commands" : "0.2"
}

Commands for .SIDE files

The following custom commands may be configured to generate additional modules (all custom commands must begin with //):

//phase_start:<phase_name> It indicates the beginning of a stage, which will
last until another //phase_start command is found
or until the end of the test.
This will generate a module with the status of the stage and another module with the time it has taken to complete.
For example: //phase_start:Login
//getValue;<module_name>;<module_type>;<regexp> It generates a module with content from the web page
which may be obtained by means of a regular expression
from the source code of the web page.
For example:
//getValue;Temperature;generic_data;<span class="temperature">(\d+\.*\,*\d*).*</span>
You would get the temperature indicated on a web page with this line in its source code:
<p> The temperature of the solar panel is: <span class="temperature">54 º C</span></p>
//getVariable;<module_name>;<module_type>;<variable> It generates a module with the content
of a variable stored in the SIDE with the following store commands.
For example:
//getVariable;List count;generic_data;listCount
//getScreenshot;<module_name> It generates a module with a screenshot of the current browser.
For example:
//getScreenshot;URL home

The commands of the SIDE files enabled to be executed with the plugin are the following (refer to the Selenium IDE documentation for its use):

addSelection
answerOnNextPrompt
assert
assertAlert
assertChecked
assertConfirmation
assertEditable
assertElementPresent
assertElementNotPresent
assertNotChecked
assertNotEditable
assertNotSelectedValue
assertNotText
assertPrompt
assertSelectedValue
assertSelectedLabel
assertText
assertTitle
assertValue
check
chooseCancelOnNextConfirmation
chooseCancelOnNextPrompt
chooseOkOnNextConfirmation
click
clickAt
close
do
doubleClick
doubleClickAt
dragAndDropToObject
editContent
else
elseIf
executeScript
executeAsyncScript
forEach
if
mouseDown
mouseDownAt
mouseMoveAt
mouseOut
mouseOver
mouseUp
mouseUpAt
open
pause
removeSelection
run
runScript
select
selectFrame
selectWindow
sendKeys
setSpeed
setWindowSize
store
storeAttribute
storeJson
storeText
storeTitle
storeValue
storeWindowHandle
storeXpathCount
submit
times
type
uncheck
verify
verifyChecked
verifyEditable
verifyElementPresent
verifyElementNotPresent
verifyNotChecked
verifyNotEditable
verifyNotSelectedValue
verifyNotText
verifySelectedLabel
verifySelectedValue
verifyText
verifyTitle
verifyValue
waitForElementEditable
waitForElementNotEditable
waitForElementNotPresent
waitForElementNotVisible
waitForElementPresent
waitForElementVisible
waitForText
webdriverAnswerOnVisiblePrompt
webdriverChooseCancelOnVisibleConfirmation
webdriverChooseCancelOnVisiblePrompt
webdriverChooseOkOnVisibleConfirmation
while

Web Scrapping

It is possible to do web scrapping with Pandora FMS, although it was designed to measure performance and complex transaction results, but it is feasible to do so.

Web scraping is a technique used to retrieve information from websites in an automated manner. Instead of collecting data manually, programs or scripts are used to browse web pages, identify relevant information and store it in a database or structured file.

What is described here may be used both for WUX in Discovery mode (Selenium 4 only) and for WUX in server-integrated mode (version 777 or earlier), with Selenium 3.

There are two basic ways to do this, the simplest is to take a value directly from a web page ID (using Selenium console extension's own inspector and passing it to Pandora FMS) or using a regexp to process HTML raw data. In both cases, an additional command must be entered to the Selenium transaction.

Example, using it as a webscrapper to read the number of ratings of an item in Amazon Store®, using the value capture and storing it in a variable:


It will be stored as type TEXT in a variable called REVIEW. And an additional command echo will be created to display the value of that variable:


Here you may see the last two steps in the .side code generated by the Selenium extension:

{
  "id": "55546183-fc2f-45b5-af7e-2ff27464798f",
  "comment": "",
  "command": "storeText",
  "target": "css=.a-spacing-medium> .a-size-base",
  "targets": [
    [
      "css=.a-spacing-medium> .a-size-base",
      "css:finder"
    ],
    [
      "xpath=//div[@id='cm_cr_dp_d_rating_histogram']/div[3]/span",
      "xpath:idRelative"
    ],
    [
      "xpath=//span/div/div/div/div/div/div[3]/span",
      "xpath:position"
    ]
  ],
  "value": "REVIEW"
}
{
  "id": "69cd3cea-5981-4011-bb3d-88a1b58dc18e",
  "comment": "",
  "command": "echo",
  "target": "${REVIEW}",
  "targets": [],
  "value": ""
}

The disadvantage of this method is that it will be saved as a text string, since by using an ID (in this case a span), everything between tags of that ID is saved.

If you wish to obtain a value in a more “refined” way, use the parse method with regular expression to process the text:

  • In this case, a number will be taken and converted to a numerical module in Pandora FMS.
  • As the source code of the .side, the created command will be converted into code similar to this. It is important to note how characters such as double quotes are escaped. " or \ character.
  • What must be done is to determine the piece of HTML code with the text to capture, to do this, analyze with an HTML inspector the code area where you wish to take the value, for example:


Search for what is between the tags:

<span id="acrCustomerReviewText" class="a-size-base">''

and

</span>

If a regexp is applied it will look like:

<span id="acrCustomerReviewText" class="a-size-base">(\d+) valoraciones</span>

This has to be done by creating a “dummy” command (commented with //) at the end of the Selenium sequence (escaping any character with " o \) and using the getValue command to create a module called AMZ_001, generic_data type (i.e., numeric) and providing the escaped regexp:

{
  "id": "ae557b25-b096-4d6e-baa7-f7219ac16e04",
  "comment": "",
  "command": [
    "//getValue;AMZ_001;generic_data;",
    "<span id=\"acrCustomerReviewText\"",
    " class=\"a-size-base\">(\\d+) valoraciones</span>"
  ],
  "target": "",
  "targets": [],
  "value": ""
}

After the execution, it will return conventional Pandora FMS data, with which you may apply alerts, include in graphs, reports and many more things.

Since the transaction uses a real browser, you may even make the connection to a specific user and navigate to finally get the needed data.

WUX Server y Selenium 3

1)
Default: /usr/share/pandora_server/util/selenium_headless_drivers/chromedriver
2)
Default: /usr/share/pandora_server/util/selenium_headless_drivers/chrome/google-chrome
3)
Default: /usr/share/pandora_server/util/selenium_headless_drivers/geckodriver
4)
Default: /usr/share/pandora_server/util/selenium_headless_drivers/firefox/firefox