You can use Prometheus together with Grafana to monitor UFT Mobile lab devices, so that you can identify issues as soon as they arise. Metrics currently available for monitoring are device connection status, device WiFi connection status, and device temperature.
Configure Prometheus and connect to UFT Mobile
The following steps explain how to install and configure Prometheus on Windows to work with UFT Mobile. For full details about installing, configuring, and using Prometheus refer to the online documentation.
- Download Prometheus for Windows.
- Run the prometheus.exe file.
To ensure that Prometheus always starts automatically, run it as a Windows service as follows:
- Download and extract the latest NSSM. NSSM enables regular executables to be created as Windows services.
- Add the service by running the following command:
nssm.exe install Prometheus <path to prometheus.exe>
Note that the service uses the nssm.exe file when started, so make sure not to move or delete the file after adding the service.
Configure UFT Mobile to integrate with Prometheus:
You can manage the metrics of all connected connectors centrally at the server level, by configuring the UFT Mobile server for Prometheus.
- On the UFTM server, open the metrics-config.properties file for editing. Set the value for METRICS_PROMETHEUS_ENABLE to true and save.
- Set the environment variable:
Windows: Add a system variable with the name METRICS_PROMETHEUS_ENABLE and set the value to true.
Linux: Open <path to installation folder>/server/conf/setenv_common.sh (Default /opt/UFTMobile/server/conf/setenv_common.sh) for editing and add the following line:
Restart the server:
Use the shortcut in the UFT Mobile folder on the desktop.
service UFTM restart
|Windows||C:\Program Files\UFT Mobile Server\server\conf\metrics-config.properties|
Alternatively, you can collect metrics only for a specific remote connector. To do so, perform the steps above on the specific UFT Mobile connector machine and not on the server machine.
- On the Prometheus server, open the prometheus.yml file for editing.
- If you are managing metrics centrally at the server level, add the following job which will include metrics from all remote connectors:
- job_name: 'UFTMobile _metrics_central_management'
- targets: ['<UFTM_server_address>:<UFTM_server_port>']
To also collect metrics of the connector embedded in the UFT Mobile server (i.e. for devices connected directly to the UFT Mobile server), in the scrape_configs section add the following job:
- job_name: 'UFTMobile_embedded_connector_metrics'
- targets: ['<UFTM_server_address>:<UFTM_server_port>']
- SSL only. When using a secure connection to UFT Mobile with a self-signed certificate, the certificate needs to be imported to your Windows machine so that Prometheus will trust it:
- In Internet Explorer, navigate to the UFT Mobile Lab console. Click the certificate error in the address bar and click View certificates> Install certificates. In the Certificate Import Wizard, select the Local Machine store location option, and place the certificate in the Trusted Root Certification Authorities store.
Open the Windows Services console and restart the Prometheus service. If the service fails to start, run the prometheus.exe file from the command line to view the error.
- Verify the Prometheus integration.
- Open the Prometheus web interface. The default port is 9090.
- Select Status > Targets and make sure that the UFT Mobile targets have been added and the State is Up.
Select Graph > scrape_samples_scraped and make sure that the targets expose samples, and that the value for the element of the UFTM job is higher than 0.
Alternatively, if you are collecting metrics only for a specific connector, you need only add the following job to the scrape_configs section:
- job_name: 'UFTMobile_remote_connector_metrics''
- targets: ['<UFTM_remote_connector_address>:<UFTM_remote_connector_port>']
Configure Grafana and connect to UFT Mobile
The following steps explain how to install and configure Grafana to work with UFT Mobile. For full details about installing, configuring, and using Grafana refer to the online documentation.
- Download and install Grafana for Windows.
In the Grafana conf folder, copy the sample.ini configuration file and rename the new file custom.ini. By default, the conf file is located in : C:\Program Files\GrafanaLabs\grafana\.
- Add Prometheus as a data source.
- Open the Grafana web interface. The default port is 3000.
- Login with username: admin and password: admin.
- Select Configuration > Preferences > Data Sources > Add data source > Prometheus and provide the url (e.g. http://localhost: 9090 if running Prometheus and Grafana on the same machine).
- Click Save & Test.
Grafana supports different types of notifications. To receive email notifications, add an SMTP (mail) server to the custom.ini file.
enabled = true
host = smtp.swinfra.net:25
from_address = email@example.com
from_name = Grafana
- Add a notification channel to Grafana. If you defined SMTP in the custom.ini file , you can use email for notifications.
- Select Alerting > Notification channels. Click Add channel.
- In the Notification Channel screen provide a Name (e.g. email), select Email for the Type, and set the other options as per your preference. Enter the email address/es and click Save.
- Import the preconfigured UFT Mobile dashboard.
- Download the json file.
- To import the file into Grafana, select Create > Dashboard > New Dashboard > Import dashboard > Upload .json file. Upload the uft_mobile_grafana_dashboard_v1.json file and click Import.
If you configured a notification channel and would like to receive alert notifications, for each of the graphs in the imported dashboard, select Edit > Alert > Notifications > Send to. Select the channel and save the dashboard.
You can now monitor UFT Mobile metrics from Grafana.