目次

WUX サーバ と Selenium 3 を使用したWUX 監視

Pandora FMS ドキュメント一覧に戻る

概要

The user experience monitoring consists of recording automated tasks for both web navigation (PWR/WUX) and interaction with the Windows system desktop and applications (PDR).

ユーザエクスペリエンス監視 は、Web ナビゲーション (PWR/WUX) と Windows システムのデスクトップとアプリケーション (PDR) とのやり取りの両方の自動タスクの記録する仕組みから成ります。

These recordings can range from a mouse click on a web browser, typing text, or performing a web search, to opening an application on the desktop. This allows the configuration of functions and automatic recording for later execution to seek results.

これらの記録は、Webブラウザでのマウスクリック、テキスト入力、Web検索の実行、デスクトップでのアプリケーションの起動など、多岐にわたります。これにより、機能の設定や自動記録が可能になり、後で実行して結果を求めることができます。

UX および WUX 監視の違い

Both monitoring systems are used for executing automated web navigation tasks through the Pandora Web Robot Daemon (PWRD).

両方の監視の仕組みは、Pandora Web Robot Daemon (PWRD) を通してウェブブラウジングタスクを実行するために利用されます。

The UX system performs these monitorings via the EndPoint installed on a machine, while the WUX (Web User Experience) monitoring relies on a server integrated within Pandora FMS.

UX システムは マシンにインストールされたエンドポイント を介してこれらの監視を実行しますが、WUX (Web User Experience) 監視は Pandora FMS 内に統合されたサーバに依存します。

PWRD is a service that provides the necessary tools to automate web browsing sessions. It uses a file that contains a list of required actions to navigate the web portal being monitored.

PWRD は、Web 閲覧セッションを自動化するために必要なツールを提供するサービスです。監視対象の Web ポータルをナビゲートするために必要なアクションのリストを含むファイルを使用します。

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

加えて、UX 監視は、Windows デスクトップおよびシステムアプリケーションの自動化タスクを実行することができます。このタイプのタスクは、WUX では実行できません。

Pandora FMS UX is a system that runs automated tasks, providing the Pandora FMS Server with a report on the execution results, time spent, and screenshots of any errors found.

Pandora FMS UX は、自動タスクを実行し、実行結果、所要時間、見つかったエラーのスクリーンショットに関するレポートを Pandora FMS サーバに提供するシステムです。

If a task automation system is available, Pandora FMS UX also allows the execution of pre-written scripts and monitors their execution.

タスク自動化システムが利用可能な場合、Pandora FMS UX では事前に作成されたスクリプトの実行も可能であり、その実行を監視することもできます。

PWR UX 監視

Considering the differences between UX and WUX monitoring, in general, UX monitoring must follow a series of prerequisites related to the environment being monitored, with the following prior steps:

UX 監視と WUX 監視の違い を考慮して、一般に、UX 監視では、監視対象の環境に関連する一連の前提条件を満たす必要があり、以下の事前手順を実行する必要があります。

For the standard execution of pre-recorded sessions, the Pandora UX Plugin is used in its latest version 28-04-2022.

事前に保存されたセッションの標準的な実行には、Pandora UX プラグインの最新バージョン 28-04-2022 を使用します。

Selenium 3 による Web User Experience (WUX)

For deploying Selenium on WUX servers, a container stack will be used for rapid deployment and easy scaling.

WUX サーバでの Selenium デプロイでは、コンテナベースのスタックを使用して、迅速なデプロイと容易なスケーリングを実現します。

事前設定

Docker® and Docker Compose® must be installed; Rocky Linux® 9 is recommended as the base operating system.

Docker® と Docker Compose® がインストールされている必要があります。ベースオペレーティングシステムとしては Rocky Linux® 9 を推奨します

To install Docker, follow the documentation according to the operating system being used:

Docker をインストールするには、使用しているオペレーティングシステムに応じたドキュメントに従ってください。

