Pandora: Documentation en: UX Monitoring

From Pandora FMS Wiki
Jump to: navigation, search

1 Automated UX monitoring

1.1 Introduction

Pandora UX is an automated task-execution system that subsequently reports the results of executions and chronometries to Pandora FMS, and also includes screenshots of possible errors, to provide more intuitive, visually-oriented feedback.

Pandora UX employs two default technologies for automatizing tasks:

  • Pandora Web Robot (PWR): which permits web navigation and replicates user actions. It checks contents, texts, etc. and is ideal for monitoring sites and apps not based on flash. Pros: quicker, can run in the background.
  • Pandora Desktop Robot (PDR): replicates user-interactions with Windows and Linux OSs. Pandora UX launches prepared scripts using this tool, allowing for more advanced and specific monitoring. E.g., plugins can be deployed on hardware and connect to distinct networks to check that what users would see is functioning correctly. Its principal use is to monitor heavy desktop apps.

It also includes Flex-tech application monitoring (adobe), which would be incompatible with Selenium without modifying the app itself.

If your system already has automated task-execution Pandora UX can still be used to execute pre-existing scripts and also to monitor their execution.

1.2 WEB UX (PWR)

1.2.1 PWR deployment

Pandora UX set-up.

1.2.1.1 Selenium server deployment on Windows

Prerequisites:

C:\PWR
C:\probes

Create file distribution:

  • File decompression PWR_Server.zip a C:\PWR\
  • Export Firefox profile to C:\PWR\profile

Using a profile to carry out checks is optional, but recommendable in case of using proxies or password autofill. To create a Firefox profile follow the steps in the following screenshots:

Ux1.JPG
Ux2.JPG

Choose directory address:

Ux3.JPG

Start Firefox with the new profile to customize options such as proxies, popups, etc.:

Ux4.JPG

Install the service by executing BAT file service_installer.bat provided, and initiate:

net start PWRSRV

The Selenium server is now running. It can also be manually executed (after interrupting the service) in order to debug. Use the command:

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

1.2.1.2 Selenium server deployment on Linux

Prerequisites:

To install the dependencies from the repositories:

yum install xorg-x11-server-Xvfb
yum install java
yum install screen

If it's not in the repositories, the rpm file can be found at the following link: ftp://rpmfind.net/linux/centos/6.9/os/x86_64/Packages/xorg-x11-server-Xvfb-1.17.4-16.el6.centos.x86_64.rpm

To install the rpm package manually:

yum install xorg-x11-server-Xvfb-1.17.4-16.el6.centos.x86_64.rpm

The Selenium server can be booted up with the script:

#!/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 /home/selenium/selenium-server-standalone-2.53.0.jar &
fi

Or manually with the following commands:

# screen
$ Xvjb :99 -ac &
-> Press Enter to continue
$ export DISPLAY=:99
$ java -jar seleniumXXX.jar &
-> Press Ctrl + 'A' and then 'D' to disconnect from the virtual screen

1.2.2 Recording a PWR session

Before UX monitoring can take place, you need to record a session. Depending on the type of tech you use, various recording options are available.

To record the navigation with PWR, you need the PWR recorder available at plugin module library:

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

The package contains:


Start PWR_recorder.exe:


PWR recorder.PNG


The recorder will start automatically Firefox with a prebuilt environment:


PWR recorder main.png



After start Selenium IDE, we'll be able to record our web navigation test:

Ux10.JPG

Now you can navigate the website you want to monitor and register the different actions associated with each step on the recording. To stop recording use the following button, located on the upper-right of the screen:

Ux11.JPG

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 section of text in the browser window while recording and select verifyText:

Ux13.JPG

Another step will appear on the recording indicating the text to be checked:

Ux14.JPG

The entire sequence can be reproduced by clicking Play entire test suite and checking that it finishes correctly:

Ux15.JPG

Once the whole browsing sequence has been checked and verified save it (File -> Save Test Case) in order to execute it on Pandora UX. The resulting file is an HTML document that Pandora UX can then interpret.

1.2.2.1 Recording a transaction session with Pandora UX PWR

Pandora UX in PWR mode (Pandora Web Robot) allows browser monitoring to be divided among multiple modules, that represent each of the steps taken.

To insert a new control point and generate the phase modules (to this point) right-click on the point where the phase is to start.

Ux16.JPG

Use the following as the New Comment:

phase_start:name_of_phase

The phase includes the timings and results of all the commands up to the following comment:

phase_end:name_of_phase

All commands executed between a phase_start and a phase_end are included in that phase.

1.2.3 Executing PWR sessions

1.2.3.1 Standard execute

