Difference between revisions of "Pandora: Documentation en: User Monitorization"

From Pandora FMS Wiki
Jump to: navigation, search
(Selenium server deployment on Linux)
Line 1: Line 1:
 
= Introduction =
 
= Introduction =
  
User experience monitoring consists of making recordings of automated tasks for both web browsing and interaction with the desktop and Windows system applications. These recordings can consist of a clicking on a browser, writing a text and performing a research in web browsing, such as being able to open an application on the desktop. This will enable performing the recorded functions automatically and running them to get results, such as time spent on tasks.  
+
User experience monitoring consists of recording automated tasks both for <b>web browsing</b> (PWR / WUX) and for interacting with <b>Windows desktop and system applications</b> (PDR). These recordings can consist of a mouse click on a browser, writing a text, searching throughout the Internet or opening an application on the desktop. This will allow you to perform the recorded functions automatically and they will be executed to obtain results, such as the time spent performing the tasks. To that end, there is automated UX monitoring and user web experience (WUX) monitoring.
To achieve this, UX monitoring and web user experience monitoring have been automated (WUX).
 
  
From Pandora FMS version 7.0NG.728, UX and WUX monitors have been merged inside Pandora FMS console, having both features in only one screen.
+
From Pandora FMS version 7.0NG.728, UX and WUX monitoring have been merged with Pandora FMS console, offering both features on a single screen.
 
   
 
   
 
<center>
 
<center>
Line 10: Line 9:
 
</center>
 
</center>
  
Here are the differences between WUX and UX systems and the description of both functionalities with their different possibilities.
+
Next, we will see the differences between WUX and UX systems and the description of both features along with the different possibilities they offer.
  
=Differences between UX and WUX monitoring=
+
= Differences between UX and WUX monitoring =
  
Both monitoring systems are used for the execution of automated web browsing tasks through Pandora Web Robot Daemon (PWRD) system.
+
Both monitoring systems are used to execute automated web browsing tasks using Pandora Web Robot Daemon (PWRD) system.  
+
 
The UX system carries out these monitoring tasks by means of the software agent installed in a machine, while WUX monitoring is based on a server integrated inside Pandora FMS.
+
The <b>UX</b> system performs these monitoring tasks using the software agent installed on a machine, while <b>WUX</b> monitoring is based on a server integrated within Pandora FMS.
  
Pandora Web Robot Daemon (PWRD) is a service that provides the necessary tools to automate web browsing sessions. It uses a file that contains a list of the necessary actions to navigate through the user's web portal.
+
Pandora Web Robot Daemon (PWRD) is a service that provides the necessary tools to automate web browsing sessions. To do it, it uses a file that contains a list of the actions necessary to navigate the user's web portal.
  
In addition, UX monitoring allows the execution of automated tasks that interact with the desktop and Windows system applications. This type of tasks cannot be performed with WUX.
+
Additionally, UX monitoring enables the execution of the automated tasks that interact with Windows desktop and system applications. These types of tasks cannot be performed with WUX.
  
=Previous settings=
+
Pandora FMS UX is a system that executes automated tasks, giving Pandora FMS a report with the execution results, time spent and screenshots with the errors that may be found.
  
== Introduction ==
+
Pandora FMS PWR technology for UX allows browsing websites, simulating user actions. You may check content, texts, etc. It is the perfect choice for monitoring non-flash-based web sites and applications. Its advantage: it is faster and offers the possibility of running in the background.
  
Pandora FMS UX is an automated task-execution system that afterwards reports the results of executions, times and screenshots with errors.  
+
If you have a task automation system, Pandora FMS UX also allows you to execute the scripts you already have and monitor their execution.
  
Pandora FMS UX PWR technology for enables web navigation and replicates user actions. It checks contents, texts, etc. and is ideal for monitoring sites and apps not based on flash. Pros: it is quicker and it can run at the background.
+
It is important to specify the use of this type of monitoring. Both methods are based on monitoring execution by means of a plugin in the software agents installed in the corresponding machines.
  
If you have an automated task-execution system, Pandora FMS UX can still be used to execute pre-existing scripts and monitor their execution.
+
<br>
  
It is important to specify the use of this type of monitoring. Both methods are based on monitoring process execution of by means of plugins in the software agents installed in the corresponding machines.
+
{{Tip|For web transaction execution, use Selenium Engine.}}
 +
<br>
  
 +
= Web User Experience (WUX) with Selenium 3 =
 
<br>
 
<br>
 +
For Selenium deployment on WUX servers, a container-based stack will be used for fast deployment and easy scaling.
 +
 +
== Previous settings ==
 +
 +
Docker and Docker Compose must be previously installed and we recommend using CentOS as the base operating system.
 +
 +
For this installation, we recommend following the Docker documentation at: https://docs.docker.com/engine/install/
 +
 +
The official Selenium images will be used for the installation and deployment of the stack. You may find them at: https://hub.docker.com/u/selenium
 +
 +
Different images with browsers are available in the Selenium repository. For Pandora FMS, we recommend Firefox and Chrome containers.
 +
 +
== Selenium Stack Deployment ==
 +
 +
To deploy the Selenium stack, it will be necessary to first create a <b>YAML</b> file with the necessary configuration:
 +
 +
# To execute this docker-compose yml file, use `docker-compose -f <file_name> up`
 +
# Add the `-d` flag at the end for detached execution
 +
version: "3"
 +
services:
 +
  selenium-hub:
 +
    image: selenium/hub:3.141.59-zinc
 +
    container_name: selenium-hub
 +
    ports:
 +
      - "4444:4444"
 +
    environment:
 +
      - GRID_BROWSER_TIMEOUT=60000
 +
      - GRID_TIMEOUT=60000
 +
      - GRID_MAX_SESSION=50
 +
      - GRID_CLEAN_UP_CYCLE=60000
 +
      - GRID_UNREGISTER_IF_STILL_DOWN_AFTER=180000
 +
      - GRID_NEW_SESSION_WAIT_TIMEOUT=60000
 +
  chrome:
 +
    image: selenium/node-chrome:3.141.59-zinc
 +
    volumes:
 +
      - /dev/shm:/dev/shm
 +
    depends_on:
 +
      - selenium-hub
 +
    environment:
 +
      - HUB_HOST=selenium-hub
 +
      - HUB_PORT=4444
 +
  firefox:
 +
    image: selenium/node-firefox:3.141.59-zinc
 +
    volumes:
 +
      - /dev/shm:/dev/shm
 +
    depends_on:
 +
      - selenium-hub
 +
    environment:
 +
      - HUB_HOST=selenium-hub
 +
      - HUB_PORT=4444
 +
 +
It can be saved as <i>docker-compose.yml</i> to make identifying it easier.
 +
 +
To activate the container with the defined settings, just run the following command:
 +
 +
docker-compose -f <compose-file> up -d
 +
 +
If you need to check the services running in the container, use the following command:
 +
 +
docker-compose -f <compose-file> ps
 +
 +
To see the status and logs of Selenium services, use the following command:
 +
 +
docker-compose -f <compose-file> logs
 +
 +
Once the appropriate checks have been made, to verify the grid works properly and the workers have signed up as you defined in the configuration file, go to the following URL:
 +
 +
http://<ip_selenium_server>:4444/grid/console
 +
 +
 +
<center>
 +
[[File:newux4.png]]
 +
</center>
 +
 +
If you need to scale the number of workers, just run the following command:
 +
 +
docker-compose -f <compose-file> scale chrome=X firefox=Y
 +
 +
=== Upload pwrd images from ISO ===
 +
 +
If you do not have Internet access to connect to Docker Hub servers and download the images, you will find everything you need in Pandora FMS ISO.
 +
 +
The steps to be followed are:
 +
 +
* Build the pandora_enterprise ISO in /mnt
 +
* Copy the file pwrd.tar.gz (600M => 1.7G) to /root
 +
*Unzip.
 +
* Import the images.
 +
 +
$ mount /dev/cdrom0 /mnt
 +
$ cp /mnt/Packages/pwrd.tar.gz /root/
 +
$ cd /root
 +
$ tar xvzf pwrd.tar.gz
 +
$ docker load < chrome.node*.tar
 +
$ docker load < firefox.node.*.tar
 +
$ docker load < hub.3.*.tar
 +
 +
To check that the images have been correctly uploaded, the following command will be run:
 +
 +
docker images
 +
 +
== Selenium service infrastructure ==
 +
 +
Selenium works as a hub where a container, that works as a grid where to deploy the necessary worker containers, is enabled.
 +
 +
<center>
 +
[[File:newux9.png]]
 +
</center>
 +
 +
== Pandora FMS Configuration ==
 +
 +
To use the centralized mode (WUX) it will be necessary to apply the following configuration to the Pandora FMS server.
 +
 +
Regardless of the chosen mode, once started you may start assigning executions from your browsing sessions, adding the WUX Server configuration parameters to the configuration file of your Pandora FMS server.
 +
 +
Assuming that you have deployed your PWRD server on the same server where your Pandora FMS server runs, add the following configuration:
 +
 +
# add to /etc/pandora/pandora_server.conf
 +
wuxserver 1
 +
wux_host 127.0.0.1
 +
wux_port 4444
 +
 +
==Appendix: Add workers for Internet Explorer and Microsoft Edge ==
 +
 +
If it is necessary to launch web transactions against Microsoft browsers, it will be necessary to configure a machine (physical or virtual) with the desired Windows version and configure the driver following the official documentation.
 +
 +
Internet Explorer driver installation documentation:
 +
 +
github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
 +
 +
{{Tip|We recommend using driver 3.141 version 32bit to avoid performance 64bit version problems.}}
 +
 +
Microsoft Edge driver installation documentation:
 +
 +
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
 +
 +
To run Selenium, Java must be installed on the Windows device.
 +
 +
To check whether Java is installed, run this command:
  
{{Tip|For web transaction execution use Selenium Engine.}}
+
java -version
  
== Selenium ==
+
You should get an output like the following:
=== PWR deployment ===
 
  
Pandora FMS Web Robot Daemon is a service that provides the tools needed for web navigation session automation, using a file that contains a list of the necessary actions to navigate throughout the user web portal.
+
<center>
 +
[[File:newux1.png]]
 +
</center>
  
It is integrated into the Pandora FMS server and it can be found in the /usr/share/pandora_server/util/pwrd folder when installing the Enterprise sever (Linux) or in the module library (Windows).
+
The Selenium <b>JAR</b> file will also be required to run the server locally and register it on your grid.  
  
To download it, go to the following link: ''https://pandorafms.com/library/pandora-ux-and-wux-pwr-recorder/''
+
It can be obtained at:
 +
 
 +
https://www.selenium.dev/downloads/
 +
 
 +
<center>
 +
[[File:newux2.png]]
 +
</center>
 +
 
 +
To activate the <b>Microsoft Edge</b> server, the following must be run in a terminal in the directory where you have the <b>JAR</b> file:
 +
 
 +
java -jar selenium-server-standalone-<VER>.jar -port 5555 -role node -hub
 +
http://<ip_selenium_server>:4444/grid/register -browser "browserName=MicrosoftEdge,
 +
platform=WINDOWS, maxInstances=1"
 +
 
 +
The command is similar to activate the <b>Internet Explorer</b> server, but the path of the downloaded driver must be specified:
 +
 
 +
java -Dwebdriver.ie.driver=<PATH>IEDriverServer.exe -jar selenium-server-
 +
standalone<VER>.jar -port 5555 -role node -hub
 +
http://ip_selenium_server:4444/grid/register -browser "browserName=internet
 +
explorer,platform=WINDOWS,maxInstances=1"
 +
 
 +
<center>
 +
[[File:newux3.png]]
 +
</center>
 +
 
 +
{{Warning|The Windows Firewall must be configured to allow traffic on the ports specified in the run command. In the case of examples 5555 and 4444.}}
 +
 
 +
== Recording ==
 +
 
 +
For Selenium version 3, both old and new recordings will be supported.
 +
 
 +
In order to record a new session, the <b>Selenium IDE</b> extension must be installed in the desired browser.
 +
 
 +
*Firefox: https://addons.mozilla.org/es/firefox/addon/selenium-ide/
 +
*Chrome: https://chrome.google.com/webstore/detail/selenium-ide/mooikfkahbdckldjjndioackbalphokd
 +
 
 +
The next icon will be the one that allows to start the recording environment once the extension is installed.
 +
 
 +
<center>
 +
[[File:newux10.png]]
 +
</center>
 +
 
 +
A menu that will allow to start new recording projects will open.
 +
 
 +
<center>
 +
[[File:newux5.png]]
 +
</center>
 +
 
 +
Once the recording is made, it will result in something like the following:
 +
 
 +
<center>
 +
[[File:newux6.png]]
 +
</center>
 +
 
 +
Apart from the feature provided by Selenium, Pandora FMS has custom commands to retrieve information from the target to be monitored.
 +
 
 +
=== Commands ===
 +
 
 +
*<b>extract</b>: It combines 'source' and its own code for extraction.
 +
*<b>storeExtraction</b>: It stores the result of <b>extract</b> in a variable.
 +
*<b>dispatchEvent</b>: It triggers a Javascript event on a given element.
 +
*<b>takeElementScreenshot</b>: It takes a screenshot of a specific item.
 +
*<b>phase_start</b>: It starts a stage and turns the test into a WUX transaction.
 +
*<b>phase_end</b>: It completes a phase.
 +
*<b>clickAndWait</b>: It simulates the behavior of this Selenium 2 command in Selenium 3.
 +
*<b>waitForPageToLoad</b>: It simulates the behavior of this Selenium 2 command in Selenium 3.
 +
 
 +
=== Module generating commands ===
 +
 
 +
*<b>getValue</b>: It retrieves a value:
 +
 
 +
getValue;name module;module type;screenshot REGEX
 +
 
 +
*<b>getScreenshot</b>: It retrieves a screenshot:
 +
 
 +
getScreenshot;module name
 +
 
 +
{{Warning|All own commands must appear in the test file (.side) as comments. Otherwise, it will fail when testing the test in the Selenium extension.}}
 +
 
 +
= Web User Experience (WUX) with Selenium 2 =
 +
 
 +
== Previous settings ==
 +
 
 +
=== Selenium ===
 +
 
 +
==== Pandora Web Robot Daemon (PWRD) deployment ====
 +
 
 +
Pandora FMS Web Robot Daemon is a service that provides the necessary tools to automate web browsing sessions, using a file that contains a list of the actions necessary to navigate the user's web portal.
 +
 
 +
It comes integrated with the Pandora FMS server and can be found in the /usr/share/pandora_server/util/pwrd folder when installing the Enterprise server (Linux) or in the module library (Windows).
 +
 
 +
To download it, go to the following link: ''https://pandorafms.com/library/pandora-ux-and-wux-pwr-recorder/ ''
  
 
It contains:
 
It contains:
  
*The binary of Firefox browser version 47.
+
* Firefox browser binary version 47.
*Pre-built profile for web navigation session execution.
+
* Pre-built profile for executing web browsing sessions.
*Session automation server (Selenium server).
+
* Session automation server (Selenium server).
  
 
+
==== Selenium server deployment on Windows systems ====
=== Selenium server deployment on Windows ===
 
  
 
Prerequisites:
 