For Selenium®, use the official images for the installation and deployment of the stack:

Selenium® の場合、スタックのインストールとデプロイメントには公式イメージを使用します。

In the Selenium® repository, different images with browsers are available. For Pandora FMS, Mozilla Firefox® and Google Chrome® containers are recommended.

Selenium® リポジトリには、ブラウザに対応した様々なイメージが用意されています。Pandora FMS の場合は、Mozilla Firefox® および Google Chrome® コンテナを推奨します。

Selenium スタックのデプロイ

To deploy the Selenium stack, a dedicated directory must be created for the task. Inside it, create a compose.yaml file with the necessary configuration:

Seleniumスタックをデプロイするには、タスク専用のディレクトリを作成する必要があります。その中に、必要な設定を記述した compose.yaml ファイルを作成します。

# To execute this docker-compose yml file use `docker-compose -f  up`
# Add the `-d` flag at the end for detached execution
# version: "3"
services:
  selenium-hub:
    image: pandorafms/pandorafms-selenium-hub
    mem_limit: 2G
    container_name: selenium-hub-v3
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "4m"
            mode: "non-blocking"
    environment:
      - TZ=Europe/Amsterdam
    ports:
      - "4444:4444"

  chrome:
    image: pandorafms/pandorafms-selenium-node-chrome
    mem_limit: 2G
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "4m"
            mode: "non-blocking"
    environment:
      - TZ=Europe/Amsterdam
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444

  firefox:
    image: pandorafms/pandorafms-selenium-node-firefox
    mem_limit: 2G
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "4m"
            mode: "non-blocking"
    environment:
      - TZ=Europe/Amsterdam
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444

In the previous example, you must make the necessary modifications for each case, such as memory limit, time zone, number of nodes, etc.

前の例では、メモリ制限、タイムゾーン、ノード数など、各ケースに応じて必要な変更を行う必要があります。

To start and run the container with the defined configuration, inside the directory created for the task:

タスク用に作成されたディレクトリ内で、定義された構成でコンテナを起動して実行するには、次の手順を実行します。

docker compose up -d

To check the services running in the container:

コンテナ内で実行中のサービスを確認するには:

docker compose ps

To view the status and logs of the Selenium services:

Selenium サービスのステータスと ログ を表示するには:

docker compose logs

Once the necessary checks are done, to verify that the grid is working correctly and the workers have been registered as defined in the configuration file, it will be necessary to access the following URL:

必要なチェックが完了したら、グリッド が正しく動作していること、および ワーカー が設定ファイルで定義されたとおりに登録されていることを確認するために、次の URL にアクセスする必要があります。

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

If you need to increase the number of workers (X, Y):

ワーカーの数(XY)を増やす必要がある場合:

docker compose scale chrome=X firefox=Y

Selenium サービスインフラストラクチャ

Selenium operates as a HUB where a container is launched acting as a grid to deploy the necessary worker containers.

Selenium は、必要な ワーカー コンテナをデプロイするための グリッド として機能するコンテナが起動される HUB として動作します。

Pandora FMS 設定

To use the centralized mode (WUX), the following configuration must be applied to the Pandora FMS server.

集中モード (WUX) を使用するには、Pandora FMS サーバに次の設定を適用する必要があります。

Regardless of the chosen mode, once started, you can begin assigning navigation session executions by adding the WUX Server configuration parameters to the Pandora FMS server's configuration file.

選択したモードに関係なく、起動したら、WUX サーバ設定パラメータを Pandora FMS サーバの設定ファイルに追加することで、ナビゲーションセッション実行の割り当てを開始できます。

Add the following configuration at the end of the /etc/pandora/pandora_server.conf file
(replace <ip_wux_host> with the server's IP address; if it's the same server running the Pandora FMS Server, use 127.0.0.1):