To launch prerecorded PWR sessions call the pandora_ux_x64.exe executable, 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:

pandora_ux_x64.exe -exe PWR -script tests\std.html –folder C:\probes

The following modules are returned:

  • 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

Example of correct 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>

Example of incorrect 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>

Provided everything is OK the execution line can be added to the Pandora agent (already installed on the machine) which is going to carry out the checks. It should look something like this:

module_plugin C:\Users\artica\Documents\Producto\UX-Trans\UX\pandora_ux_x64.exe -exe PWR -script C:\Users\artica\Documents\Producto\UX-Trans\PWR\sesion.html -folder C:\probes

Once the agent is reporting to the Pandora FMS server the corresponding modules will appear. Enable hierarchy mode to see the relation among them:

Ux33.JPG

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

1.2.3.2 Transaction-based execution

If there is a Pandora 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 won't vary with respect to the previous case. Indicate the corresponding html file, which, in this case, contains the different phases. E.g.:

pandora_ux_x64.exe -exe PWR -script tests\std.html –folder C:\probes

The following modules will be returned:

  • UX_Time_project_name.phase_order
  • UX_Status_project_name.phase_order

If any phase returns an error, the following module is created:

  • UX_Snapshot_project_name.phase_order

A screenshot with the moment the error took place will be displayed.

Global status modules are returned with the following labels:

  • UX_Global_Time_project_name
  • UX_Global_Status_project_name
  • UX_Global_Snapshot_project_name

A screenshot showing the moment the error took place will be displayed.

The agent's execution line looks similar to the previous example, but with an html file containing the phases. Something like this:

module_plugin C:\Users\artica\Documents\Producto\UX-Trans\UX\pandora_ux_x64.exe -exe PWR -script C:\Users\artica\Documents\Producto\UX-Trans\PWR\session_phases.html -folder C:\probes

When the data reaches the Pandora FMS server it is displayed as modules. Enable hierarchy mode in the modules list to see the information clearly:

Ux34.JPG

Access the agent's UX section to see extra details on the transaction and its phases:

Ux36.JPG

In the previous screenshot the time difference between the two phases into which the recording was divided can be seen.

The following example represents a browsing process, plus the purchase of various 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 produced:

Ux44.JPG
Ux45.JPG

1.2.3.3 Data retrieval

From version v1.20171003 pandora_UX is able to retrieve data from web content while testing the user experience test.

To use this feature, you must add some directives as comments in the user experience test recorder in Selenium IDE.


PWR recorder getValue.png


In the attached exampled, both values will be retrieved after test the navigation, and will be added to Pandora as modules (both getValue directives).

The stepts to make the plugin retrieve values are following:

  • Add a new comment to our navigation test in the Selenium IDE.
  • Fill the comment with the directive.

Data retrieval directive:

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

What does each field represented by a dot and comma mean?

  • getValue: UX system directive
  • Module name: module name as it will appear in Pandora
  • Module type: datatype to use, any from Pandora datatypes is allowed (generic_proc,generic_data,generic_data_string,async_proc,async_data,async_string...)
  • Perl regular expression: Must be a perl regex, specifing data to be retrieved between parenthesis

For example, in following text:

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

If we want to retrieve the temperature of the solar plate to monitor it, we must specify the regex as:

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

So, the system will retrieve the number "54" from the example, or any number with decimal positions.


Then, the complete directive will appear as:

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

1.3 Desktop UX (PDR)

1.3.1 PDR deployment (Windows only)

The PDR system only works on Windows systems, and once run by the Pandora FMS agent it must run in process mode, as running in service mode will not work. Furthermore, it will not be possible to block the desktop session, so we recommend its use in virtual machines.

Prerequisites:

  • Windows OS in desktop mode, auto startup, and auto login.

To configure, execute:

control userpasswords2

Uncheck "Users must enter a user name and password to use this computer":

Ux5.JPG

To set up the environment create the following directories:

C:\PDR
C:\probes

Decompress the "PDR.zip" file from C:\PDR.

To start the recorder, execute:

C:\PDR\pdr.cmd

1.3.2 Record a PDR session

Requirements:

  • Automation system (decompress pdr.zip in a directory of your choice) installed.
  • Start recording system (pdr.cmd).
Ux17.JPG

After loading, we will enter the recording environment:

Ux18.JPG

Select the actions and the zones where they are to be carried out. Here are some of the most common ones:

General actions:

Ux19.JPG

Flow control actions:

Ux20.JPG

More information about this scripting language: http://sikulix-2014.readthedocs.io/en/latest/index.html

When the project is recorded a file will be created with the following elements:

  • File .py with the script automation code.
  • Web browser control images.