Prerequisites:
* Install Java 1.8. on the machine that will provide the service.
+
* Install Java 1.8 on the machine that will provide the service.
* Install Firefox 47.0.1 (download at https://ftp.mozilla.org/pub/firefox/releases/43.0.1/).
+
* Install Firefox 47.0.1 (downloadable at https://ftp.mozilla.org/pub/firefox/releases/47.0.1/).
* Prepare a Firefox profile to check automatized sessions (optional): http://toolsqa.com/selenium-webdriver/custom-firefox-profile/
+
* Prepare a Firefox profile to be used to test automated sessions (optional): http://toolsqa.com/selenium-webdriver/custom-firefox-profile/
* Create the directories:
+
* Create the following directories:
 
  C:\PWR
 
  C:\PWR
  
 +
To download the PWR_Server.zip, go to the following link:
 +
''https://pandorafms.com/library/pwr-server-for-ux-monitoring/''
  
To download the PWR_Server.zip, go to: ''https://pandorafms.com/library/pwr-server-for-ux-monitoring/''
+
Do the following file distribution:
 
+
* Unzip the PWR_Server.zip file to C:\PWR\
Create this file distribution:
 
* File decompression PWR_Server.zip a C:\PWR\
 
 
* Export Firefox profile to C:\PWR\profile
 
* Export Firefox profile to C:\PWR\profile
  
Using a profile to carry out checks '''is optional''', but recommended in case of using proxies or password autofill.
+
The use of a profile to carry out checks '''is not mandatory''', however it is recommended particularly when using a proxy or wanting to use password autocompletion.
To create a Firefox profile, follow the steps detailed in the following screenshots:
+
To create a Firefox profile, follow the steps from the following screenshots:
  
 +
<br>
 
[[File:ux1.JPG|center]]
 
[[File:ux1.JPG|center]]
 +
<br>
 
[[File:ux2.JPG|center]]
 
[[File:ux2.JPG|center]]
 +
<br>
  
Choose the directory address:
+
Choose the destination directory:
  
 +
<br>
 
[[File:ux3.JPG|center]]
 
[[File:ux3.JPG|center]]
 +
<br>
  
Start Firefox with the new profile to customize options such as proxies, popups, etc.:
+
Start Firefox with the new profile to customize options such as proxy, popup display, etc.:
  
 +
<br>
 
[[File:ux4.JPG|center]]
 
[[File:ux4.JPG|center]]
 +
<br>
  
Install the service by executing the ''service_installer.bat'' BAT file provided. For a correct operation of the service_installer.bat, modify the content, entering the paths that exist in the file as you have them installed in the machine. For example, in the case of java, it can only work as java if its PATH is correctly configured, otherwise the full PATH must be provided inside the file. Finally start the service:
+
Next, install the service by executing the provided BAT file ''service_installer.ba ''. For the service_installer.bat to work properly, modify the content, typing in the paths that exist in the file as they are installed on your machine. For example, Java can only work if you have correctly configured its PATH. Otherwise, you will have to provide the full PATH inside the file. Finally, start the service:
  
 
  net start PWRSRV
 
  net start PWRSRV
  
The Selenium server is now running. It can also be manually executed (after interrupting the service) in order to carry out ''debugging'' tasks through this command:
+
From this point, the Selenium server is running on your machine. However, you may execute it manually (stopping the service previously) in case you wish to perform debugging tasks, using the following command:
  
  java -jar selenium-server-standalone-2.53.0.jar -firefoxProfileTemplate C:\selenium\firefox_profile -port 4444 -v
+
  java -jar C:\PWR\server\selenium-server-standalone-2.53.0.jar -firefoxProfileTemplate C:\PWR\profile -port 4444 -v
  
=== Selenium server deployment on Linux ===
+
==== Selenium server deployment on Linux systems ====
  
 
Prerequisites:
 
Prerequisites:
 
* Install Java 1.8 on the machine that will provide the service.
 
* Install Java 1.8 on the machine that will provide the service.
* Install Firefox 43.0.1 (download at https://ftp.mozilla.org/pub/firefox/releases/43.0.1/).
+
* Install Firefox 47.0.1 (downloadable at https://ftp.mozilla.org/pub/firefox/releases/47.0.1/).
* Prepare a Firefox profile to check automated sessions (optional): http://toolsqa.com/selenium-webdriver/custom-firefox-profile/
+
* Prepare a Firefox profile to be used to test automated sessions (optional): http://toolsqa.com/selenium-webdriver/custom-firefox-profile/
* Install xorg-x11-server-xvfb.
+
* Install xorg-x11-server-xvfb
* Install java.
+
* Install java
  
 +
The Selenium component of the PWRD daemon requires Java to work, so it needs to be installed:
  
The Selenium PWRD daemon needs Java to work properly, so you need to install it:
+
yum install java
  
yum install java
+
For PWRD to be able to launch Firefox on your Linux server, it will be necessary to install xorg-x11-server-Xvfb, gtk2 and gtk3 in order to virtualize a graphical environment:
 
 
For PWRD to be able to launch Firefox in your Linux server, install xorg-x11-server-Xvfb, gtk2 and gtk3 to see a graphic environment:
 
  
 
  yum install xorg-x11-server-Xvfb gtk2 gtk3
 
  yum install xorg-x11-server-Xvfb gtk2 gtk3
  
If it is not available within the repositories, the rpm files can be found at the following links:
+
If it is not available in your repositories, you may find the rpm files in the following links:
 
ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm
 
ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm
  
 
ftp://rpmfind.net/linux/centos/7.4.1708/os/x86_64/Packages/gtk2-2.24.31-1.el7.x86_64.rpm
 
ftp://rpmfind.net/linux/centos/7.4.1708/os/x86_64/Packages/gtk2-2.24.31-1.el7.x86_64.rpm
  
To install the rpm package manually:
+
To manually install the rpm packages:
  
 
  yum install xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm
 
  yum install xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm
 
  yum install gtk2-2.24.31-1.el7.x86_64.rpm
 
  yum install gtk2-2.24.31-1.el7.x86_64.rpm
  
Once the prerequisites are installed, continue the installation of the install_pwrd.sh. The default PATH is ''/usr/share/pandora_server/util/pwrd/install_pwrd.sh'' and its execution is:
+
Once the prerequisites are installed, continue with the installation of install_pwrd.sh. This installer is found by default in the folder ''/usr/share/pandora_server/util/pwrd/install_pwrd.sh'' and it is executed as follows:
  
 
  cd /usr/share/pandora_server/util/pwrd/
 
  cd /usr/share/pandora_server/util/pwrd/
 
  ./install_pwrd.sh --install
 
  ./install_pwrd.sh --install
  
Once installed, the service must be started:
+
Once installed, start the service:
  
 
  /etc/init.d/pwrd start
 
  /etc/init.d/pwrd start
  
The Selenium server can be booted up with the script:
+
Use the following script to start the Selenium server:
  
 
  #!/bin/sh
 
  #!/bin/sh
 
  # Monitoring selenium process
 
  # Monitoring selenium process
  if [[ <nowiki>"` ps aux |grep selenium |grep -v grep |grep -v selenium.sh |wc -l `"</nowiki> != "0" ]]; then
+
  if [[ <nowiki>"`ps aux |grep selenium |grep -v grep |grep -v selenium.sh |wc -l `"</nowiki> != "0" ]]; then
 
     exit
 
     exit
 
  else
 
  else
Line 141: Line 378:
 
     fi
 
     fi
 
     export DISPLAY=:99
 
     export DISPLAY=:99
     java -jar /usr/share/pandora_server/util/pwdr/selenium-server-standalone-2.53.1.jar &
+
     java -jar /usr/share/pandora_server/util/pwdr/selenium-server-standalone-2.53.1.jar &
 
  fi
 
  fi
  
 
Or manually with the following commands:
 
Or manually with the following commands:
  
 
+
  $ Xvfb :99 -ac &
  $ Xvjb :99 -ac &
 
 
  -> Press Enter to continue
 
  -> Press Enter to continue
 
  $ export DISPLAY=:99
 
  $ export DISPLAY=:99
  $ java -jar /usr/share/pandora_server/util/pwdr/selenium-server-standalone-2.53.1.jar -port 4444 &
+
  $ java -jar /usr/share/pandora_server/util/pwdr/selenium-server-standalone-2.53.1.jar -port 4444 &
  
From version 730 on, you may carry a custom installation through a user and directory different to those of the default installation.
 
  
==== Pandora Web Robot Daemon (PWRD) ====
+
In version 730 and later, the possibility of performing the custom installation with a user and a directory different from those of the default installation has been added.
  
Pandora Web Robot Daemon is a service, which provides tools to automate web browser sessions, using a file containing a list of necessary actions in order to navigate the user's web portal.
+
===== PWRD operating modes =====
 +
 +
PWRD provides several operating modes:
  
It comes integrated with Pandora FMS server and it can be found in the /usr/share/pandora_server/util/pwrd folder when installing the Enterprise server (Linux) or in the module library (Windows).
+
* '''Standalone''': This standard mode will launch a single PWRD instance. Each of these instances will be associated with a Pandora FMS server.
 +
* '''HUB''': Hub mode. In this mode, the PWRD service will not evaluate the browsing sessions directly, but "nodes" must be registered to execute the tasks. It is the cluster mode of the PWRD service. Each HUB will be assigned to a Pandora FMS server.
  
To download it go to the following link: ''https://pandorafms.com/library/pandora-ux-and-wux-pwr-recorder/''
+
====== PWRD in standalone mode ======
  
 +
PWRD in standalone mode will start the daemon and get it ready to execute the actions indicated by the user through WUX Server.
  
It contains:
+
<br>
 +
[[File:wux_pwrd_standalone.png|center]]
 +
<br>
  
* Firefox 43 Binary for Windows.
 
* Pre-built profile to perform web browser sessions.
 
* Server for session automation (Selenium server).
 
  
=== Recording a PWR session ===
+
# Start
 +
/etc/init.d/pwrd start
  
Before UX monitoring can take place, you need to record a session. Depending on the type of tech you use, several recording options are available.
+
# see the status
 +
/etc/init.d/pwrd status
  
To record the navigation with PWR, the PWR recorder available at plugin module library is needed:
+
# stop
 +
/etc/init.d/pwrd stop
  
https://pandorafms.com/library/pandora-ux-and-wux-pwr-recorder/
 
  
The package contains:
+
====== PWRD in "HUB" mode ======
* Firefox version 43.0.1 (downloadable at: https://ftp.mozilla.org/pub/firefox/releases/43.0.1/).
 
* Selenium IDE extension (downloadable at: https://addons.mozilla.org/es/firefox/addon/selenium-ide/).
 
  
 +
The hub mode will start the daemon as a load balancer. In this work mode, the system will balance the load among all the nodes that are registered on it, assigning browsing session execution to the nodes according to their workload.
  
Start PWR_recorder.exe:
+
You can see the HUB status at any time by accessing the HUB administration console:
  
<br>
+
http://hub:4444/grid/console
[[File:PWR_recorder.PNG|center]]
 
<br>
 
  
The recorder will start automatically Firefox prepared to record PWR sessions:
 
  
 
<br>
 
<br>
[[File:PWR_recorder_main.png|center]]
+
[[File:wux_pwrd_hub.png|center]]
 
<br>
 
<br>
  
  
After starting Selenium IDE, you will be able to record your user experience:
+
# Start
 +
/etc/init.d/pwrd start-hub
  
[[File:ux10.JPG|center]]
+
# see the status
 +
/etc/init.d/pwrd status-hub
  
Now you can navigate the website you wish to monitor and register the different actions associated with each step on the recording.  
+
# stop
To stop recording, use the following button, located at the upper-right corner of the screen:
+
/etc/init.d/pwrd stop-hub
  
[[File:ux11.JPG|center]]
 
  
Once the actions are completed, the page can be checked, e.g. verification of a text to ensure the correct page has loaded. Right click on a text section in the browser window while recording and select ''verifyText'':
+
====== Add PWRD nodes to your HUB ======
  
[[File:ux13.JPG|center]]
+
To add a new PWRD node, you will need:
  
Another step will appear on the recording indicating the text to be checked:
+
* A hub (PWRD in HUB mode).
 +
* PWRD files, on the same or on different machines.
 +
* TCP / 4444 connectivity from the computer hosting the node to the computer hosting the HUB.
  
[[File:ux14.JPG|center]]
+
In this working mode, the service will process all those requests queued <b>from the hub (HUB)</b> , giving back the results of the executions. It will be the HUB who will speak exclusively with the WUX Server, for which the one who executes the user's actions is visible.
  
The entire sequence can be played by clicking ''Play entire test suite'' and it can be checked that it is correctly finished:
+
# Start and sign up in the HUB, replace "hub" with the IP of the PWRD HUB server
 +
/etc/init.d/pwrd start-node http://hub:4444/grid/register
  
[[File:ux15.JPG|center|800px]]
+
# see the status
 +
/etc/init.d/pwrd status-node
  
Once the whole browsing sequence has been checked and verified, save it (File -> Save Test Case) in order to execute it on Pandora FMS UX. The resulting file is an HTML document that Pandora FMS UX can then interpret.
+
# stop
 +
/etc/init.d/pwrd stop-node
  
==== Recording a transaction session with Pandora FMS UX PWR ====
+
==== Pandora FMS server configuration ====
  
Pandora FMS UX in PWR mode (Pandora Web Robot) allows browser monitoring to be divided among multiple modules that represent each of the steps taken.
+
To use the centralized mode (WUX), it will be necessary to apply the following configuration to the Pandora FMS server.
  
To insert a new control point and generate phase modules (to this point) right-click on the point where the phase is supposed to start.
+
Regardless of the chosen mode, once started you may start assigning executions from your browsing sessions, adding the WUX Server configuration parameters to the configuration file of your Pandora FMS server.
  
[[File:ux16.JPG|center]]
+
Assuming that you have deployed your PWRD server on the same server where your Pandora FMS server runs, you should add the following configuration:
  
Use the following as the New Comment:
+
# add to /etc/pandora/pandora_server.conf
 +
wuxserver 1
 +
wux_host 127.0.0.1
 +
wux_port 4444
  
phase_start:name_of_phase
 
  
This stage includes the timings and results of all the commands up to the following comment:
+
==== Uploading certificates for Firefox ====
  
phase_end:name_of_phase
+
It is possible that some of the configured checks are executed against web pages that use self-signed certificates or signed by a CA not included in those accepted by default in Firefox, so in those cases it will be necessary to load the certificate itself in the Firefox profile that is being used.
  
All commands executed between a phase_start and a phase_end are included in that stage.
+
The easiest way to do it is to start the browser in a graphical environment, access the URL and add the SSL certificate. Next, we will explain how to do it both in Windows and Linux:
  
=== Executing PWR sessions ===
+
===== With PWRD deployed on Windows systems =====
  
==== Standard executing ====
+
In this case, since you have a graphical environment, just start the Firefox browser with the profile used for the checks:
  
To launch prerecorded PWR sessions, call the ''pandora_ux_x64.exe'' executable. It can be downloaded here: ''https://pandorafms.com/library/user-experience-pandora-ux/''
+
[[File:Profile_01.png|center]]
  
Select PWR work mode and the file containing the session guidelines. Any error screenshots will be saved in the route indicated on the ''-folder''  parameter, which is optional. You can also use the ''-retries'' parameter to re-execute the script after a failure execution. The execution in Windows is:
+
[[File:Profile_02.png|center]]
  
pandora_ux_x64.exe -exe PWR -script tests\std.html -retries 3
+
Once started, access the URL with the certificate you want to load and add it as an exception for the browser:
  
The following modules are returned:
+
[[File:Profile_03.png|center]]
* UX_Status_project_name: whether or not the sequence was successful
 
* UX_Time_project_name: time taken to complete the sequence
 
* UX_Snapshot_project_name: screenshot of the last point before any error occurred
 
  
Correct execution example:
+
[[File:Profile_04.png|center]]
  
<module>
+
Another possibility, if you want to accept any SSL certificate, would be to go to Firefox options, go to "Privacy & Security" and uncheck the field "Check responding OCSP servers to guarantee the current validity of the certificates":
    <name><![CDATA[UX_Status_std.html]]></name>
 
    <type>generic_proc</type>
 
    <nowiki><data><![CDATA[1]]></data></nowiki>
 
    <description><![CDATA[Test OK]]></description>
 
    <tags>UX</tags>
 
    <module_group>UX</module_group>
 
</module>
 
<module>
 
    <name><![CDATA[UX_Time_std.html]]></name>
 
    <type>generic_data</type>
 
    <nowiki><data><![CDATA[16.317]]></data></nowiki>
 
    <description><![CDATA[Test OK]]></description>
 
    <tags>UX</tags>
 
    <module_group>UX</module_group>
 
    <module_parent>UX_Status_std.html</module_parent>
 
</module>
 
  
Incorrect execution example:
+
[[File:Profile_05.png|center]]
  
<module>
+
[[File:Profile_06.png|center]]
    <name><![CDATA[UX_Status_std.html]]></name>
 
    <type>generic_proc</type>
 
    <nowiki><data><![CDATA[0]]></data></nowiki>
 
    <description><![CDATA[Failed to execute verifyText]]></description>
 
    <tags>UX</tags>
 
    <module_group>UX</module_group>
 
</module>
 
<module>
 
    <name><![CDATA[UX_Time_std.html]]></name>
 
    <type>generic_data</type>
 
    <nowiki><data><![CDATA[15.463]]></data></nowiki>
 
    <description><![CDATA[Failed to execute verifyText]]></description>
 
    <tags>UX</tags>
 
    <module_group>UX</module_group>
 
    <module_parent>UX_Status_std.html</module_parent>
 
</module>
 
 
<module>
 
    <name><![CDATA[UX_Snapshot_std.html]]></name>
 
    <type>async_string</type>
 
    <nowiki><data><![CDATA[data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAA…JRU5ErkJggg==]]></data></nowiki>
 
    <description><![CDATA[Image (last error)]]></description>
 
    <tags>UX</tags>
 
    <module_group>UX</module_group>
 
    <module_parent>UX_Status_std.html</module_parent>
 
</module>
 
  
Provided everything is OK, the execution line can be added to the Pandora FMS agent (already installed on the machine) which will carry out the checks. It should look something like this:
+
===== With PWRD deployed on Linux systems =====
In Windows:
 
module_plugin C:\Users\artica\Documents\Producto\UX-Trans\UX\pandora_ux_x64 -exe PWR -script C:\Users\artica\Documents\Producto\UX-Trans\PWR\sesion.html -folder C:\probes
 
In Linux:
 
module_plugin /usr/share/pandora_server/util/pwrd/firefox/pandora_ux.64 -exe PWR -script /usr/share/pandora_server/util/pwrd/firefox/PruebaUX.html -pwr_port 4444
 
  
Once the agent is reporting to Pandora FMS server, the corresponding modules will appear. Enable ''hierarchy mode'' to see the relation among them:
+
In general, when a Linux server is installed, it is not included in a graphical desktop environment, so in order to follow the same steps as in the previous case, redirect the graphical Xs to a computer where you do have a graphical desktop environment. This is done differently if we redirect the Xs to a graphical desktop in Linux or Windows.
  
[[File:ux33.JPG|center|800px]]
+
====== Redirecting X11 to a Linux desktop ======
  
As previously indicated, the result of the execution (successful or not) can be seen on the ''UX_Status_session.html'' module, the time taken (in secs) on the ''UX_Time_session.html'' module , and another one with the screenshot of the last error on ''UX_Snapshot_session.html'' which, in this case, is empty. Use these modules to create alerts and display the individual graphs from each module.
+
Doing it is very simple, since it will be enough to set an SSH connection to the PWRD server with the parameter "-X":
  
<center>
+
ssh -X [email protected]_ip_address
[[File:imagen_nueva_ux.png]]
 
</center>
 
  
==== Transaction-based execution ====
+
Once this is done, if you launch the Firefox browser, it will be shown on your desktop:
  
If there is a Pandora FMS UX PWR transaction recording as outlined in previous sections, it will be the system itself that generates the necessary modules to identify each of the phases indicated, which means the execution will not vary regarding the previous case. Indicate the corresponding html file, which contains the different phases in this case. E.g. in Windows: 
+
firefox -p
  
pandora_ux_x64 -exe PWR -script tests\std.html –folder C:\probes
+
In a default installation, you will only see the "default" profile, so it would be advisable to do as in the installation in Windows and create a new profile to use:
  
The following modules will be returned:
+
[[File:Profile_07.png|center]]
  
* UX_Time_project_name.phase_order
+
[[File:Profile_08.png|center]]
* UX_Status_project_name.phase_order
 
  
If any phase returns an error, the following module is created:
+
[[File:Profile_09.png|center]]
  
* UX_Snapshot_project_name.phase_order
+
In case of saving the profile in a path other than '''/opt/firefox_profile''', it will be necessary to edit the PWRD starting script '''/etc/init.d/pwrd''' to indicate the path to the new profile:
  
A screenshot with the time the error took place will be displayed.
+
PWROPTS=" -firefoxProfileTemplate /path/to/profile/folder"
  
Global status modules are returned with the following labels:
+
With the created profile, you can start the browser:
  
* UX_Global_Time_project_name
+
[[File:Profile_10.png|center]]
* UX_Global_Status_project_name
 
* UX_Global_Snapshot_project_name
 
  
A screenshot showing the moment the error took place will be displayed.
+
Once started, access the URL with the certificate you want to load and add it as an exception for the browser:
  
The agent's execution line is the same as the previous example, but with an html file containing the phases.
+
[[File:Profile_11.png|center]]
  
When the data reaches the Pandora FMS server, it is displayed as modules. Enable ''hierarchy mode'' in the module list to see the information clearly:
+
[[File:Profile_12.png|center]]
  
[[File:ux34.JPG|center|800px]]
+
Another possibility, if you want to accept any SSL certificate, would be to go to Firefox options, go to "Privacy & Security" and uncheck the field "Check responding OCSP servers to guarantee the current validity of the certificates":
  
Access the agent's ''WUX'' section to see extra details on the transaction and its stages:
+
[[File:Profile_13.png|center]]
  
The following example represents a browsing process, plus the purchase of different articles, performed on our website, and divided into five phases to exactly measure the time taken and to locate areas that could be improved or where bottlenecks are being generated:
+
[[File:Profile_14.png|center]]
  
[[File:ux44.JPG|center|800px]]
+
====== Redirecting X11 to a Windows desktop ======
  
==== Data retrieval ====
+
In Windows, first install an X server to be able to redirect, such as '''Xming'''. Once installed and started, redirect the Xs.
  
Pandora FMS UX is able to retrieve data from web content while testing the user experience test.
+
Using the SSH Putty client, go to the "Connection> SSH> X11" section before connecting, and make sure you check the "Enable X11 forwarding" option and fill in the "X display location" field as "localhost:0":
  
To use this feature, add some directives as comments in the user experience test recorder in Selenium IDE.
+
[[File:Profile_15.png|center]]
  
<br>
+
Then go back to the "Session" section and establish the connection:
[[File:PWR_recorder_getValue.png|center|600px]]
 
<br>
 
  
In the attached example, both values will be retrieved after testing the navigation, and will be added to Pandora FMS as modules (both getValue directives).
+
[[File:Profile_16.png|center]]
  
The steps to make the plugin retrieve values are following:
+
Once the connection is established, if you launch the Firefox browser on the PWRD server, you may see it on the Windows desktop.
* Add a new comment to the navigation test in the Selenium IDE.
 
* Add the directive to the comment.
 
  
Data retrieval directive:
+
firefox -p
  
getValue;module name;module type;Regular expression for data capture
+
In a default installation, you will only see the "default" profile, so it would be advisable to do as in the installation in Windows and create a new profile to use:
  
What does each field represented by a dot and comma mean?
+
[[File:Profile_17.png|center]]
  
* <b>getValue</b>: UX system directive
+
[[File:Profile_18.png|center]]
* <b>Module name</b>: module name as it will appear in Pandora FMS
 
* <b>Module type</b>: datatype to use, any of Pandora FMS datatypes is allowed (generic_proc,generic_data,generic_data_string,async_proc,async_data,async_string...)
 
* <b>Perl regular expression</b>: Must be a perl regex, specifing data to be retrieved between parenthesis
 
  
For example, in the following text:
+
[[File:Profile_19.png|center]]
  
<pre>
+
In case of saving the profile in a path other than '''/opt/firefox_profile''', it will be necessary to edit the PWRD starting script '''/etc/init.d/pwrd''' to indicate the path to the new profile:
<p>The temperature of the solar plate is: <span class="temperature">54º C</span></p>
 
</pre>
 
  
If you want to retrieve the temperature of the solar plate to monitor it, specify the regular expression as:
+
PWROPTS=" -firefoxProfileTemplate /path/to/profile/folder"
  
<pre>
+
With the created profile, you can start the browser:
<span class="temperature">(\d+\.*\,*\d*).*</span>
 
</pre>
 
  
So, the system will retrieve the number "54" from the example, or any number with decimal positions.
+
[[File:Profile_20.png|center]]
  
 +
Once started, access the URL with the certificate you want to load and add it as an exception for the browser:
  
Then, the complete directive will appear as:
+
[[File:Profile_21.png|center]]
  
<pre>
+
[[File:Profile_22.png|center]]
getValue;Solar plate temperature;generic_data;<span class="temperature">(\d+\.*\,*\d*).*</span>
 
</pre>
 
  
== Desktop UX (PDR) ==
+
Another possibility, if you want to accept any SSL certificate, would be to go to Firefox options, go to "Privacy & Security" and uncheck the field "Check responding OCSP servers to guarantee the current validity of the certificates":
  
=== PDR deployment (Windows only) ===
+
[[File:Profile_23.png|center]]
  
The PDR system only works on Windows systems, and once run by the Pandora FMS agent it must run in '''process mode''', since running in service mode will not work. Furthermore, it will not be possible to block the desktop session, so it is recommended to use it in virtual machines.
+
[[File:Profile_24.png|center]]
  
Prerequisites:
 
* Windows OS in desktop mode, auto startup, and auto login.
 
  
To configure it, execute:
+
=== Session Recorder (PWR) ===
control userpasswords2
 
  
Uncheck "Users must enter a user name and password to use this computer":
+
{{Warning|The new Selenium IDE version will be supported by Pandora FMS version 745 onwards, when Selenium 3 is implemented. Transactions recorded in Selenium 2 will not be affected.}}
  
[[File:ux5.JPG|center]]
+
Before monitoring a user experience, record it. Use the appropriate recording system according to the type of technology you chose.
  
To set up the environment, create the following directories:
+
To record a navigation with PWR, you will need the PWRD recorder available in the module library:
  
C:\PDR
+
https://pandorafms.com/library/pandora-ux-and-wux-pwr-recorder/
C:\probes
 
  
Decompress the "PDR.zip" file from: ''https://pandorafms.com/library/pdr-cmd-for-ux-monitoring/'' into ''C:\PDR''.
+
It contains:
 +
* Firefox web browser version 47.0.1 (downloadable from https://ftp.mozilla.org/pub/firefox/releases/47.0.1/).
 +
* Selenium IDE extension (downloadable from: https://addons.mozilla.org/es/firefox/addon/selenium-ide/).
  
To start the recorder, execute:  
+
Start the PWR_recorder.exe recorder:
  
C:\PDR\pdr
+
<br>
 +
[[File:PWR_recorder.PNG|center]]
 +
<br>
  
=== Record a PDR session ===
+
It will automatically start Firefox with the environment ready to record PWR sessions:
  
Requirements:
+
<br>
* Install the automation system (decompress pdr.zip in a directory of your choice) installed.
+
[[File:PWR_recorder_main.png|center]]
* Start the recording system (pdr.cmd).
+
<br>
  
[[File:ux17.JPG|center]]
 
  
After loading, enter the recording environment:
+
After accessing the Selenium IDE, you may start recording your user experience:
  
[[File:ux18.JPG|center|800px]]
+
<br>
 +
[[File:ux10.JPG|center]]
 +
<br>
  
Select the actions and the zones where they are to be carried out. Here are some of the most common ones:
+
From that moment on, you will be able to navigate throughout the website that you wish to monitor and the different actions of each step that you take will appear in the recorder.
  
General actions:
+
To stop the recording, use the following button, located in the upper right corner of the recorder:
  
[[File:ux19.JPG|center]]
+
<br>
 +
[[File:ux11.JPG|center]]
 +
<br>
  
Flow control actions:
+
Once these actions are completed, perform the checks on the website. For example, check the existence of a certain text to make sure that the loaded page is the correct one. To that end, right-click on a section of text on the browser window while you keep recording, and select the option ''verifyText'':
  
[[File:ux20.JPG|center]]
+
<br>
 +
[[File:ux13.JPG|center]]
 +
<br>
  
More information about this language: http://sikulix-2014.readthedocs.io/en/latest/index.html
+
A new step will appear in the recorder indicating the indicated text checking action:
  
When the project is recorded, a file will be created with the following elements:
+
<br>
* File .py with the script automation code.
+
[[File:ux14.JPG|center]]
* Web browser control images.
+
<br>
  
A simple example of an execution would be something like monitoring to check that the Windows calculator works properly. These are the steps for this procedure..
+
You may play the full sequence using the button ''Play entire test suite'' and check that it ends correctly:
  
1. Choose the action "click" and the area where you want to apply the action. The screen will change to "area selection" mode:
+
<br>
 +
[[File:ux15.JPG|center|800px]]
 +
<br>
  
[[File:ux21.JPG|center]]
+
Once the validity of the navigation sequence is verified, save it (File -> Save Test Case) to execute it afterwards with Pandora FMS UX. The resulting file will be an HTML document that Pandora FMS UX will interpret.
[[File:ux22.JPG|center]]
 
  
2. Enter the ''type'' action and the "calc" text, wait for the calculator area to appear and click. Afterwards, wait for the calculator window to appear to enter the following actions:
 
  
[[File:ux23.JPG|center]]
+
===== Record a transactional session for Pandora WUX =====
  
3. Then click on the corresponding buttons, selecting the areas as in the previous steps.
+
Pandora FMS WUX allows dividing navigation monitoring into multiple modules, which will represent each one of the steps carried out.
  
4. Lastly, save and replay clicking on '''Run'''.
+
To insert a new control point and generate the phase modules (up to that point), right-click on the point where you want to identify the beginning of the phase.
  
Important notes:
+
<br>
 +
[[File:pwrd_recorder_transaction.PNG|center]]
 +
<br>
  
*If you double-click on any of the images within the recording environment, you can adjust details of the control capture, such as selecting the exact point where to click.
+
Type in the following text as a comment:
*It is highly recommended to enter ''wait'' actions between each click to make sure that the execution will not be stopped due to a delay in the operating system.
 
*The recorder will look for the area that looks like the screenshot, so be especially careful if there is something highlighted when the button is placed on top of it (for example, the calculator buttons change to orange when the cursor is over them).
 
  
The image files can be viewed in the folder where the recording is saved, as well as the python file.
+
phase_start:phase_name
  
[[File:ux24.JPG|center]]
+
The phase will include the time and result of all the commands found until the following comment:
  
<b><u>Note</u>:</b> You can customize the capture from the PDR recording engine by using the following code:
+
phase_start:phase_name
  
## OPTIONAL ##capture file names
+
All commands executed between phase_start and phase_end tags will be included within that phase.
import shutil
 
file = "C:\probes\screenshot_prueba.sikuli.png"
 
focusWindow = App.focusedWindow()
 
regionImage = capture(focusWindow)
 
shutil.move(regionImage, file)
 
  
 +
<br>
 +
[[File:pwrd_recorder_transaction2.PNG|center]]
 +
<br>
  
This will create an image of the active window in the destination indicated by the file with which you can make the screenshot at the specific time you want.
+
== Web transaction execution ==
You can customize this screenshot using coordinates, so specify the following syntax:
 
  
capture(x, y, w, h)
+
=== Standard execution ===
  
Where:
+
To launch pre-recorded PWR sessions, call the executable "pandora_ux_x64.exe", which can be downloaded from the following link: "https: //pandorafms.com/library/user-experience-pandora-ux" '
  
X: X position of the rectangle you want to capture
+
Indicate that the working mode is PWR, and the file that contains the session guidelines. In the path indicated in the '' -folder '' parameter, the screenshots will be saved to be shown in case of failure, optional parameter. You may also enter the number of consecutive retries in case of failure, optional parameter. Its execution in Windows is:
  
Y: Y position of the rectangle you want to capture
+
  pandora_ux_x64.exe -exe PWR -script C:\tests\std.html -retries 3
 
 
W: Capture width
 
 
 
H: Capture hight
 
 
 
<br><br>
 
 
 
==== Recording a transaction session with Pandora FMS UX PDR ====
 
 
 
 
 
Recording a specific session is not necessary, just record the sessions you need in different scripts. Pandora FMS UX will return the results and organize them as a complex transaction. The next point discusses how to make the call of the execution so that it works correctly.
 
 
 
If you are going to make several recordings to create a transactional process, be careful when recording and make sure that the elements you are looking for are present. Manual execution of the recordings that you want to use in a single transactional process is recommended, followed by a manual execution to ensure that the actions take place as expected.
 
   
 
In the next example you can see a recording process that will constitute the second phase of the process from the example above. Take the result returned by the calculator and paste it into a note. It should look like this:
 
 
 
[[File:ux40.JPG|center]]
 
 
 
Here is another sequence that consists of saving the text file in a specific location, overwriting the previous one. This gives great flexibility, affording the possibility of parallel file monitoring, reflecting information from a variety of checks against heavyweight desktop applications. This third sequence consists of the following steps:
 
 
 
[[File:ux43.JPG|center]]
 
 
 
=== Executing PDR sessions ===
 
 
 
==== Standard execution ====
 
 
 
To launch prerecorded PDR sessions, indicate work mode as pdr.cmd file route deployed in the corresponding point, the argument of said file being “-r”, the file that contains the session guidelines (-script), the directory where the screenshots will be saved (-folder) finishing with ‘\’, which is optional. You can also use the ''-retries'' parameter to re-execute the script after a failure execution.
 
 
 
In the following execution, the screenshot can be customized to capture only the active window:
 
 
 
pandora_ux_x64 -exe C:\PDR\pdr -args -r -script C:\pandora_ux\calculadora.sikuli -folder C:\pandora_ux\ -ss_config active -retries 3
 
  
 
The following modules will be returned:
 
The following modules will be returned:
* UX_Time_project_name.
+
* UX_Status_project_name: if the sequence succeeded or failed.
* UX_Status_project_name.
+
* UX_Time_project_name: time taken to complete the sequence.
* UX_Control_Snapshot_project_name (only on first execute).
+
* UX_Snapshot_project_name: screenshot right before the error, if any.
 
 
If any phase returns an error, the following module will be created:
 
* UX_Snapshot_project_name.
 
 
 
An image from the active window will be shown (with -ss_config active) displaying the error when it took place.
 
  
Correct output execution example:
+
Example of successful execution:
  
 
  <module>
 
  <module>
     <name><![CDATA[UX_Status_calculadora.sikuli]]></name>
+
     <name><![CDATA[UX_Status_std.html]]></name>
 
     <type>generic_proc</type>
 
     <type>generic_proc</type>
 
     <nowiki><data><![CDATA[1]]></data></nowiki>
 
     <nowiki><data><![CDATA[1]]></data></nowiki>
     <description><![CDATA[C:\pandora_ux\calculadora.sikuli execution completed Control snapshot rebuild ]]></description>
+
     <description><![CDATA[Test OK]]></description>
 
     <tags>UX</tags>
 
     <tags>UX</tags>
 
     <module_group>UX</module_group>
 
     <module_group>UX</module_group>
 
  </module>
 
  </module>
 
  <module>
 
  <module>
     <name><![CDATA[UX_Time_calculadora.sikuli]]></name>
+
     <name><![CDATA[UX_Time_std.html]]></name>
 
     <type>generic_data</type>
 
     <type>generic_data</type>
     <nowiki><data><![CDATA[20.204]]></data></nowiki>
+
     <nowiki><data><![CDATA[16.317]]></data></nowiki>
     <description><![CDATA[C:\pandora_ux\calculadora.sikuli execution completed Control snapshot rebuilt ]]></description>
+
     <description><![CDATA[Test OK]]></description>
 
     <tags>UX</tags>
 
     <tags>UX</tags>
 
     <module_group>UX</module_group>
 
     <module_group>UX</module_group>
     <module_parent>UX_Status_calculadora.sikuli</module_parent>
+
     <module_parent>UX_Status_std.html</module_parent>
</module>
 
<module>
 
    <name><![CDATA[UX_Control_Snapshot_calculadora.sikuli]]></name>
 
    <type>async_string</type>
 
    <nowiki><data><![CDATA[data:image/png;base64, IBCAIAAAAOCnfhAAAAAXNSR…/4x79e/7757f8H2C00s1C73yMAAAAASUVORK5CYII=]]></data></nowiki>
 
    <description><![CDATA[Control image rebuilt]]></description>
 
    <tags>UX</tags>
 
    <module_group>UX</module_group>
 
    <module_parent>UX_Status_calculadora.sikuli</module_parent>
 
 
  </module>
 
  </module>
  
Incorrect output execution example:
+
Output with erroneous execution example:
  
 
  <module>
 
  <module>
Line 592: Line 727:
 
     <module_parent>UX_Status_std.html</module_parent>
 
     <module_parent>UX_Status_std.html</module_parent>
 
  </module>
 
  </module>
 +
 
  <module>
 
  <module>
 
     <name><![CDATA[UX_Snapshot_std.html]]></name>
 
     <name><![CDATA[UX_Snapshot_std.html]]></name>
Line 602: Line 738:
 
  </module>
 
  </module>
  
If everything is OK, add the execution line for the Pandora FMS agent installed on the Windows device as a plugin. The line looks like this (one line):
+
If everything has turned out right, you may add the execution line to the Pandora FMS agent installed on the machine that you have prepared to run the checks. The line to add to the agent configuration file will look like this (in one line):
 +
In Windows:
 +
module_plugin C:\Users\artica\Documents\Product\UX-Trans\UX\pandora_ux_x64.exe -exe PWR -script C:\Users\artica\Documents\Product\UX-Trans\PWR\session.html -folder <screenshot path>
 +
In Linux:
 +
module_plugin /usr/share/pandora_server/tool/pwrd/firefox/pandora_ux.64 -exe PWR -script /usr/share/pandora_server/tool/pwrd/firefox/TestUX.html -pwr_port 4444
  
module_plugin C:\Users\artica\Documents\Producto\UX-Trans\ux\pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -script C:\PDR\calc.sikuli -folder C:\PDR\ -ss_config active -checkpoint -post "taskkill /F /IM calc.exe"
+
Once it reports information to the Pandora FMS server, you will see how the corresponding modules appear. You may enable the view in "hierarchical mode" to see the relationship between them:
  
As it can be seen, the execution has more options. The ''-checkpoint'' parameter displays a screenshot of the final result, even if there are no errors on display, ''-post'' will execute actions once the session replay has finished. In this case, close the calculation process initiated by the recording to avoid a system collapse due to an excess of opened windows, or any similar process.
+
<br>
 
+
[[File:ux33.JPG|center|800px]]
Now that the agent has the ''module_plugin'' execution line ready, launch it in process mode, executing the following from the admin command line:
+
<br>
 
 
"C:\Program Files\pandora_agent\PandoraAgent.exe" --process
 
 
 
Obviously, the complete route to the ''PandoraAgent.exe'' executable should correspond to your installation.
 
  
When launched, you can see how actions are automatically executed according to the recording. From now on, '''the agent process must not be closed''' or a session initiated on the machine from a remote desktop or the executions may be interrupted. The machine should remain untouched, this being the reason why virtual machines are recommended.
+
As indicated previously, you see the result of the execution (whether it was successful or not) in the module ''UX_Status_sesion.html'', the time spent (in seconds) in the ''UX_Time_sesion.html'' module, and another with a screenshot of the last failure in ''UX_Snapshot_sesion.html'', which in this case is empty. It will be on these modules where you may create alerts and show the individual graphs of each module.
  
 
<center>
 
<center>
[[File:imagen_nueva_pdr.png]]
+
[[File:imagen_nueva_ux.png]]
 
</center>
 
</center>
  
{{Tip|If you have other automatic monitoring tests, you can include them in Pandora FMS with the following execution.}}
+
=== Phase-based execution ===
  
pandora_ux.64 -exe <exe of the aumotatic monitoring system> -args <system parameters> -script <file PAHT of the test>
+
If you have a transactional recording with Pandora FMS UX PWR, as indicated in previous sections, the system itself will generate the required modules to identify each of the indicated stages, so the execution will not change regarding the previous case. Just indicate the corresponding html file, which in this case will contain the different stages. Windows execution example:
  
==== Transaction-based execution ====
+
pandora_ux_x64 -exe PWR -script C:\tests\std.html –folder <screenshot path>
  
Once there are several processes recorded, and verified for correct functioning, with the PDR, execute the following:  
+
The following modules will be returned by stage:
 +
* UX_Time_project_name.phase_order
 +
* UX_Status_project_name.phase_order
  
C:\Users\artica\Documents\Producto\UX-Trans\ux\pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -t calculadora_trans -script C:\PDR\calc.sikuli,C:\PDR\savecalc.sikuli,C:\PDR\savefile.sikuli -folder C:\PDR\ -ss_config active
+
If there is any phase with an error, the following module will also be created:
 +
* UX_Snapshot_project_name.phase_order
  
As it can be seen, you only need to indicate the new script's route in the ''-script'' parameter, separated by a comma from the previous script, and employ the '''-t''' parameter with the name of the transaction which covers all the different phases. If the process contains more phases, just apply the same logic, e.g.:
+
It will display an image of the web at the time of the error.
  
pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -t proceso_transaccional -script C:\PDR\script1,C:\PDR\script2,C:\PDR\script3,C:\PDR\script4 -folder C:\PDR\ -ss_config active
+
The global summary modules identified with the following names will also be returned:
 +
* UX_Global_Time_project_name
 +
* UX_Global_Status_project_name
 +
* UX_Global_Snapshot_project_name
  
Add the following line to the agent configuration file:
+
A web image at the time of the error will be displayed.
  
module_plugin C:\Users\artica\Documents\Producto\UX-Trans\ux\pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -t calculadora_trans -script C:\PDR\calc.sikuli,C:\PDR\savecalc.sikuli,C:\PDR\savefile.sikuli -folder C:\PDR\ -ss_config active -checkpoint -post "taskkill /F /IM calc.exe"
+
The agent's execution line would be the same as in the previous case, but with the html file that contains the stated phases.
  
Thanks to the ''-checkpoint'' parameter, screenshots of the final result from each phase can be viewed on the Pandora console.
+
And when the information correctly reaches Pandora FMS server, it will be displayed as modules in this way. Enabling the view in ''hierarchical mode'' in the module list will help you see the information much more clearly:
  
The following modules will be returned by phase:
+
<br>
* UX_Time_project_name.phase_order.
+
[[File:ux34.JPG|center|800px]]
* UX_Status_project_name.phase_order.
+
<br>
  
If any of the phases returns an error, the following module will be created:
+
By accessing the ''WUX''section of the agent, you may see additional details of the transaction and its stages:
* UX_Snapshot_project_name.phase_order.
 
  
In case of error, it will also display a web image with the time the error took place.
+
The example below represents a browsing process of our website and the purchase of multiple items, divided into 5 stages to accurately measure the times and know where improvements are needed, or a bottleneck takes place:
  
It also returns global summary modules with the following IDs:
+
<br>
* UX_Global_Time_project_name.
+
[[File:ux44.JPG|center|800px]]
* UX_Global_Status_project_name.
+
<br>
* UX_Global_Snapshot_project_name.
 
  
 +
=== Value recovery ===
  
When the agent is running in process mode and the modules are recovered by Pandora FMS, they can be seen on the console. Once again, via ''hierarchy mode'' view, the relation among the modules, and the boundaries between phases can be clearly seen:
+
Pandora FMS UX is capable of retrieving data directly from the website during the execution of user experience tests.
  
[[File:ux41.JPG|center|800px]]
+
To use this new feature, add the screenshot command as a comment in the Selenium test:
  
Details of the phases and time charts can be viewed in the transaction display:
+
<br>
 +
[[File:PWR_recorder_getValue.png|center|600px]]
 +
<br>
  
[[File:ux42.JPG|center|800px]]
+
In the example here, two values are retrieved after navigation and will be represented as modules in Pandora FMS (number and result in text).
  
Error screenshots are only shown when the UX client (PWR) and the PWR server are both running on the same machine. Otherwise, the PWR server image delivery directory should be accessible for the client in order to view the image on Pandora FMS.
+
The steps to make the plugin collect data are as follows:
 +
* Add a new comment to your test file with the Selenium recorder.
 +
* Add the directive to the comment.
  
Using these same modules, you can create alerts and view the history in order to generate graphs and display the evolution over time of your systems.
+
Data capture policy
  
It is recommended to create a programmed task that boots the Pandora agent in process mode when the system boots up, to avoid interrupting executions, even when the system has been force-booted, and to ensure the agent is executed even though the machine is on automatic login mode, without password protection.
+
getValue;module name;module data type;regular expression for data capture
  
[[File:ux26.JPG|center]]
+
What does each field separated by semicolons represent?
[[File:ux27.JPG|center|800px]]
 
[[File:ux28.JPG|center]]
 
[[File:ux29.JPG|center]]
 
[[File:ux30.JPG|center]]
 
[[File:ux31.JPG|center]]
 
[[File:ux32.JPG|center]]
 
  
This guarantees that the Pandora FMS agent will always be running in process mode even when the machine restarts on the Windows instance at hand, being always able to send the harvested data by the PDR probe.
+
* <b>getValue</b>: Instruction for the UX system.
 +
* <b>Module name</b>: The name of the module as it appears in Pandora FMS.
 +
*<b>Module data type</b>: What type will be used. It can be any of the data types supported by Pandora FMS (generic_proc, generic_data, generic_data_string, async_proc, async_data, async_string...)
 +
*<b>Perl regular expression to use for data capture</b>: It must be a Perl regular expression, with the information capture command between brackets.
  
Systems with several desktops can present problems, in which case it is recommended to always use the previously described configuration, on any machine in desktop mode and autostart and a single desktop.
+
For example, in the text:
  
= WEB User experience transactional monitoring (WUX) =
+
<pre>
 +
<p> The temperature of the solar panel is: <span class="temperature">54º C</span></p>
 +
</pre>
  
== Introduction ==
+
If you wish to retrieve the temperature to keep track of the value, specify the regular expression as follows:
  
Pandora WUX is a Pandora FMS internal component, which allows users to automate web browser interaction. In order to work, WUXServer must be connected to a Pandora Web Robot Daemon (PWRD) server.
+
<pre>
 +
<span class="temperature">(\d+\.*\,*\d*).*</span>
 +
</pre>
 +
In such a way that it will recover the value 54 of the example, or possible values with decimal places.
  
PWRD is a service that executes step by step actions pre-recorded by the user in a web portal. To achieve this, PWRD uses Selenium web automation technology.
+
The full capture directive would be as follows:
  
It is therefore imperative that the user shows Pandora FMS WUXServer the actions that must be performed to navigate through the web portal.
+
<pre>
 
+
getValue;solar panel temperature;generic_data;<span class="temperature">(\d+\.*\,*\d*).*</span>
With this data, Pandora FMS WUXServer will generate a report with the results of the performances, time spent, and screenshots with the possible errors.
+
</pre>
 
 
Pandora FMS WUX Server is able to split browsing sessions into phases, which simplifies the view and helps you to debug possible bottlenecks.
 
  
 +
= Data management and display =
  
<br>
+
== Create a web analysis module in Pandora FMS Console ==
[[File:wux_simple.png|center]]
 
<br>
 
  
== Configuration ==
+
Once the browsing session is recorded, it is time to deploy it as a module in Pandora FMS console.
  
In order to enable WUX Server on Pandora FMS server, configure the <b>Pandora FMS Web Robot service (PWRD)</b>
+
To do it, access any agent linked to a server with the WUX feature enabled and create "Web analysis" module:
  
=== Pandora Web Robot Daemon (PWRD) ===
+
[[File:Wux_module.PNG|center|400px]]
  
Pandora Web Robot Daemon is a service, which provides tools to automate web browser sessions, using a file containing a list of necessary actions in order to navigate the user's web portal.
 
  
It comes integrated with the Pandora server and it can be found in the /usr/share/pandora_server/util/pwrd folder when installing the Enterprise server (Linux) or in the module library (Windows)
+
Once "create" is selected, fill in all the fields the form presents:
  
It contains:
+
[[File:Wux_new_module_form2.PNG|center]]
  
* Firefox 43 Binary for Windows.
+
* Module name: WUX Module (Parent). All sub-modules with the monitoring results will rely on this new module.
* Pre-built profile to perform web browser sessions.
+
* Target web site: For monitoring website performance statistics.
* Server for session automation (Selenium server).
+
* Run performance tests: It indicates that you wish to monitor not only the browsing experience, but also the performance statistics of access to the target website.
 +
* Data history: To save or not the historical information of the modules that monitor this user experience.
 +
* ''Textarea'' section: Text box where to copy (or load) the content of the files from the browsing session that you previously recorded.
  
  
=== PWRD deployment on Linux===
+
==== Custom macros ====
  
The Selenium component of the PWRD daemon requires java in order to work, so install it:
+
Custom macros enabled involve replacing certain text strings present in your browsing session file with certain custom values.
  
  yum install java
+
This feature has been improved for web analysis modules, enabling '''dynamic macros''' that allow these values to be translated into variable '''dates and times'''.
  
In order for PWRD to be able to launch Firefox on a Linux server, install xorg-x11-server-Xvfb, gtk2 and gtk3 to be able to virtualize graphical environments:
+
Why this feature?
  
yum install xorg-x11-server-Xvfb gtk2 gtk3
+
Suppose you need to monitor, through a browsing session, the correct operation of a meeting room booking web application.
  
If its not available in your repository, you can find the RPMs files in following links:
+
If you set a fixed date and time when filling in the form data, it is possible that the system canceled the booking because at some point it is in the past. For example, you might be trying to book a room for the past week.
ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm
 
  
ftp://rpmfind.net/linux/centos/7.4.1708/os/x86_64/Packages/gtk2-2.24.31-1.el7.x86_64.rpm
+
It is also possible that you find a time limit to make that reservation, and that the system forces you to book the room within a specific time period, for example, no farther than the current month.
  
To install the RPMs manually:
+
To avoid having to edit the macro every few days, and not worry about the configuration section, you may use dynamic macros, telling the system to always book the room for the next day at the time of performing the test.
  
yum install xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm
+
In order to use this feature, the values must have a specific format, achieving the following possible replacements:
yum install gtk2-2.24.31-1.el7.x86_64.rpm
 
  
Then, proceed to install PWRD daemon, which can be found in the /usr/share/pandora_server/util/pwrd/ folder when installing the Enterprise server.
+
  @DATE_FORMAT (current date/time with user-defined format)
 +
@DATE_FORMAT_nh (hours)
 +
@DATE_FORMAT_nm (minutes)
 +
@DATE_FORMAT_nd (days)
 +
@DATE_FORMAT_ns (seconds)
 +
@DATE_FORMAT_nM (month)
 +
@DATE_FORMAT_nY (year)
  
cd /usr/share/pandora_server/util/pwrd/
 
./install_pwrd.sh --install
 
  
 +
Where "n" can be an unsigned (positive) or negative number.
  
In version 730 and later, the possibility of performing the customized installation with a user and a directory different from those of the default installation has been added.
+
And FORMAT follows the standard of [http://search.cpan.org/~dexter/POSIX-strftime-GNU-0.02/lib/POSIX/strftime/GNU.pm strftime of perl]
  
Once installed, start it.
 
  
PWRD provides several working modes:
+
For example:
  
* '''Standalone'''This is the standard mode; it will launch a single PWRD instance, each will be assigned to a Pandora FMS server.
+
@DATE_%Y-%m-%d %H:%M:%S
 +
  @DATE_%H:%M:%S_300s
 +
@DATE_%H:%M:%S_-1h
  
* '''HUB''': Concentrator mode. In this mode, PWRD service will not evaluate browser sessions directly; instead, "nodes" will have to be registered to execute tasks. This is the cluster mode from the PWRD service. Each HUB will be assigned to a Pandora FMS server.
+
== Data display ==
  
 
+
The information generated by WUX will be displayed in the form of modules as follows. Enabling the view in ''hierarchical mode'' in the module list will help you see the information much more clearly:
====PWRD in standalone mode ====
 
 
 
PWRD in standalone mode will start the daemon and will prepare it to execute the actions indicated by the user through WUX Server.
 
  
 
<br>
 
<br>
[[File:wux_pwrd_standalone.png|center]]
+
[[File:WUX_modules.PNG|center|800px]]
 
<br>
 
<br>
  
# Start
+
Within this hierarchy you find the following modules:
/etc/init.d/pwrd start
 
  
#Get status
+
* ''module''_Global_Status: It will indicate the '''global''' state of the complete navigation.
/etc/init.d/pwrd status
+
* ''module'' _ Global_Time: It will indicate the '''global''' time spent in full navigation.
 +
* ''module''_ Global_Screenshot: It contains an image with the result of the navigation error, '''it will only be generated in case of error'''
 +
* ''module''_Phase X: ''Phase name''_ Status: It will indicate the navigation status during phase X.
 +
* ''module''_Phase X: ''Phase name''_Time: It will indicate the time spent in phase X.
  
# Stop it
+
Example: Error screenshot view.
/etc/init.d/pwrd stop
 
 
 
 
 
 
 
====PWRD in "HUB" mode====
 
 
 
Concentrator mode or HUB will start the daemon as a load balancer. In this working mode, the system will balance the load between all nodes registered in the system, assigning the execution of the navigation sessions, depending on their workload.
 
 
 
You can always check the status of the HUB by accessing the HUB administration console:
 
 
 
<nowiki>http://hub:4444/grid/console</nowiki>
 
  
 
<br>
 
<br>
[[File:wux_pwrd_hub.png|center]]
+
[[File:Wux_screenshot.png|center|800px]]
<br>  
+
<br>
  
# Start
+
{{warning|Warning: If you have updated from previous versions to Pandora FMS 7.0NG 712, you must make a small change.}}
/etc/init.d/pwrd start-hub
 
  
# Get status
+
In order to store the screenshots generated by WUX Server, you will need to launch the following operations in your database schema:
/etc/init.d/pwrd status-hub
 
  
  # Stop it
+
  alter table tagent_status modify column data mediumtext;
  /etc/init.d/pwrd stop-hub
+
  alter table tagent_data_string modify column data mediumtext;
  
 +
If you do not perform, you may not see the full screenshot.
  
 +
By accessing the ''WUX''section of the agent, you may see additional details of the transaction and its stages:
  
=====Add PWRD nodes to the HUB=====
+
<center>
 +
[[File:Wux_nueva_imagen.png]]
 +
</center>
  
To add a new PWRD node, the following is required:
+
Website statistics are summarized in the following concepts:
  
* A hub (PWRD in HUB mode)
+
* '''Stats_TT''': Total time to load the website.
* PWRD files, on the same or different machines
+
* '''Stats_TDNS''': Total time to solve the target's IP address.
* TCP/4444 connectivity from the computer that hosts the node to the computer that hosts the HUB.
+
* '''Stats_TTCP''': Time spent connecting through TCP.
 +
* '''Stats_TSSL''': Time spent establishing SSL communication.
 +
* '''Stats_TST''': Time elapsed until data transfer started.
 +
* '''Stats_TTC''’: Time transferring data. It will group all the resource transfer times.
 +
* '''Stats_TTR''': Time taken to transfer the content of the page.
 +
* '''Stats_TTR_main''': Time used to transfer the HTML code.
 +
* '''Stats_TTR_image''':  Time spent transferring image type resources (png|jpg|jpeg|bmp|tiff|gif|webp|svg).
 +
* '''Stats_TTR_css''': Time taken to transfer style sheets.
 +
* '''Stats_TTR_js''': Time spent transferring JavaScript files.
  
In this work mode, the service will process all queued <b>requests from the hub (HUB)</b>, returning the results of the executions to it. It will be the HUB who will speak exclusively with the WUX Server, being transparent for HUB who is executing the actions of the user.
+
== Assign alerts to a web analytics module ==
  
 +
The alerts associated with the web analysis modules follow the same operating dynamics as the entire alert system in Pandora FMS.
  
  # Start and register in the HUB, replace "hub" with the server IP PWRD HUB
+
For compatibility purposes, it is recommended to assign the alert templates on the sub-elements self-generated by the web analysis module, such as:
  /etc/init.d/pwrd start-node <nowiki>http://hub:4444/grid/register</nowiki>
 
  
Check status
+
* The status of global navigation.
/etc/init.d/pwrd status-node
+
* Alerts about time thresholds.
 +
* Alerts with warning template set to "always" for result screenshot modules.
  
Stop it
+
== New widgets for Dashboards ==
/etc/init.d/pwrd stop-node
 
  
==== Pandora FMS server configuration====
+
In order to represent user navigation information, two new types of widgets have been added:
  
Regardless of the chosen mode, once started, start assigning executions of your browsing sessions, adding the configuration parameters of WUX Server to the configuration file of Pandora FMS server.
+
Navigation phase status widget:
 +
<br>
 +
[[File:widget_wux_fases.PNG|center]]
 +
<br>
  
Assuming that you have deployed your PWRD server on the same server that runs Pandora FMS server, add the following configuration:
+
Website statistics widget:
 
+
<br>
# add to /etc/pandora/pandora_server.conf
+
[[File:widget_wux_stats.PNG|center]]
wuxserver 1
+
<br>
wux_host 127.0.0.1
 
wux_port 4444
 
 
 
=== Installation on Windows ===
 
  
Steps to prepare a working environment for Pandora WUX on Windows.
+
= Desktop User Experience (PDR) =
  
<b>Note</b>: It is strongly recommended Linux to host the PWRD service.
+
== PDR system deployment (Windows only) ==
  
==== PWRD deployment on Windows systems ====
+
The PDR system only works on Windows systems, and once it is run by the Pandora FMS agent, it must run in '''process mode''', since running in service mode will not work. Also, it will not be possible to lock the desktop session, so it is recommended to use it on virtual machines.
  
 
Prerequisites:
 
Prerequisites:
* Download [https://library.pandorafms.com/index.php?sec=Library&sec2=repository&lng=es&action=view_PUI&id_PUI=816 PWRD server ]
+
* Windows system in desktop mode with auto start and auto login.
  
* Install Java 1.8 on the machine.
+
To achieve this configuration, execute:
* Install Firefox 47.0.1 (download from https://ftp.mozilla.org/pub/firefox/releases/47.0.1/).
+
  control userpasswords2
* Prepare a Firefox profile that will be used to test automated sessions (optional): http://toolsqa.com/selenium-webdriver/custom-firefox-profile/
 
* Create a  C:\PWR directory
 
  
To download the PWR_Server.zip, go to the following link: ''https://pandorafms.com/library/pwr-server-for-ux-monitoring/''
+
And uncheck the box "Users must enter a username and password to use this computer":
 
 
Create the following file distribution:
 
* PWR_Server.zip file decompression into C:\PWR\
 
* Export Firefox profile to C:\PWR\profile
 
 
 
Using a profile for checks is not essential, however it is recommended, especially when using proxy or when using autocomplete passwords.
 
To create a Firefox profile, follow the steps in the following screenshots:
 
  
 
<br>
 
<br>
[[File:ux1.JPG|center]]
+
[[File:ux5.JPG|center]]
<br>
 
[[File:ux2.JPG|center]]
 
 
<br>
 
<br>
  
Choose the destination directory:
+
To prepare the environment, create the following directories:
  
<br>
+
C:\PDR
[[File:ux3.JPG|center]]
 
<br>
 
  
Start Firefox with the new profile to customize options such as proxy, displayed popups, etc:
+
And unzip the "PDR.rar" file provided in the following link: ''https://pandorafms.com/library/pdr-cmd-for-ux-monitoring/'' in ''C:\PDR''.
  
<br>
+
== Record a PDR session ==
[[File:ux4.JPG|center]]
 
<br>
 
  
Then, install the service by executing the  ''service_installer.bat'' BAT file provided and start the service:
+
To start the recorder, run the following script:  
  
  net start PWRSRV
+
  C:\PDR\pdr
 
 
From this moment on, the Selenium server is running on the machine. However, it can be run manually (by previously stopping the service) if you want to carry out ''debugging'' tasks, using the following command:
 
 
 
java -jar selenium-server-standalone-2.53.1.jar -firefoxProfileTemplate C:\selenium\firefox_profile -port 4444 -v
 
 
 
== Recording a PWR session ==
 
 
 
Before monitoring user experience, record the actions you want the system to perform, in order to browse through your web portal
 
 
 
To do this, the "PWR recorder" feature is available in the [https://pandorafms.com/library/pandora-ux-and-wux-pwr-recorder/  module library].
 
 
 
Run the downloaded file to start the recording environment.
 
Once the environment is started, access the recorder by clicking on the following button:
 
  
 
<br>
 
<br>
[[File:iniciar_grabador.png|center]]
+
[[File:scriptwux22332.png|center]]
 
<br>
 
<br>
  
 
+
After the loading process, enter the recording environment:
A window like the one shown in the image will be displayed:
 
 
 
  
 
<br>
 
<br>
[[File:ux10.JPG|center]]
+
[[File:ux18.JPG|center|800px]]
 
<br>
 
<br>
  
 +
Select the actions you wish to perform and do a screenshot on the area where you want to apply them. Below you can find a list with the most common ones.
  
From this moment on, you will be able to browse the website that you want to monitor and the different actions of each step further that you take will appear in the recorder.
+
General actions:
 
 
To stop recording use the following button, located at the top right of the recorder:
 
 
 
  
 
<br>
 
<br>
[[File:ux11.JPG|center]]
+
[[File:ux19.JPG|center]]
 
<br>
 
<br>
  
 
+
Flow control actions:
After completing the actions, you can perform checks on the page, for example verifying the existence of a certain text to ensure that the page loaded is correct. To do this, right-click on a section of text in the browser window while you continue recording, and select the ''verifyText'' option:
 
  
 
<br>
 
<br>
[[File:ux13.JPG|center]]
+
[[File:ux20.JPG|center]]
 
<br>
 
<br>
  
A new step will appear in the recorder, indicating said text checking action:
+
More language help: http://sikulix-2014.readthedocs.io/en/latest/index.html
  
<br>
+
When recording the project, a folder will be created that will contain the following elements:
[[File:ux14.JPG|center]]
+
* .py file with the automation script code.
<br>
+
* Images to control navigation.
  
 +
A simple example of execution could be monitoring that your Windows calculator works correctly. We will show the whole process through screenshots.
  
You can replay the entire sequence using the button ''Play Entire test suite'' and check that it is successfully completed:
+
1. Choose the "click" action and the area where you wish to apply the action. The screen will change to "area selection" mode:
  
 
<br>
 
<br>
[[File:ux15.JPG|center|800px]]
+
[[File:ux21.JPG|center]]
 +
<br>
 +
[[File:ux22.JPG|center]]
 
<br>
 
<br>
  
 
+
2. Enter the action ''type'' and the text "calc". Then enter the actions to wait for the "calculator" area to appear and click on it. Then wait for the calculator window to appear to enter the following actions this way:
After verifying the validity of the navigation sequence, save it (File -> Save Test Case). This will be the file that will be loaded when creating a new web analysis module in your Pandora FMS console.
 
 
 
 
 
=== Recording a transactional session for Pandora WUX ===
 
 
 
Pandora WUX allows splitting browsing monitoring of a website into multiple modules, representing each of the steps performed.
 
 
 
To add a new control point and generate the phase modules (up until that point) right-click on the point where you want to identify the start phase.
 
  
 
<br>
 
<br>
[[File:pwrd_recorder_transaction.PNG|center]]
+
[[File:ux23.JPG|center]]
 
<br>
 
<br>
  
Write the following text as a comment:
+
3. Then click on the corresponding buttons, selecting the areas as in the previous steps.
 
 
phase_start:name_of_phase
 
  
The phase will encompass the time and result of all commands that exist up until the following comment:
+
4. Finally save the process and run it using the '''Run''' button.
  
phase_end:name_of_phase
+
Important comments:
 +
* If you double click on any of the images within the recording environment, you may adjust details of the control screenshot, such as selecting the exact point where to click.
 +
* It is highly recommended to enter actions such as ''wait'' after each click to make sure that the execution will not stop due to an operating system delay.
 +
* The recorder will search for the area that looks the same as the screenshot, so special care should be taken in case something is highlighted when the button is located above (for example, the calculator buttons change to orange when the mouse is hovering over them).
  
All commands that are run between a phase_start y phase_end label will be covered in this phase.
+
In the folder where you stored the recording you may see the image files and the Python file.
  
 
<br>
 
<br>
[[File:pwrd_recorder_transaction2.PNG|center]]
+
[[File:ux24.JPG|center]]
 
<br>
 
<br>
  
== Creating a Web Analytics module in Pandora FMS Console ==
+
<b><u>Nota</u>:</b> You can customize the capture made from the PDR recording engine using the following code:
  
Once the browsing session is recorded, deploy it as a module in Pandora FMS console.
+
## OPTIONAL ##capture file names
 +
import shutil
 +
file = "C:\probes\screenshot_prueba.sikuli.png"
 +
focusWindow = App.focusedWindow()
 +
regionImage = capture(focusWindow)
 +
shutil.move(regionImage, file)
  
To do so, access '''any agent associated with a server with WUX feature enabled''' and create a "Web analysis" module:
 
  
[[File:Wux_module.PNG|center|400px]]
+
This will create an image of the active window in the destination indicated by file, with which you may take a screenshot right when you want.
 +
You may customize the screenshot using coordinates. To that end, specify the following syntax:
  
 +
capture(x, y, w, h)
  
 +
Where:
  
 +
X: X position of the rectangle to take a screenshot on.
  
After selecting "create" fill out all fields showed in the form:
+
Y: Y position of the rectangle to take a screenshot on.
  
[[File:Wux_new_module_form2.PNG|center|800px]]
+
W: Screenshot width.
  
* Module Name: Module WUX (Father), all sub-modules with monitoring results will depend on this new module.
+
H: Screenshot height.
* Target Web site: For website monitoring performance statistics.
 
* Run performance test: It indicates that you want to monitor not only the browsing experience, but also the performance statistics of access to the target web site.
 
* Historical data: Saving or not saving the historical data modules that monitor that user experience.
 
* '' textarea '' section: in this text box copy (or upload) content files of the browsing session you have previously recorded.
 
  
 +
<br><br>
  
 +
=== Record a transactional session with Pandora FMS UX PDR ===
  
==== Custom Macros ====
+
It is not necessary to record a specific session. Just record the sessions you need in different scripts. It will be Pandora FMS UX who manages the return of results to organize it as a complex transaction. In the next point, we will see how to make the execution call for it to work correctly.
  
The operation of custom macros involves replacing certain text strings that are present in the browsing session file with certain customizable values.
+
If you are going to make several recordings to create a transactional process, be careful when making the recording and make sure the elements you are looking for are present. It is recommended to manually execute the recordings that you wish to use in a single transactional process continuously, to ensure that the actions proceed as expected.
  
In the case of web analytics modules, this feature has been improved, enabling  '''dynamic macros'''  which allow these values to be translated into '''dates and times ''' variables.
+
The following example contains a recording process that will represent the second phase of the process used in the previous example. The result returned by the calculator is copied and pasted into a notebook. The recording looks like this:
  
What is the purpose of the feature then?
+
<br>
 +
[[File:ux40.JPG|center]]
 +
<br>
  
Let us suppose that you need to monitor, through a browsing session, the proper functioning of a web application that focuses on booking meeting rooms.
+
And another sequence that will consist of saving the text file in a certain location is included, overwriting the previous one. This offers high flexibility, since it opens the possibility of monitoring these files at the same time, reflecting the needed information in all kinds of checks for heavy desktop applications. This third sequence consists of the following steps:
  
If a date and time fixed is established, the system would probably cancel the reservation because at some point it might stay in the past, for example it could be trying to book a room for last week.
+
<br>
 +
[[File:ux43.JPG|center]]
 +
<br>
  
You may also find a maximum limit of time to carry out that reservation, and that the system requires you to book the room within a certain period of time, for example, not exceeding the current month.
+
== PDR session execution ==
  
To avoid editing the macro every few days, and worrying  about the configuration section, you can use the dynamic macros, telling the system to always book the room for the next day when doing the test.
+
=== Standard execution ===
  
 +
To launch pre-recorded PDR sessions, the working mode indicated is the path to the pdr.cmd file displayed at the corresponding point, the argument of said "-r" file, the file that contains the session directives (-script), the directory where to store the screenshots (-folder) ending in "\", which is optional, where to save the screenshots in the folder where the pdr is located. You may also enter the number of consecutive retries in case of failure, optional parameter.
  
To use this feature, the values must have a specific format, making possible the following replacements:
+
In the next run, the screen capture is also customized to collect only the active window:
  
  @DATE_FORMAT (current date / time with user-defined format)
+
  pandora_ux_x64 -exe C:\PDR\pdr -args -r -script C:\pandora_ux\calculadora.sikuli -folder C:\pandora_ux\ -ss_config active -retries 3
@DATE_FORMAT_nh (hours)
 
@DATE_FORMAT_nm (minutes)
 
@DATE_FORMAT_nd (days)
 
@DATE_FORMAT_ns (seconds)
 
@DATE_FORMAT_nM (month)
 
@DATE_FORMAT_nY (years)
 
  
 +
The following modules will be returned:
 +
* UX_Time_project_name.
 +
* UX_Status_project_name.
 +
* UX_Control_Snapshot_project_name (only on the first run).
  
"n" may be an unsigned number (positive) or negative.
+
If there is an error at any stage, the following module will also be created:
 +
* UX_Snapshot_project_name.
  
And FORMAT follows the [http://search.cpan.org/~dexter/POSIX-strftime-GNU-0.02/lib/POSIX/strftime/GNU.pm perl strftime] standard.
+
And it will show an image of the active window (with -ss_config active) from when the failure took place.
  
 +
Example of successful execution:
  
Examples:
+
<module>
 +
    <name><![CDATA[UX_Status_calculator.sikuli]]></name>
 +
    <type>generic_proc</type>
 +
    <nowiki><data><![CDATA[1]]></data></nowiki>
 +
    <description><![CDATA[C:\pandora_ux\calculator.sikuli execution completed Control snapshot rebuild ]]></description>
 +
    <tags>UX</tags>
 +
    <module_group>UX</module_group>
 +
</module>
 +
<module>
 +
    <name><![CDATA[UX_Time_calculator.sikuli]]></name>
 +
    <type>generic_data</type>
 +
    <nowiki><data><![CDATA[20.204]]></data></nowiki>
 +
    <description><![CDATA[C:\pandora_ux\calculator.sikuli execution completed Control snapshot rebuilt ]]></description>
 +
    <tags>UX</tags>
 +
    <module_group>UX</module_group>
 +
    <module_parent>UX_Status_calculator.sikuli</module_parent>
 +
</module>
 +
<module>
 +
    <name><![CDATA[UX_Control_Snapshot_calculator.sikuli]]></name>
 +
    <type>async_string</type>
 +
    <nowiki><data><![CDATA[data:image/png;base64, IBCAIAAAAOCnfhAAAAAXNSR…/4x79e/7757f8H2C00s1C73yMAAAAASUVORK5CYII=]]></data></nowiki>
 +
    <description><![CDATA[Control image rebuilt]]></description>
 +
    <tags>UX</tags>
 +
    <module_group>UX</module_group>
 +
    <module_parent>UX_Status_calculator.sikuli</module_parent>
 +
</module>
  
@DATE_%Y-%m-%d %H:%M:%S
+
Example of output with failed execution:
@DATE_%H:%M:%S_300s
 
@DATE_%H:%M:%S_-1h
 
  
== Uploading certificates to Firefox profile ==
+
<module>
 +
    <name><![CDATA[UX_Status_std.html]]></name>
 +
    <type>generic_proc</type>
 +
    <nowiki><data><![CDATA[0]]></data>
 +
</nowiki>    <description><![CDATA[Failed to execute verifyText]]></description>
 +
    <tags>UX</tags>
 +
    <module_group>UX</module_group>
 +
</module>
 +
<module>
 +
    <name><![CDATA[UX_Time_std.html]]></name>
 +
    <type>generic_data</type>
 +
    <nowiki><data><![CDATA[15.463]]></data>
 +
</nowiki>    <description><![CDATA[Failed to execute verifyText]]></description>
 +
    <tags>UX</tags>
 +
    <module_group>UX</module_group>
 +
    <module_parent>UX_Status_std.html</module_parent>
 +
</module>
 +
<module>
 +
    <name><![CDATA[UX_Snapshot_std.html]]></name>
 +
    <type>async_string</type>
 +
    <nowiki><data><![CDATA[data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAA…JRU5ErkJggg==]]></data>
 +
</nowiki>    <description><![CDATA[Image (last error)]]></description>
 +
    <tags>UX</tags>
 +
    <module_group>UX</module_group>
 +
    <module_parent>UX_Status_std.html</module_parent>
 +
</module>
  
It is possible that some of the configured checks will run against web pages that use self-signed certificates or signed by a CA not included in the Firefox default accepted CA, so in such cases it will be necessary to load the certificate in question into the Firefox profile being used.
+
If everything turned out to be a success, you may add the execution line to the Pandora FMS agent installed on the Windows machine as an agent plugin. The line to add to the agent configuration file will look like this (in a single line):
  
To do it, launch the browser in a graphical environment, access the URL and add the SSL certificate. Next it is explained how to do it both in Windows and Linux:
+
module_plugin C:\Users\artica\Documents\Product\UX-Trans\ux\pandora_ux_x64.exe -exe C:\PDR\pdr.bat -args -r -script C:\PDR\calc.sikuli -folder C:\PDR\ -ss_config active -checkpoint -post "taskkill /F /IM calc.exe"
  
=== With PWRD deployed on Windows systems ===
+
As you can see, this run has a few more options. The ''-checkpoint'' parameter is used to show a screenshot of the result, even if there is no failure. ''-post'' will execute actions after the session playback is finished. In this case, the calculator process that started the recording is closed, to prevent the system from failing due to too many open windows or similar processes.
  
In this case, since it is a graphical environment, start the Firefox browser with the profile used for checks:
+
Now that the agent has the execution line ''module_plugin'' ready, it is launched in process mode, executing the following from the command line as administrator:
  
[[File:Profile_01.png|center]]
+
"C:\Program Files\pandora_agent\PandoraAgent.exe" --process
  
[[File:Profile_02.png|center]]
+
Obviously, the full path to the executable "PandoraAgent.exe" must be the one corresponding to the installation.  
  
Once started, access the URL with the certificate you want to upload and add it as an exception for the browser:
+
When launching it, the actions will be executed automatically according to the recording. From that point onwards '''the agent process should not be closed''', and you should not log in the machine through remote desktop, or the executions could be interrupted. The machine must be left unhandled, that is why its use is recommended in virtual machines.
  
[[File:Profile_03.png|center]]
+
<center>
 +
[[File:imagen_nueva_pdr.png]]
 +
</center>
  
[[File:Profile_04.png|center]]
+
{{Tip|If you already have automation tests, they can be included in Pandora FMS with the following execution.}}
  
Another possibility, if you want to accept any SSL certificate, would be to access the Firefox options, the "Privacy & Security" tab, and uncheck the field called "Query OCSP responder servers to confirm the current validity of certificates":
+
pandora_ux.64 -exe <exe of the automation system> -args <system arguments> -script <test file path>
  
[[File:Profile_05.png|center]]
+
=== Transaction-based execution ===
  
[[File:Profile_06.png|center]]
+
If you have recorded different processes with PDR and you have checked they work by playing them continuously, run:
  
=== With PWRD deployed on Linux systems ===
+
C:\Users\artica\Documents\Producto\UX-Trans\ux\pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -t calculadora_trans -script C:\PDR\calc.sikuli,C:\PDR\savecalc.sikuli,C:\PDR\savefile.sikuli -folder C:\PDR\ -ss_config active
  
In general, when a Linux server is installed, it does not include a graphical desktop environment, so in order to follow the same steps as in the previous case, make a redirection of the graphical X to a computer where there is a graphical desktop environment. This can be done differently by redirecting the X to a graphical desktop in Linux or Windows.
+
As it can be seen, just indicate the path of the new script in the ''-script'' parameter separated by a comma from the previous script and use the '''-t''' parameter with the name of the transaction that will include the different phases . If the process had more phases, the same logic would be followed, for example:
  
==== Redirecting X11 to a Linux desktop ====
+
pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -t proceso_transaccional -script C:\PDR\script1,C:\PDR\script2,C:\PDR\script3,C:\PDR\script4 -folder C:\PDR\ -ss_config active
  
Doing this is very simple, since it will be enough to establish an SSH connection to the PWRD server with the "-X" parameter:
+
The line to add to the agent configuration file, in this case, is the following:
  
  ssh -X [email protected]_ip_address
+
  module_plugin C:\Users\artica\Documents\Producto\UX-Trans\ux\pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -t calculadora_trans -script C:\PDR\calc.sikuli,C:\PDR\savecalc.sikuli,C:\PDR\savefile.sikuli -folder C:\PDR\ -ss_config active -checkpoint -post "taskkill /F /IM calc.exe"
  
Once this has been done, if the Firefox browser is launched, it can be seen how it looks on the desktop:
+
Thanks to the ''-checkpoint'' parameter, you may see screenshots of the result of each phase in the Pandora FMS console.
  
firefox -p
+
The following modules will be returned by stage:
 +
* UX_Time_project_name.phase_order
 +
* UX_Status_project_name.phase_order
  
In a default installation, only the default profile will be seen, so it would be advisable to do as in the Windows installation and create a new profile to use it:
+
If there is any phase with an error, the following module will also be created:
 +
* UX_Snapshot_project_name.phase_order
  
[[File:Profile_07.png|center]]
+
It will also display an image of the web at the time of the failure, should it take place.
  
[[File:Profile_08.png|center]]
+
The global summary modules identified with the following names will also be returned:
 +
* UX_Global_Time_project_name
 +
* UX_Global_Status_project_name
 +
* UX_Global_Snapshot_project_name
  
[[File:Profile_09.png|center]]
 
  
If you save the profile in a path other than '''/opt/firefox_profile''', you will need to edit the '''/etc/init.d/pwrd''' PWRD start script to indicate the path to the new profile:
+
When the agent is running in process mode and the modules are recovered by Pandora FMS you will see them in the console. Again, through the view in "hierarchical mode" you can clearly show the relationship between the modules shown, clearly defining the different phases:
  
PWROPTS=" -firefoxProfileTemplate /path/to/profile/folder"
+
<br>
 +
[[File:ux41.JPG|center|800px]]
 +
<br>
  
With the profile created, start the browser:
+
And in the transaction viewer, you can see the detail of the phases and the graph with the times:
  
[[File:Profile_10.png|center]]
+
<br>
 +
[[File:ux42.JPG|center|800px]]
 +
<br>
  
Once started, access the URL with the certificate you want to upload and add it as an exception for the browser:
+
The error traps will only be shown when the UX client (PWR) and the PWR server are running on the same machine. Otherwise, the directory for image delivery by the PWR server must be accessible by the client in order to display the image in Pandora FMS.
  
[[File:Profile_11.png|center]]
+
It will be on these modules where you may create alerts and see the history to build graphs and show the evolution of your systems over time.
  
[[File:Profile_12.png|center]]
+
It is recommended to create a scheduled task that starts the Pandora FMS agent in process mode when the computer starts. This will not interrupt executions even if the system is forcefully restarted and if it is in automatic login mode without password, the agent will always be run even if the machine is restarted.
 
 
Another possibility, if you want to accept any SSL certificate, would be to access the Firefox options, in the "Advanced > Certificates" tab, and deselect the field named "Query the OCSP respondent servers to confirm the current validity of the certificates":
 
 
 
[[File:Profile_13.png|center]]
 
 
 
[[File:Profile_14.png|center]]
 
 
 
==== Redirecting X11 to a desktop in Windows ====
 
 
 
In the case of Windows, first install an X server to be able to do the redirection, like '''Xming'''. Once installed and started, do the X redirection.
 
 
 
Using the SSH Putty client, go to the "Connection > SSH > X11" section before making the connection, and make sure that the option "Enable X11 forwarding" is marked as well as filling in the "X display location" field with "localhost:0":
 
 
 
[[File:Profile_15.png|center]]
 
 
 
Then, go back to the "Session" section and establish the connection:
 
 
 
[[File:Profile_16.png|center]]
 
 
 
Once the connection is established, by launching the Firefox browser on the PWRD server, it is possible to have it displayed on the Windows desktop.
 
 
 
firefox -p
 
 
 
In a default installation, there is only the default profile, so it is recommended to do as in the Windows installation and create a new profile:
 
 
 
[[File:Profile_17.png|center]]
 
 
 
[[File:Profile_18.png|center]]
 
 
 
[[File:Profile_19.png|center]]
 
 
 
If you save the profile in a path other than '''/opt/firefox_profile''', you will need to edit the '''/etc/init.d/pwrd''' PWRD startup script to mark the path to the new profile:
 
 
 
PWROPTS=" -firefoxProfileTemplate /path/to/profile/folder"
 
 
 
With the profile created, start the browser:
 
 
 
[[File:Profile_20.png|center]]
 
 
 
Once started, access the URL with the certificate you want to upload and add it as an exception for the browser:
 
 
 
[[File:Profile_21.png|center]]
 
 
 
[[File:Profile_22.png|center]]
 
 
 
Another possibility, if you wish to accept any SSL certificate, would be to go to Firefox options, to the "Advanced > Certificates" tab, and deselect the field named "Query the OCSP respondent servers to confirm the current validity of the certificates":
 
 
 
[[File:Profile_23.png|center]]
 
 
 
[[File:Profile_24.png|center]]
 
 
 
== Data viewing ==
 
 
 
The information generated by WUX is displayed in modules as follows. Enabling the '' hierarchically '' view mode in the list of modules will help you to view the information much more clearly:
 
  
 
<br>
 
<br>
[[File:WUX_modules.PNG|center|800px]]
+
[[File:ux26.JPG|center]]
 +
<br>
 +
[[File:ux27.JPG|center|800px]]
 +
<br>
 +
[[File:ux28.JPG|center]]
 
<br>
 
<br>
 
+
[[File:ux29.JPG|center]]
 
 
Within this hierarchy the following modules can be found:
 
 
 
* ''module''_Global_Status: It indicates the  '''global''' state of complete browsing.
 
* ''module''_Global_Time: It indicates the '''global''' time lapsed of complete browsing.
 
* ''module''_Global_Screenshot: It contains an image with the result of browsing error, '''it will be generated only in case of error'''
 
* ''module''_Phase X: ''Name of phase''_Status: It indicates the status of the browsing in Phase X
 
* ''module''_Phase X: ''Name of phase''_Time: It indicates time lapsed in Phase X
 
 
 
Example: Error capture view.
 
 
 
 
<br>
 
<br>
[[File:Wux_screenshot.png|center|800px]]
+
[[File:ux30.JPG|center]]
 
<br>
 
<br>
 
+
[[File:ux31.JPG|center]]
{{warning|Attention: If you upgraded from versions prior to Pandora FMS 7.0NG 712 you must make a small change.}}
 
 
 
In order to store the screenshots generated by WUXServer, execute the following operations on your database schema:
 
 
 
alter table tagente_estado modify column datos mediumtext;
 
alter table tagente_datos_string modify column datos mediumtext;
 
 
 
If you do not execute this actions, your screenshots may be incomplete or cropped.
 
 
 
Accessing the ''WUX'' section Agent, you can see additional details of the transaction and its phases:
 
 
 
<center>
 
[[File:Wux_nueva_imagen.png]]
 
</center>
 
 
 
 
 
 
 
Website statistics are summarized in the following concepts:
 
 
 
* '''Stats_TT''': Total time to obtain the website.
 
* '''Stats_TDNS''': Total time to resolve the IP address of the target.
 
* '''Stats_TTCP''': Time spent on connecting via TCP.
 
* '''Stats_TSSL''': Time spent on establishing SSL communication.
 
* '''Stats_TST''' : Time lapsed until data transfer started.
 
* '''Stats_TTC''' : Time spent transferring data. It will gather all the transfer time of the resources.
 
* '''Stats_TTR''' : Time used to transfer the content of the page.
 
* '''Stats_TTR_main''': Time lapsed to transfer the HTML code.
 
* '''Stats_TTR_image''':  Time used to transfer resources of the image type (png|jpg|jpeg|bmp|tiff|gif|webp|svg).
 
* '''Stats_TTR_css''': Time spent on transferring style sheets.
 
* '''Stats_TTR_js''': Time spent on transferring the JavaScript files.
 
 
 
== Assign alerts to a web analysis module ==
 
 
 
Alerts associated with Web analysis modules follow the same operating dynamics as the entire alert system in Pandora FMS.
 
 
 
For compatibility reasons, it is recommended to assign templates of alerts on sub-elements self-generated by the analytics web module, such as:
 
 
 
* The state of global browsing
 
* Alerts on threshold times
 
* Alerts with warning template set as "always" for result screenshot modules
 
 
 
== New widgets for Dashboards ==
 
 
 
To be able to display user browsing information, two new widget types have been added:
 
 
 
Widget for browsing phases status
 
 
<br>
 
<br>
[[File:widget_wux_fases.PNG|center]]
+
[[File:ux32.JPG|center]]
 
<br>
 
<br>
  
 +
That way you will ensure the Pandora FMS agent will always be running in process mode in this Windows system, even when the machine is restarted, being able to always send the information collected by the PDR probe.
  
 +
Systems with multiple desktops can be troublesome, so it is always recommended to use the configuration described above, on a desktop-mode machine with auto-login and a single desktop.
  
Widget for website statistics
+
 
<br>
+
[[Pandora:Documentation|Go back to Pandora FMS Documentation Index]]
[[File:widget_wux_stats.PNG|center]]
 
<br>
 

Revision as of 10:52, 17 April 2020

Contents

1 Introduction

User experience monitoring consists of recording automated tasks both for web browsing (PWR / WUX) and for interacting with Windows desktop and system applications (PDR). These recordings can consist of a mouse click on a browser, writing a text, searching throughout the Internet or opening an application on the desktop. This will allow you to perform the recorded functions automatically and they will be executed to obtain results, such as the time spent performing the tasks. To that end, there is automated UX monitoring and user web experience (WUX) monitoring.

From Pandora FMS version 7.0NG.728, UX and WUX monitoring have been merged with Pandora FMS console, offering both features on a single screen.

Wux ux unifcado.png

Next, we will see the differences between WUX and UX systems and the description of both features along with the different possibilities they offer.

2 Differences between UX and WUX monitoring

Both monitoring systems are used to execute automated web browsing tasks using Pandora Web Robot Daemon (PWRD) system.

The UX system performs these monitoring tasks using the software agent installed on a machine, while WUX monitoring is based on a server integrated within Pandora FMS.

Pandora Web Robot Daemon (PWRD) is a service that provides the necessary tools to automate web browsing sessions. To do it, it uses a file that contains a list of the actions necessary to navigate the user's web portal.

Additionally, UX monitoring enables the execution of the automated tasks that interact with Windows desktop and system applications. These types of tasks cannot be performed with WUX.

Pandora FMS UX is a system that executes automated tasks, giving Pandora FMS a report with the execution results, time spent and screenshots with the errors that may be found.

Pandora FMS PWR technology for UX allows browsing websites, simulating user actions. You may check content, texts, etc. It is the perfect choice for monitoring non-flash-based web sites and applications. Its advantage: it is faster and offers the possibility of running in the background.

If you have a task automation system, Pandora FMS UX also allows you to execute the scripts you already have and monitor their execution.

It is important to specify the use of this type of monitoring. Both methods are based on monitoring execution by means of a plugin in the software agents installed in the corresponding machines.


Info.png

For web transaction execution, use Selenium Engine.

 



3 Web User Experience (WUX) with Selenium 3


For Selenium deployment on WUX servers, a container-based stack will be used for fast deployment and easy scaling.

3.1 Previous settings

Docker and Docker Compose must be previously installed and we recommend using CentOS as the base operating system.

For this installation, we recommend following the Docker documentation at: https://docs.docker.com/engine/install/

The official Selenium images will be used for the installation and deployment of the stack. You may find them at: https://hub.docker.com/u/selenium

Different images with browsers are available in the Selenium repository. For Pandora FMS, we recommend Firefox and Chrome containers.

3.2 Selenium Stack Deployment

To deploy the Selenium stack, it will be necessary to first create a YAML file with the necessary configuration:

# To execute this docker-compose yml file, use `docker-compose -f <file_name> up`
# Add the `-d` flag at the end for detached execution
version: "3"
services:
  selenium-hub:
    image: selenium/hub:3.141.59-zinc
    container_name: selenium-hub
    ports:
      - "4444:4444"
    environment:
      - GRID_BROWSER_TIMEOUT=60000
      - GRID_TIMEOUT=60000
      - GRID_MAX_SESSION=50
      - GRID_CLEAN_UP_CYCLE=60000
      - GRID_UNREGISTER_IF_STILL_DOWN_AFTER=180000
      - GRID_NEW_SESSION_WAIT_TIMEOUT=60000
  chrome:
    image: selenium/node-chrome:3.141.59-zinc
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444
  firefox:
    image: selenium/node-firefox:3.141.59-zinc
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444

It can be saved as docker-compose.yml to make identifying it easier.

To activate the container with the defined settings, just run the following command:

docker-compose -f <compose-file> up -d

If you need to check the services running in the container, use the following command:

docker-compose -f <compose-file> ps

To see the status and logs of Selenium services, use the following command:

docker-compose -f <compose-file> logs

Once the appropriate checks have been made, to verify the grid works properly and the workers have signed up as you defined in the configuration file, go to the following URL:

http://<ip_selenium_server>:4444/grid/console


Newux4.png

If you need to scale the number of workers, just run the following command:

docker-compose -f <compose-file> scale chrome=X firefox=Y

3.2.1 Upload pwrd images from ISO

If you do not have Internet access to connect to Docker Hub servers and download the images, you will find everything you need in Pandora FMS ISO.

The steps to be followed are:

  • Build the pandora_enterprise ISO in /mnt
  • Copy the file pwrd.tar.gz (600M => 1.7G) to /root
  • Unzip.
  • Import the images.
$ mount /dev/cdrom0 /mnt
$ cp /mnt/Packages/pwrd.tar.gz /root/
$ cd /root
$ tar xvzf pwrd.tar.gz
$ docker load < chrome.node*.tar
$ docker load < firefox.node.*.tar
$ docker load < hub.3.*.tar

To check that the images have been correctly uploaded, the following command will be run:

docker images

3.3 Selenium service infrastructure

Selenium works as a hub where a container, that works as a grid where to deploy the necessary worker containers, is enabled.

Newux9.png

3.4 Pandora FMS Configuration

To use the centralized mode (WUX) it will be necessary to apply the following configuration to the Pandora FMS server.

Regardless of the chosen mode, once started you may start assigning executions from your browsing sessions, adding the WUX Server configuration parameters to the configuration file of your Pandora FMS server.

Assuming that you have deployed your PWRD server on the same server where your Pandora FMS server runs, add the following configuration:

# add to /etc/pandora/pandora_server.conf
wuxserver 1
wux_host 127.0.0.1
wux_port 4444

3.5 Appendix: Add workers for Internet Explorer and Microsoft Edge

If it is necessary to launch web transactions against Microsoft browsers, it will be necessary to configure a machine (physical or virtual) with the desired Windows version and configure the driver following the official documentation.

Internet Explorer driver installation documentation:

github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver

Info.png

We recommend using driver 3.141 version 32bit to avoid performance 64bit version problems.

 


Microsoft Edge driver installation documentation:

https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

To run Selenium, Java must be installed on the Windows device.

To check whether Java is installed, run this command:

java -version

You should get an output like the following:

Newux1.png

The Selenium JAR file will also be required to run the server locally and register it on your grid.

It can be obtained at:

https://www.selenium.dev/downloads/

Newux2.png

To activate the Microsoft Edge server, the following must be run in a terminal in the directory where you have the JAR file:

java -jar selenium-server-standalone-<VER>.jar -port 5555 -role node -hub 
http://<ip_selenium_server>:4444/grid/register -browser "browserName=MicrosoftEdge, 
platform=WINDOWS, maxInstances=1"

The command is similar to activate the Internet Explorer server, but the path of the downloaded driver must be specified:

java -Dwebdriver.ie.driver=<PATH>IEDriverServer.exe -jar selenium-server- 
standalone<VER>.jar -port 5555 -role node -hub 
http://ip_selenium_server:4444/grid/register -browser "browserName=internet 
explorer,platform=WINDOWS,maxInstances=1"

Newux3.png

Template warning.png

The Windows Firewall must be configured to allow traffic on the ports specified in the run command. In the case of examples 5555 and 4444.

 


3.6 Recording

For Selenium version 3, both old and new recordings will be supported.

In order to record a new session, the Selenium IDE extension must be installed in the desired browser.

The next icon will be the one that allows to start the recording environment once the extension is installed.

Newux10.png

A menu that will allow to start new recording projects will open.

Newux5.png

Once the recording is made, it will result in something like the following:

Newux6.png

Apart from the feature provided by Selenium, Pandora FMS has custom commands to retrieve information from the target to be monitored.

3.6.1 Commands

  • extract: It combines 'source' and its own code for extraction.
  • storeExtraction: It stores the result of extract in a variable.
  • dispatchEvent: It triggers a Javascript event on a given element.
  • takeElementScreenshot: It takes a screenshot of a specific item.
  • phase_start: It starts a stage and turns the test into a WUX transaction.
  • phase_end: It completes a phase.
  • clickAndWait: It simulates the behavior of this Selenium 2 command in Selenium 3.
  • waitForPageToLoad: It simulates the behavior of this Selenium 2 command in Selenium 3.

3.6.2 Module generating commands

  • getValue: It retrieves a value:
getValue;name module;module type;screenshot REGEX
  • getScreenshot: It retrieves a screenshot:
getScreenshot;module name

Template warning.png

All own commands must appear in the test file (.side) as comments. Otherwise, it will fail when testing the test in the Selenium extension.

 


4 Web User Experience (WUX) with Selenium 2

4.1 Previous settings

4.1.1 Selenium

4.1.1.1 Pandora Web Robot Daemon (PWRD) deployment

Pandora FMS Web Robot Daemon is a service that provides the necessary tools to automate web browsing sessions, using a file that contains a list of the actions necessary to navigate the user's web portal.

It comes integrated with the Pandora FMS server and can be found in the /usr/share/pandora_server/util/pwrd folder when installing the Enterprise server (Linux) or in the module library (Windows).

To download it, go to the following link: https://pandorafms.com/library/pandora-ux-and-wux-pwr-recorder/

It contains:

  • Firefox browser binary version 47.
  • Pre-built profile for executing web browsing sessions.
  • Session automation server (Selenium server).

4.1.1.2 Selenium server deployment on Windows systems

Prerequisites:

C:\PWR

To download the PWR_Server.zip, go to the following link: https://pandorafms.com/library/pwr-server-for-ux-monitoring/

Do the following file distribution:

  • Unzip the PWR_Server.zip file to C:\PWR\
  • Export Firefox profile to C:\PWR\profile

The use of a profile to carry out checks is not mandatory, however it is recommended particularly when using a proxy or wanting to use password autocompletion. To create a Firefox profile, follow the steps from the following screenshots:


Ux1.JPG


Ux2.JPG


Choose the destination directory:


Ux3.JPG


Start Firefox with the new profile to customize options such as proxy, popup display, etc.:


Ux4.JPG


Next, install the service by executing the provided BAT file service_installer.ba . For the service_installer.bat to work properly, modify the content, typing in the paths that exist in the file as they are installed on your machine. For example, Java can only work if you have correctly configured its PATH. Otherwise, you will have to provide the full PATH inside the file. Finally, start the service:

net start PWRSRV

From this point, the Selenium server is running on your machine. However, you may execute it manually (stopping the service previously) in case you wish to perform debugging tasks, using the following command:

java -jar C:\PWR\server\selenium-server-standalone-2.53.0.jar -firefoxProfileTemplate C:\PWR\profile -port 4444 -v

4.1.1.3 Selenium server deployment on Linux systems

Prerequisites:

The Selenium component of the PWRD daemon requires Java to work, so it needs to be installed:

yum install java 

For PWRD to be able to launch Firefox on your Linux server, it will be necessary to install xorg-x11-server-Xvfb, gtk2 and gtk3 in order to virtualize a graphical environment:

yum install xorg-x11-server-Xvfb gtk2 gtk3

If it is not available in your repositories, you may find the rpm files in the following links: ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm

ftp://rpmfind.net/linux/centos/7.4.1708/os/x86_64/Packages/gtk2-2.24.31-1.el7.x86_64.rpm

To manually install the rpm packages:

yum install xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm
yum install gtk2-2.24.31-1.el7.x86_64.rpm

Once the prerequisites are installed, continue with the installation of install_pwrd.sh. This installer is found by default in the folder /usr/share/pandora_server/util/pwrd/install_pwrd.sh and it is executed as follows:

cd /usr/share/pandora_server/util/pwrd/
./install_pwrd.sh --install

Once installed, start the service:

/etc/init.d/pwrd start

Use the following script to start the Selenium server:

#!/bin/sh
# Monitoring selenium process
if [[ "`ps aux |grep selenium |grep -v grep |grep -v selenium.sh |wc -l `" != "0" ]]; then
   exit
else
   if [[ "`ps aux |grep Xvfb |grep -v grep | wc -l `" != "0" ]]; then
      Xvfb :99 -ac &
      export DISPLAY=:99
   fi
   export DISPLAY=:99
   java -jar /usr/share/pandora_server/util/pwdr/selenium-server-standalone-2.53.1.jar &
fi

Or manually with the following commands:

$ Xvfb :99 -ac &
-> Press Enter to continue
$ export DISPLAY=:99
$ java -jar  /usr/share/pandora_server/util/pwdr/selenium-server-standalone-2.53.1.jar -port 4444 &


In version 730 and later, the possibility of performing the custom installation with a user and a directory different from those of the default installation has been added.

4.1.1.3.1 PWRD operating modes

PWRD provides several operating modes:

  • Standalone: This standard mode will launch a single PWRD instance. Each of these instances will be associated with a Pandora FMS server.
  • HUB: Hub mode. In this mode, the PWRD service will not evaluate the browsing sessions directly, but "nodes" must be registered to execute the tasks. It is the cluster mode of the PWRD service. Each HUB will be assigned to a Pandora FMS server.
4.1.1.3.1.1 PWRD in standalone mode

PWRD in standalone mode will start the daemon and get it ready to execute the actions indicated by the user through WUX Server.


Wux pwrd standalone.png



# Start
/etc/init.d/pwrd start
# see the status
/etc/init.d/pwrd status
# stop
/etc/init.d/pwrd stop


4.1.1.3.1.2 PWRD in "HUB" mode

The hub mode will start the daemon as a load balancer. In this work mode, the system will balance the load among all the nodes that are registered on it, assigning browsing session execution to the nodes according to their workload.

You can see the HUB status at any time by accessing the HUB administration console:

http://hub:4444/grid/console



Wux pwrd hub.png



# Start
/etc/init.d/pwrd start-hub
# see the status
/etc/init.d/pwrd status-hub
# stop
/etc/init.d/pwrd stop-hub


4.1.1.3.1.3 Add PWRD nodes to your HUB

To add a new PWRD node, you will need:

  • A hub (PWRD in HUB mode).
  • PWRD files, on the same or on different machines.
  • TCP / 4444 connectivity from the computer hosting the node to the computer hosting the HUB.

In this working mode, the service will process all those requests queued from the hub (HUB) , giving back the results of the executions. It will be the HUB who will speak exclusively with the WUX Server, for which the one who executes the user's actions is visible.

# Start and sign up in the HUB, replace "hub" with the IP of the PWRD HUB server
/etc/init.d/pwrd start-node http://hub:4444/grid/register
# see the status
/etc/init.d/pwrd status-node
# stop
/etc/init.d/pwrd stop-node

4.1.1.4 Pandora FMS server configuration

To use the centralized mode (WUX), it will be necessary to apply the following configuration to the Pandora FMS server.

Regardless of the chosen mode, once started you may start assigning executions from your browsing sessions, adding the WUX Server configuration parameters to the configuration file of your Pandora FMS server.

Assuming that you have deployed your PWRD server on the same server where your Pandora FMS server runs, you should add the following configuration:

# add to /etc/pandora/pandora_server.conf
wuxserver 1
wux_host 127.0.0.1
wux_port 4444


4.1.1.5 Uploading certificates for Firefox

It is possible that some of the configured checks are executed against web pages that use self-signed certificates or signed by a CA not included in those accepted by default in Firefox, so in those cases it will be necessary to load the certificate itself in the Firefox profile that is being used.

The easiest way to do it is to start the browser in a graphical environment, access the URL and add the SSL certificate. Next, we will explain how to do it both in Windows and Linux:

4.1.1.5.1 With PWRD deployed on Windows systems

In this case, since you have a graphical environment, just start the Firefox browser with the profile used for the checks:

Profile 01.png
Profile 02.png

Once started, access the URL with the certificate you want to load and add it as an exception for the browser:

Profile 03.png
Profile 04.png

Another possibility, if you want to accept any SSL certificate, would be to go to Firefox options, go to "Privacy & Security" and uncheck the field "Check responding OCSP servers to guarantee the current validity of the certificates":

Profile 05.png
Profile 06.png
4.1.1.5.2 With PWRD deployed on Linux systems

In general, when a Linux server is installed, it is not included in a graphical desktop environment, so in order to follow the same steps as in the previous case, redirect the graphical Xs to a computer where you do have a graphical desktop environment. This is done differently if we redirect the Xs to a graphical desktop in Linux or Windows.

4.1.1.5.2.1 Redirecting X11 to a Linux desktop

Doing it is very simple, since it will be enough to set an SSH connection to the PWRD server with the parameter "-X":

ssh -X [email protected]_ip_address

Once this is done, if you launch the Firefox browser, it will be shown on your desktop:

firefox -p

In a default installation, you will only see the "default" profile, so it would be advisable to do as in the installation in Windows and create a new profile to use:

Profile 07.png
Profile 08.png
Profile 09.png

In case of saving the profile in a path other than /opt/firefox_profile, it will be necessary to edit the PWRD starting script /etc/init.d/pwrd to indicate the path to the new profile:

PWROPTS=" -firefoxProfileTemplate /path/to/profile/folder"

With the created profile, you can start the browser:

Profile 10.png

Once started, access the URL with the certificate you want to load and add it as an exception for the browser:

Profile 11.png
Profile 12.png

Another possibility, if you want to accept any SSL certificate, would be to go to Firefox options, go to "Privacy & Security" and uncheck the field "Check responding OCSP servers to guarantee the current validity of the certificates":

Profile 13.png
Profile 14.png
4.1.1.5.2.2 Redirecting X11 to a Windows desktop

In Windows, first install an X server to be able to redirect, such as Xming. Once installed and started, redirect the Xs.

Using the SSH Putty client, go to the "Connection> SSH> X11" section before connecting, and make sure you check the "Enable X11 forwarding" option and fill in the "X display location" field as "localhost:0":

Profile 15.png

Then go back to the "Session" section and establish the connection:

Profile 16.png

Once the connection is established, if you launch the Firefox browser on the PWRD server, you may see it on the Windows desktop.

firefox -p

In a default installation, you will only see the "default" profile, so it would be advisable to do as in the installation in Windows and create a new profile to use:

Profile 17.png
Profile 18.png
Profile 19.png

In case of saving the profile in a path other than /opt/firefox_profile, it will be necessary to edit the PWRD starting script /etc/init.d/pwrd to indicate the path to the new profile:

PWROPTS=" -firefoxProfileTemplate /path/to/profile/folder"

With the created profile, you can start the browser:

Profile 20.png

Once started, access the URL with the certificate you want to load and add it as an exception for the browser:

Profile 21.png
Profile 22.png

Another possibility, if you want to accept any SSL certificate, would be to go to Firefox options, go to "Privacy & Security" and uncheck the field "Check responding OCSP servers to guarantee the current validity of the certificates":

Profile 23.png
Profile 24.png


4.1.2 Session Recorder (PWR)

Template warning.png

The new Selenium IDE version will be supported by Pandora FMS version 745 onwards, when Selenium 3 is implemented. Transactions recorded in Selenium 2 will not be affected.

 


Before monitoring a user experience, record it. Use the appropriate recording system according to the type of technology you chose.

To record a navigation with PWR, you will need the PWRD recorder available in the module library:

https://pandorafms.com/library/pandora-ux-and-wux-pwr-recorder/

It contains:

Start the PWR_recorder.exe recorder:


PWR recorder.PNG


It will automatically start Firefox with the environment ready to record PWR sessions:


PWR recorder main.png



After accessing the Selenium IDE, you may start recording your user experience:


Ux10.JPG


From that moment on, you will be able to navigate throughout the website that you wish to monitor and the different actions of each step that you take will appear in the recorder.

To stop the recording, use the following button, located in the upper right corner of the recorder:


Ux11.JPG


Once these actions are completed, perform the checks on the website. For example, check the existence of a certain text to make sure that the loaded page is the correct one. To that end, right-click on a section of text on the browser window while you keep recording, and select the option verifyText:


Ux13.JPG


A new step will appear in the recorder indicating the indicated text checking action:


Ux14.JPG


You may play the full sequence using the button Play entire test suite and check that it ends correctly:


Ux15.JPG


Once the validity of the navigation sequence is verified, save it (File -> Save Test Case) to execute it afterwards with Pandora FMS UX. The resulting file will be an HTML document that Pandora FMS UX will interpret.


4.1.2.1 Record a transactional session for Pandora WUX

Pandora FMS WUX allows dividing navigation monitoring into multiple modules, which will represent each one of the steps carried out.

To insert a new control point and generate the phase modules (up to that point), right-click on the point where you want to identify the beginning of the phase.


Pwrd recorder transaction.PNG


Type in the following text as a comment:

phase_start:phase_name

The phase will include the time and result of all the commands found until the following comment:

phase_start:phase_name

All commands executed between phase_start and phase_end tags will be included within that phase.


Pwrd recorder transaction2.PNG


4.2 Web transaction execution

4.2.1 Standard execution

To launch pre-recorded PWR sessions, call the executable "pandora_ux_x64.exe", which can be downloaded from the following link: "https: //pandorafms.com/library/user-experience-pandora-ux" '

Indicate that the working mode is PWR, and the file that contains the session guidelines. In the path indicated in the -folder parameter, the screenshots will be saved to be shown in case of failure, optional parameter. You may also enter the number of consecutive retries in case of failure, optional parameter. Its execution in Windows is:

pandora_ux_x64.exe -exe PWR -script C:\tests\std.html -retries 3

The following modules will be returned:

  • UX_Status_project_name: if the sequence succeeded or failed.
  • UX_Time_project_name: time taken to complete the sequence.
  • UX_Snapshot_project_name: screenshot right before the error, if any.

Example of successful execution:

<module>
   <name><![CDATA[UX_Status_std.html]]></name>
   <type>generic_proc</type>
   <data><![CDATA[1]]></data>
   <description><![CDATA[Test OK]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
</module>
<module>
   <name><![CDATA[UX_Time_std.html]]></name>
   <type>generic_data</type>
   <data><![CDATA[16.317]]></data>
   <description><![CDATA[Test OK]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
   <module_parent>UX_Status_std.html</module_parent>
</module>

Output with erroneous execution example:

<module>
   <name><![CDATA[UX_Status_std.html]]></name>
   <type>generic_proc</type>
   <data><![CDATA[0]]></data>
   <description><![CDATA[Failed to execute verifyText]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
</module>
<module>
   <name><![CDATA[UX_Time_std.html]]></name>
   <type>generic_data</type>
   <data><![CDATA[15.463]]></data>
   <description><![CDATA[Failed to execute verifyText]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
   <module_parent>UX_Status_std.html</module_parent>
</module>

<module>
   <name><![CDATA[UX_Snapshot_std.html]]></name>
   <type>async_string</type>
   <data><![CDATA[data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAA…JRU5ErkJggg==]]></data>
   <description><![CDATA[Image (last error)]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
   <module_parent>UX_Status_std.html</module_parent>
</module>

If everything has turned out right, you may add the execution line to the Pandora FMS agent installed on the machine that you have prepared to run the checks. The line to add to the agent configuration file will look like this (in one line): In Windows:

module_plugin C:\Users\artica\Documents\Product\UX-Trans\UX\pandora_ux_x64.exe -exe PWR -script C:\Users\artica\Documents\Product\UX-Trans\PWR\session.html -folder <screenshot path>

In Linux:

module_plugin /usr/share/pandora_server/tool/pwrd/firefox/pandora_ux.64 -exe PWR -script /usr/share/pandora_server/tool/pwrd/firefox/TestUX.html -pwr_port 4444	

Once it reports information to the Pandora FMS server, you will see how the corresponding modules appear. You may enable the view in "hierarchical mode" to see the relationship between them:


Ux33.JPG


As indicated previously, you see the result of the execution (whether it was successful or not) in the module UX_Status_sesion.html, the time spent (in seconds) in the UX_Time_sesion.html module, and another with a screenshot of the last failure in UX_Snapshot_sesion.html, which in this case is empty. It will be on these modules where you may create alerts and show the individual graphs of each module.

Imagen nueva ux.png

4.2.2 Phase-based execution

If you have a transactional recording with Pandora FMS UX PWR, as indicated in previous sections, the system itself will generate the required modules to identify each of the indicated stages, so the execution will not change regarding the previous case. Just indicate the corresponding html file, which in this case will contain the different stages. Windows execution example:

pandora_ux_x64 -exe PWR -script C:\tests\std.html –folder <screenshot path>

The following modules will be returned by stage:

  • UX_Time_project_name.phase_order
  • UX_Status_project_name.phase_order

If there is any phase with an error, the following module will also be created:

  • UX_Snapshot_project_name.phase_order

It will display an image of the web at the time of the error.

The global summary modules identified with the following names will also be returned:

  • UX_Global_Time_project_name
  • UX_Global_Status_project_name
  • UX_Global_Snapshot_project_name

A web image at the time of the error will be displayed.

The agent's execution line would be the same as in the previous case, but with the html file that contains the stated phases.

And when the information correctly reaches Pandora FMS server, it will be displayed as modules in this way. Enabling the view in hierarchical mode in the module list will help you see the information much more clearly:


Ux34.JPG


By accessing the WUXsection of the agent, you may see additional details of the transaction and its stages:

The example below represents a browsing process of our website and the purchase of multiple items, divided into 5 stages to accurately measure the times and know where improvements are needed, or a bottleneck takes place:


Ux44.JPG


4.2.3 Value recovery

Pandora FMS UX is capable of retrieving data directly from the website during the execution of user experience tests.

To use this new feature, add the screenshot command as a comment in the Selenium test:


PWR recorder getValue.png


In the example here, two values are retrieved after navigation and will be represented as modules in Pandora FMS (number and result in text).

The steps to make the plugin collect data are as follows:

  • Add a new comment to your test file with the Selenium recorder.
  • Add the directive to the comment.

Data capture policy

getValue;module name;module data type;regular expression for data capture

What does each field separated by semicolons represent?

  • getValue: Instruction for the UX system.
  • Module name: The name of the module as it appears in Pandora FMS.
  • Module data type: What type will be used. It can be any of the data types supported by Pandora FMS (generic_proc, generic_data, generic_data_string, async_proc, async_data, async_string...)
  • Perl regular expression to use for data capture: It must be a Perl regular expression, with the information capture command between brackets.

For example, in the text:

 <p> The temperature of the solar panel is: <span class="temperature">54º C</span></p>

If you wish to retrieve the temperature to keep track of the value, specify the regular expression as follows:

<span class="temperature">(\d+\.*\,*\d*).*</span>

In such a way that it will recover the value 54 of the example, or possible values with decimal places.

The full capture directive would be as follows:

getValue;solar panel temperature;generic_data;<span class="temperature">(\d+\.*\,*\d*).*</span>

5 Data management and display

5.1 Create a web analysis module in Pandora FMS Console

Once the browsing session is recorded, it is time to deploy it as a module in Pandora FMS console.

To do it, access any agent linked to a server with the WUX feature enabled and create "Web analysis" module:

Wux module.PNG


Once "create" is selected, fill in all the fields the form presents:

Wux new module form2.PNG
  • Module name: WUX Module (Parent). All sub-modules with the monitoring results will rely on this new module.
  • Target web site: For monitoring website performance statistics.
  • Run performance tests: It indicates that you wish to monitor not only the browsing experience, but also the performance statistics of access to the target website.
  • Data history: To save or not the historical information of the modules that monitor this user experience.
  • Textarea section: Text box where to copy (or load) the content of the files from the browsing session that you previously recorded.


5.1.1 Custom macros

Custom macros enabled involve replacing certain text strings present in your browsing session file with certain custom values.

This feature has been improved for web analysis modules, enabling dynamic macros that allow these values to be translated into variable dates and times.

Why this feature?

Suppose you need to monitor, through a browsing session, the correct operation of a meeting room booking web application.

If you set a fixed date and time when filling in the form data, it is possible that the system canceled the booking because at some point it is in the past. For example, you might be trying to book a room for the past week.

It is also possible that you find a time limit to make that reservation, and that the system forces you to book the room within a specific time period, for example, no farther than the current month.

To avoid having to edit the macro every few days, and not worry about the configuration section, you may use dynamic macros, telling the system to always book the room for the next day at the time of performing the test.

In order to use this feature, the values must have a specific format, achieving the following possible replacements:

@DATE_FORMAT (current date/time with user-defined format)
@DATE_FORMAT_nh (hours)
@DATE_FORMAT_nm (minutes)
@DATE_FORMAT_nd (days)
@DATE_FORMAT_ns (seconds)
@DATE_FORMAT_nM (month)
@DATE_FORMAT_nY (year)


Where "n" can be an unsigned (positive) or negative number.

And FORMAT follows the standard of strftime of perl


For example:

@DATE_%Y-%m-%d %H:%M:%S
@DATE_%H:%M:%S_300s
@DATE_%H:%M:%S_-1h

5.2 Data display

The information generated by WUX will be displayed in the form of modules as follows. Enabling the view in hierarchical mode in the module list will help you see the information much more clearly:


WUX modules.PNG


Within this hierarchy you find the following modules:

  • module_Global_Status: It will indicate the global state of the complete navigation.
  • module _ Global_Time: It will indicate the global time spent in full navigation.
  • module_ Global_Screenshot: It contains an image with the result of the navigation error, it will only be generated in case of error
  • module_Phase X: Phase name_ Status: It will indicate the navigation status during phase X.
  • module_Phase X: Phase name_Time: It will indicate the time spent in phase X.

Example: Error screenshot view.


Wux screenshot.png


Template warning.png

Warning: If you have updated from previous versions to Pandora FMS 7.0NG 712, you must make a small change.

 


In order to store the screenshots generated by WUX Server, you will need to launch the following operations in your database schema:

alter table tagent_status modify column data mediumtext;
alter table tagent_data_string modify column data mediumtext;

If you do not perform, you may not see the full screenshot.

By accessing the WUXsection of the agent, you may see additional details of the transaction and its stages:

Wux nueva imagen.png

Website statistics are summarized in the following concepts:

  • Stats_TT: Total time to load the website.
  • Stats_TDNS: Total time to solve the target's IP address.
  • Stats_TTCP: Time spent connecting through TCP.
  • Stats_TSSL: Time spent establishing SSL communication.
  • Stats_TST: Time elapsed until data transfer started.
  • 'Stats_TTC’: Time transferring data. It will group all the resource transfer times.
  • Stats_TTR: Time taken to transfer the content of the page.
  • Stats_TTR_main: Time used to transfer the HTML code.
  • Stats_TTR_image: Time spent transferring image type resources (png|jpg|jpeg|bmp|tiff|gif|webp|svg).
  • Stats_TTR_css: Time taken to transfer style sheets.
  • Stats_TTR_js: Time spent transferring JavaScript files.

5.3 Assign alerts to a web analytics module

The alerts associated with the web analysis modules follow the same operating dynamics as the entire alert system in Pandora FMS.

For compatibility purposes, it is recommended to assign the alert templates on the sub-elements self-generated by the web analysis module, such as:

  • The status of global navigation.
  • Alerts about time thresholds.
  • Alerts with warning template set to "always" for result screenshot modules.

5.4 New widgets for Dashboards

In order to represent user navigation information, two new types of widgets have been added:

Navigation phase status widget:

Widget wux fases.PNG


Website statistics widget:

Widget wux stats.PNG


6 Desktop User Experience (PDR)

6.1 PDR system deployment (Windows only)

The PDR system only works on Windows systems, and once it is run by the Pandora FMS agent, it must run in process mode, since running in service mode will not work. Also, it will not be possible to lock the desktop session, so it is recommended to use it on virtual machines.

Prerequisites:

  • Windows system in desktop mode with auto start and auto login.

To achieve this configuration, execute:

control userpasswords2

And uncheck the box "Users must enter a username and password to use this computer":


Ux5.JPG


To prepare the environment, create the following directories:

C:\PDR

And unzip the "PDR.rar" file provided in the following link: https://pandorafms.com/library/pdr-cmd-for-ux-monitoring/ in C:\PDR.

6.2 Record a PDR session

To start the recorder, run the following script:

C:\PDR\pdr


Scriptwux22332.png


After the loading process, enter the recording environment:


Ux18.JPG


Select the actions you wish to perform and do a screenshot on the area where you want to apply them. Below you can find a list with the most common ones.

General actions:


Ux19.JPG


Flow control actions:


Ux20.JPG


More language help: http://sikulix-2014.readthedocs.io/en/latest/index.html

When recording the project, a folder will be created that will contain the following elements:

  • .py file with the automation script code.
  • Images to control navigation.

A simple example of execution could be monitoring that your Windows calculator works correctly. We will show the whole process through screenshots.

1. Choose the "click" action and the area where you wish to apply the action. The screen will change to "area selection" mode:


Ux21.JPG


Ux22.JPG


2. Enter the action type and the text "calc". Then enter the actions to wait for the "calculator" area to appear and click on it. Then wait for the calculator window to appear to enter the following actions this way:


Ux23.JPG


3. Then click on the corresponding buttons, selecting the areas as in the previous steps.

4. Finally save the process and run it using the Run button.

Important comments:

  • If you double click on any of the images within the recording environment, you may adjust details of the control screenshot, such as selecting the exact point where to click.
  • It is highly recommended to enter actions such as wait after each click to make sure that the execution will not stop due to an operating system delay.
  • The recorder will search for the area that looks the same as the screenshot, so special care should be taken in case something is highlighted when the button is located above (for example, the calculator buttons change to orange when the mouse is hovering over them).

In the folder where you stored the recording you may see the image files and the Python file.


Ux24.JPG


Nota: You can customize the capture made from the PDR recording engine using the following code:

## OPTIONAL ##capture file names
import shutil
file = "C:\probes\screenshot_prueba.sikuli.png"
focusWindow = App.focusedWindow()
regionImage = capture(focusWindow)
shutil.move(regionImage, file)


This will create an image of the active window in the destination indicated by file, with which you may take a screenshot right when you want. You may customize the screenshot using coordinates. To that end, specify the following syntax:

capture(x, y, w, h)

Where:

X: X position of the rectangle to take a screenshot on.

Y: Y position of the rectangle to take a screenshot on.

W: Screenshot width.

H: Screenshot height.



6.2.1 Record a transactional session with Pandora FMS UX PDR

It is not necessary to record a specific session. Just record the sessions you need in different scripts. It will be Pandora FMS UX who manages the return of results to organize it as a complex transaction. In the next point, we will see how to make the execution call for it to work correctly.

If you are going to make several recordings to create a transactional process, be careful when making the recording and make sure the elements you are looking for are present. It is recommended to manually execute the recordings that you wish to use in a single transactional process continuously, to ensure that the actions proceed as expected.

The following example contains a recording process that will represent the second phase of the process used in the previous example. The result returned by the calculator is copied and pasted into a notebook. The recording looks like this:


Ux40.JPG


And another sequence that will consist of saving the text file in a certain location is included, overwriting the previous one. This offers high flexibility, since it opens the possibility of monitoring these files at the same time, reflecting the needed information in all kinds of checks for heavy desktop applications. This third sequence consists of the following steps:


Ux43.JPG


6.3 PDR session execution

6.3.1 Standard execution

To launch pre-recorded PDR sessions, the working mode indicated is the path to the pdr.cmd file displayed at the corresponding point, the argument of said "-r" file, the file that contains the session directives (-script), the directory where to store the screenshots (-folder) ending in "\", which is optional, where to save the screenshots in the folder where the pdr is located. You may also enter the number of consecutive retries in case of failure, optional parameter.

In the next run, the screen capture is also customized to collect only the active window:

pandora_ux_x64 -exe C:\PDR\pdr -args -r -script C:\pandora_ux\calculadora.sikuli -folder C:\pandora_ux\ -ss_config active -retries 3

The following modules will be returned:

  • UX_Time_project_name.
  • UX_Status_project_name.
  • UX_Control_Snapshot_project_name (only on the first run).

If there is an error at any stage, the following module will also be created:

  • UX_Snapshot_project_name.

And it will show an image of the active window (with -ss_config active) from when the failure took place.

Example of successful execution:

<module>
   <name><![CDATA[UX_Status_calculator.sikuli]]></name>
   <type>generic_proc</type>
   <data><![CDATA[1]]></data>
   <description><![CDATA[C:\pandora_ux\calculator.sikuli execution completed Control snapshot rebuild ]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
</module>
<module>
   <name><![CDATA[UX_Time_calculator.sikuli]]></name>
   <type>generic_data</type>
   <data><![CDATA[20.204]]></data>
   <description><![CDATA[C:\pandora_ux\calculator.sikuli execution completed Control snapshot rebuilt ]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
   <module_parent>UX_Status_calculator.sikuli</module_parent>
</module>
<module>
   <name><![CDATA[UX_Control_Snapshot_calculator.sikuli]]></name>
   <type>async_string</type>
   <data><![CDATA[data:image/png;base64, IBCAIAAAAOCnfhAAAAAXNSR…/4x79e/7757f8H2C00s1C73yMAAAAASUVORK5CYII=]]></data>
   <description><![CDATA[Control image rebuilt]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
   <module_parent>UX_Status_calculator.sikuli</module_parent>
</module>

Example of output with failed execution:

<module>
   <name><![CDATA[UX_Status_std.html]]></name>
   <type>generic_proc</type>
   <data><![CDATA[0]]></data>
    <description><![CDATA[Failed to execute verifyText]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
</module>
<module>
   <name><![CDATA[UX_Time_std.html]]></name>
   <type>generic_data</type>
   <data><![CDATA[15.463]]></data>
    <description><![CDATA[Failed to execute verifyText]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
   <module_parent>UX_Status_std.html</module_parent>
</module>
<module>
   <name><![CDATA[UX_Snapshot_std.html]]></name>
   <type>async_string</type>
   <data><![CDATA[data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAA…JRU5ErkJggg==]]></data>
    <description><![CDATA[Image (last error)]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
   <module_parent>UX_Status_std.html</module_parent>
</module>

If everything turned out to be a success, you may add the execution line to the Pandora FMS agent installed on the Windows machine as an agent plugin. The line to add to the agent configuration file will look like this (in a single line):

module_plugin C:\Users\artica\Documents\Product\UX-Trans\ux\pandora_ux_x64.exe -exe C:\PDR\pdr.bat -args -r -script C:\PDR\calc.sikuli -folder C:\PDR\ -ss_config active -checkpoint -post "taskkill /F /IM calc.exe"

As you can see, this run has a few more options. The -checkpoint parameter is used to show a screenshot of the result, even if there is no failure. -post will execute actions after the session playback is finished. In this case, the calculator process that started the recording is closed, to prevent the system from failing due to too many open windows or similar processes.

Now that the agent has the execution line module_plugin ready, it is launched in process mode, executing the following from the command line as administrator:

"C:\Program Files\pandora_agent\PandoraAgent.exe" --process

Obviously, the full path to the executable "PandoraAgent.exe" must be the one corresponding to the installation.

When launching it, the actions will be executed automatically according to the recording. From that point onwards the agent process should not be closed, and you should not log in the machine through remote desktop, or the executions could be interrupted. The machine must be left unhandled, that is why its use is recommended in virtual machines.

Imagen nueva pdr.png

Info.png

If you already have automation tests, they can be included in Pandora FMS with the following execution.

 


pandora_ux.64 -exe <exe of the automation system> -args <system arguments> -script <test file path>

6.3.2 Transaction-based execution

If you have recorded different processes with PDR and you have checked they work by playing them continuously, run:

C:\Users\artica\Documents\Producto\UX-Trans\ux\pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -t calculadora_trans -script C:\PDR\calc.sikuli,C:\PDR\savecalc.sikuli,C:\PDR\savefile.sikuli -folder C:\PDR\ -ss_config active

As it can be seen, just indicate the path of the new script in the -script parameter separated by a comma from the previous script and use the -t parameter with the name of the transaction that will include the different phases . If the process had more phases, the same logic would be followed, for example:

pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -t proceso_transaccional -script C:\PDR\script1,C:\PDR\script2,C:\PDR\script3,C:\PDR\script4 -folder C:\PDR\ -ss_config active

The line to add to the agent configuration file, in this case, is the following:

module_plugin C:\Users\artica\Documents\Producto\UX-Trans\ux\pandora_ux_x64.exe -exe C:\PDR\pdr.cmd -args -r -t calculadora_trans -script C:\PDR\calc.sikuli,C:\PDR\savecalc.sikuli,C:\PDR\savefile.sikuli -folder C:\PDR\ -ss_config active -checkpoint -post "taskkill /F /IM calc.exe"

Thanks to the -checkpoint parameter, you may see screenshots of the result of each phase in the Pandora FMS console.

The following modules will be returned by stage:

  • UX_Time_project_name.phase_order
  • UX_Status_project_name.phase_order

If there is any phase with an error, the following module will also be created:

  • UX_Snapshot_project_name.phase_order

It will also display an image of the web at the time of the failure, should it take place.

The global summary modules identified with the following names will also be returned:

  • UX_Global_Time_project_name
  • UX_Global_Status_project_name
  • UX_Global_Snapshot_project_name


When the agent is running in process mode and the modules are recovered by Pandora FMS you will see them in the console. Again, through the view in "hierarchical mode" you can clearly show the relationship between the modules shown, clearly defining the different phases:


Ux41.JPG


And in the transaction viewer, you can see the detail of the phases and the graph with the times:


Ux42.JPG


The error traps will only be shown when the UX client (PWR) and the PWR server are running on the same machine. Otherwise, the directory for image delivery by the PWR server must be accessible by the client in order to display the image in Pandora FMS.

It will be on these modules where you may create alerts and see the history to build graphs and show the evolution of your systems over time.

It is recommended to create a scheduled task that starts the Pandora FMS agent in process mode when the computer starts. This will not interrupt executions even if the system is forcefully restarted and if it is in automatic login mode without password, the agent will always be run even if the machine is restarted.


Ux26.JPG


Ux27.JPG


Ux28.JPG


Ux29.JPG


Ux30.JPG


Ux31.JPG


Ux32.JPG


That way you will ensure the Pandora FMS agent will always be running in process mode in this Windows system, even when the machine is restarted, being able to always send the information collected by the PDR probe.

Systems with multiple desktops can be troublesome, so it is always recommended to use the configuration described above, on a desktop-mode machine with auto-login and a single desktop.


Go back to Pandora FMS Documentation Index