/etc/pandora/pandora_server.conf ファイルの最後に次の設定を追加します (<ip_wux_host> をサーバーの IP アドレスに置き換えます。Pandora FMS サーバを実行しているサーバと同じ場合は 127.0.0.1 を使用します)。

wuxserver 1
wux_host <ip_wux_host>
wux_port 4444

The server's configuration file includes a new token to clean any sessions that may be queued every time the Pandora FMS server is started.

サーバの設定ファイルには、Pandora FMS サーバが起動されるたびにキューに入れられる可能性のあるセッションをすべて消去するための新しい トークン が含まれています。

clean_wux_sessions 1 #(default)

Pandora FMS スレッド管理

  1. The management of the wuxserver threads is done automatically when the pandora_server service starts.
  2. This is done based on the number of the lower browser nodes in the Selenium hub:
  1. wuxserver スレッドの管理は、pandora_server サービスの起動時に自動的に行われます。
  2. これは、Selenium hub 内の下位ブラウザノードの数に基づいて行われます:

Always keep in mind that each thread indicates the sessions that can be sent simultaneously from the wuxserver to the Selenium hub.

各スレッドは、wuxserver から Selenium hub に同時に送信できるセッションを示すことを常に念頭に置いてください。

付録: Internet Explorer および Microsoft Edge のワーカー追加

If it is necessary to launch web transactions against Microsoft® browsers, you need to configure a machine (physical or virtual) with the desired version of MS Windows® and set up the driver following the official documentation.

Microsoft® ブラウザに対して Web トランザクションを開始する必要がある場合は、必要なバージョンの MS Windows® でマシン (物理または仮想) を構成し、公式ドキュメントに従ってドライバーを設定する必要があります。

Documentation for installing the MS Internet Explorer® driver:

Internet Explorer® ドライバインストールドキュメント:

https://www.selenium.dev/documentation/ie_driver_server/

It is recommended to use the 32-bit version of driver 3.141 to avoid performance issues with the 64-bit version.

64 ビットバージョンのパフォーマンスの問題を回避するには、ドライバー 3.141 の 32 ビットバージョンを使用することをお勧めします。

Documentation for installing the Microsoft Edge® driver:

Microsoft Edge® ドライバーインストールドキュメント:

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

For running Selenium, Java® must be installed on the MS Windows® device.

Selenium を実行するには、MS Windows® デバイス に Java® がインストールされている必要があります。

To check if Java® is installed, run:

Java® がインストールされているかどうかを確認するには、次のコマンドを実行します。

java -version

The output should be similar to the following:

次のような出力が得られます。

The JAR file for Selenium is also required to run the server locally and register it on the grid. It can be obtained at:

サーバをローカルで実行し、グリッド に登録するには、Selenium の JAR ファイルも必要です。これは以下の場所から入手できます。

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

To start the Microsoft Edge® server, execute, in a terminal in the directory where the downloaded JAR file is located (all of this in one line, broken down for simplification):

Microsoft Edge® サーバを起動するには、ダウンロードした JAR ファイルが配置されているディレクトリのターミナルで、次のコマンドを実行します ( すべてを 1 行にまとめ、簡略化のために分割しています )。

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"

To start the Internet Explorer® server, the command is similar, specifying the path <PATH> to the downloaded driver (all of this in one line, broken down for simplification):

Internet Explorer® サーバを起動する場合も、コマンドは同様で、ダウンロードした driver へのパス <PATH> を指定します (簡略化のために、すべてを 1 行に分割しています):

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"

The MS Windows® firewall must be configured to allow traffic on the port numbers specified in the execution command (in this documentation, 5555 and 4444 were used).

実行コマンドで指定されたポート番号 (このドキュメントでは、55554444 が使用されています) のトラフィックを許可するように MS Windows® ファイアウォールを構成する必要があります。

記録

For version 3 of Selenium, both old and new recordings will be supported, although with partial compatibility with older versions.