A simple example of an execution would be something like monitoring to check that the Windows calculator works correctly. Let's take a look at how to go about it, one slide at a time.

1. Choose the action "click" and the area where we want to apply the action; the screen will change to "area selection" mode:

Ux21.JPG
Ux22.JPG

2. Enter the type action and the text "calc", wait for the calculator area to appear and click. Afterwards, we will wait for the calculator window to appear to enter the following actions:

Ux23.JPG

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

4. Lastly, save and replay clicking on Run.

Important notes:

  • If we double-click on any of the images within the recording environment, we can adjust details of the control capture, such as selecting the exact point where to click.
  • 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 we need to 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.

Ux24.JPG

Nota: You can customize the capture from the PDR recording engine by 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 we can make the screenshot at the specific time we want. We can customize this screenshot using coordinates, so we will specify the following syntax:

capture(x, y, w, h)

Where:

X: X position of the rectangle we want to capture

Y: Y position of the rectangle we want to capture

W: Width of the capture

H: Heigth of the capture



1.3.2.1 Recording a transaction session with Pandora UX PDR

Recording a specific session is not necessary, just record the sessions you need in different scripts. Pandora UX will return the results and organize them as a complex transaction. In the next point we will see how to make the call of the execution so that it works correctly.

If we are going to make several recordings to create a transactional process we must be careful when recording that the elements we are looking for are present. The manual execution of the recordings that we 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:

Ux40.JPG

Here's another sequence that consists of saving the text file in a specific location, overwriting the previous. 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:

Ux43.JPG

1.3.3 Executing PDR sessions

1.3.3.1 Standard execution

To launch prerecorded PDR sessions, indicate work mode as file route pdr.cmd 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 ‘\’.

In the following execution the screenshot can be customized to capture only the active window:

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

The following modules will be returned:

  • UX_Time_project_name.
  • UX_Status_project_name.
  • UX_Control_Snapshot_project_name (only on first execute).

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

Correct output execution example:

<module>
   <name><![CDATA[UX_Status_calculadora.sikuli]]></name>
   <type>generic_proc</type>
   <data><![CDATA[1]]></data>
   <description><![CDATA[C:\pandora_ux\calculadora.sikuli execution completed Control snapshot rebuild ]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
</module>
<module>
   <name><![CDATA[UX_Time_calculadora.sikuli]]></name>
   <type>generic_data</type>
   <data><![CDATA[20.204]]></data>
   <description><![CDATA[C:\pandora_ux\calculadora.sikuli execution completed Control snapshot rebuilt ]]></description>
   <tags>UX</tags>
   <module_group>UX</module_group>
   <module_parent>UX_Status_calculadora.sikuli</module_parent>
</module>
<module>
   <name><![CDATA[UX_Control_Snapshot_calculadora.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_calculadora.sikuli</module_parent>
</module>

Incorrect iutput 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 is A-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):

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"

As can be seen, the execution has more options. The parameter -checkpoint displays a screenshot of the final result, even if there are no errors to display, -post will execute actions once the session replay has finished, in which case close the calculation process initiated by the recording to avoid a system collapse due to an excess of open windows, or any similar problem.

Now that the agent has the execution line module_plugin ready launch it in process mode, executing the following from the admin command line:

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

Obviously, the complete route to the executable PandoraAgent.exe should correspond to your installation.

When launched you can see how actions are executed automatically 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 for which virtual machines are recommended.

1.3.3.2 Transaction-based execution

Once there are various processes recorded, and verified for correct functioning, with the PDR, execute the following:

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 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 simply apply the same logic, e.g.:

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

Add the following line to the agent configuration file:

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 screenshots of the final result from each phase can be viewed on the Pandora console.

The following modules will be returned, per phase:

  • UX_Time_project_name.phase_order.
  • UX_Status_project_name.phase_order.

If any of the phases returns an error, the following module will be created:

  • UX_Snapshot_project_name.phase_order.

In case of error it will also display a web image with the moment the error was produced.

It also returns global summary modules with the following IDs:

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

Ux41.JPG

Details of the phases and time charts can be viewed in the transaction display:

Ux42.JPG

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.

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.

It is recommendable 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 executes even though the machine is on automatic login mode, without password protection.

Ux26.JPG
Ux27.JPG
Ux28.JPG
Ux29.JPG
Ux30.JPG
Ux31.JPG
Ux32.JPG

This guarantees that on the Windows instance in question the Pandora FMS agent will always be running in process mode even when the machine restarts, being always able to send the data harvested by the PDR probe.

Systems with various desktops can present problems, in which case it's recommendable to always use the configuration previously described, on any machine in desktop mode and autostart and a single desktop.