Selenium バージョン 3 では、古いバージョンとの互換性は 部分的 ですが、古い記録と新しい記録の両方がサポートされます。

To record a new session, the Selenium IDE extension must be installed in the browser of choice.

新しいセッションを記録するには、目的のブラウザに Selenium IDE 拡張機能をインストールする必要があります。

Firefox

https://addons.mozilla.org/es/firefox/addon/selenium-ide/

Chrome

https://chrome.google.com/webstore/detail/selenium-ide/mooikfkahbdckldjjndioackbalphokd

The icon will be used to start the recording environment once the extension is installed.

拡張機能がインストールされると、アイコン を使用して記録環境を起動できるようになります。

Clicking it will open a menu that allows starting new recording projects.

これをクリックすると、新しい記録プロジェクトを開始できるメニューが開きます。

Once the recording is complete, you will get a result similar to this:

記録が行われると、次のような結果になります。

Aside from the functionality provided by Selenium, Pandora FMS includes custom commands to extract information from the target being monitored.

Selenium によって提供される機能の他に、Pandora FMS には監視対象から情報を抽出するための カスタムコマンド が含まれています。

コマンド

The list of compatible commands for use in Pandora FMS can be found in the following link.

Pandora FMS で使用できる互換性のあるコマンドの一覧は、こちら にあります。

録画を行う際の推奨事項

Here are a few recommendations and tips for recording transactions with Selenium IDE and integrating the more complex commands with Pandora FMS:

ここでは、Selenium IDE を使用してトランザクションを記録し、より複雑なコマンドを Pandora FMS と統合するための推奨事項とヒントをいくつか紹介します。

Additionally, using xpath paths, you can search for text inside the tags of the page, making recordings more dynamic. In the screenshot above, you could use an xpath to search for the text “Innovadores de la monitorización” within all span tags on the page, not just a specific locator.

さらに、xpath を使用すると、ページのタグ内のテキストを検索して、より動的なレコーディングができます。上記のキャプチャでは、特定のロケータではなく、ページのすべてのスパンタグで “Monitoring Innovators” というテキストを検索する xpath を使用できることがわかりました。

This is an example of a variable stored with store text and then used in execute script, so that Pandora FMS’s server correctly interprets it. This use of the variable in quotes will fail when running the script in the Selenium IDE recorder:

これは、Pandora FMS サーバが正しく解釈できるように、変数を store text で保存し、execute script で使用する例です。この引用符で囲んだ変数の使用は、Selenium IDE レコーダーで スクリプト を実行する際にエラーとなります。

データ管理と視覚化

Pandora FMS コンソールでウェブ解析モジュールを作成する

Once you have a recorded browsing session, it’s time to deploy it as a Module in the Pandora FMS Web Console.

ブラウジングセッションの記録が完了したら、それを Pandora FMS Web コンソールにモジュールとして展開します。

To do this, go to any agent associated with a server that has WUX functionality enabled and click on the Create Module button:

これを行うには、WUX 機能が有効になっているサーバに関連付けられている任意のエージェント に移動し、モジュールの作成(Create Module) ボタンをクリックします。

By clicking the Create button, you will need to fill out the fields presented in the form (only those related to this topic are shown):

作成(Create) ボタンをクリックすると、フォームに表示されるフィールドに入力する必要があります (このトピックに関連するフィールドのみが表示されます)。

カスタムマクロ

The functioning of custom macros involves replacing certain text strings in the browsing session file with customizable values.

カスタムマクロの機能では、ブラウジングセッションファイル内の特定のテキスト文字列をカスタマイズ可能な値に置き換えることができます。

For web analysis modules, this functionality has been improved to allow dynamic macros, which enable these values to be translated into variable dates and times.

Web 分析モジュールでは、この機能が改善され、動的マクロ が可能になり、これらの値を 可変の日付と時刻 に変換できるようになりました。

Why this functionality?

なぜこのような機能があるのか?

Suppose you need to monitor, via a browsing session, the correct functioning of a web-based room reservation application.

ブラウザセッションを通じて、ウェブベースの会議室予約アプリケーションが正しく機能しているかを監視する必要があるとします。

If you set a fixed date and time when filling out the form, the system may cancel the reservation because at some point it will be in the past.

フォームに記入する際に固定の日時を設定すると、いつの間にか過去の日時になってしまうため、システムによって予約がキャンセルされる可能性があります。

It is also possible that there is a maximum time limit for making that reservation, and that the system forces you to reserve the room within a specific time frame.

予約に最大時間制限があり、特定の時間枠内に部屋を予約するようにシステムによって強制される 可能性もあります。

To avoid having to edit the macro every few days, and to not worry about the configuration part, you can use dynamic macros, telling the system to always reserve the meeting room for the day after the web test.

数日ごとにマクロを編集する必要をなくし、構成部分を気にせずに済むように、動的マクロを使用して、Web テストの翌日に会議室を常に予約するようにシステムに指示することができます。

To use this functionality, the values must follow a specific format, allowing the following possible replacements:

この機能を使用するには、値が特定の形式に従う必要があり、次の置換が可能になります。

Where “n” can be an unsigned (positive) or negative number, and FORMAT follows the standard of Perl's strftime:

ここで、“n” は符号なし(正)または負の数で、FORMAT は Perl の strftime の標準に従います。

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

データの視覚化

The information generated by WUX will be displayed in the form of modules, and enabling the view in hierarchical mode in the list of modules will help to display the information much more clearly:

WUX によって生成された情報はモジュールの形式で表示され、モジュールのリストで階層モードで表示を有効にすると、情報がより明確に表示されます。

Within this hierarchy are:

この階層には次のものがあります:

  1. If there is a recording, it gives the status of the WUX recording.
  2. If Run performance Test is enabled but recording is not included, the status of the Global Status module is that of the check performed when these modules are obtained.
  1. 記録がある場合は、WUX 記録のステータスが表示されます。
  2. パフォーマンステストの実行(Run performance Test) が有効になっているが、記録が含まれていない場合、グローバルステータスモジュールのステータスは、これらのモジュールの取得時に実行されたチェックのステータスになります。

By accessing the agent's WUX Console, you can view additional details about the transaction and its phases:

エージェントの WUX コンソール(WUX Console) にアクセスすると、トランザクションとそのフェーズに関する追加の詳細を表示できます。

Website statistics are summarized in the following concepts:

ウェブサイトの統計は、次の概念にまとめられます。

ウェブ解析モジュールにアラートを割り当てる

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

Web 分析モジュールに関連付けられたアラートは、Pandora FMS の アラートシステム 全体と同じ動作ダイナミクスに従います。

For compatibility, it is recommended to assign alert templates to subelements autogenerated by the web analytics module:

互換性を確保するために、Web 分析モジュールによって自動生成されたサブ要素にアラートテンプレートを割り当てることをお勧めします。

ダッシュボードのウィジェット

In order to display user navigation information, two types of widgets have been added to the Dashboards: Agent WUX transaction and WUX transaction stats:

ユーザナビゲーション情報を表示するために、ダッシュボードに 2 種類のウィジェットを追加しています: エージェント WUX トランザクション(Agent WUX transaction)WUX トランザクション統計(WUX transaction stats):

サポートされているコマンド一覧

内部コマンド

追加コマンド

モジュールを生成するコマンド

getValue;module_name;module_type;capture_REGEX

getVariable;module_name;module_type;variable_name

getScreenshot;module_name

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

独自のコマンドはすべて、コメントとしてテストファイル(.side)に記述する必要があります。 そうしないと、Selenium 拡張機能でのテストに失敗します。

レコーディング拡張機能によって提供されるコマンド(v3)

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

Pandora FMS ドキュメント一覧に戻る