Device monitoring
You can use Prometheus together with Grafana to monitor devices in OpenText Functional Testing Lab, and identify issues as soon as they arise. Metrics currently available for monitoring are device connection status, thermal state, Android battery health, free disk space, device WiFi connection status and signal strength, and device temperature.
Install Prometheus
The following steps explain how to install and configure Prometheus on Windows to work with OpenText Functional Testing Lab. For full details about installing, configuring, and using Prometheus refer to the Prometheus documentation.
- Download Prometheus for Windows from the Prometheus website.
- 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 build. 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 the integration between the lab and Prometheus
Metrics can be collected centrally at the server level, or for a specific connector.
OpenText Functional Testing Lab:
We recommend monitoring devices at the server level. To manage the metrics of all connected connectors centrally at the server level, in Administration settings > General, enable the integration with Prometheus.
OpenText Core Software Delivery Platform OpenText Functional Testing Lab:
You can collect metrics for an on-premises connector.
To collect metrics from a connector:
-
Enable Prometheus on the connector.
-
Set the environment variable.
OS Details 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 for editing (Default /opt/FunctionalTestingLabForMobileAndWeb/server/conf/setenv_common.sh) and add the following line:
export METRICS_PROMETHEUS_ENABLE=true
-
Restart the connector.
OS Details Windows Use the shortcut in the OpenText Functional Testing Lab folder on the desktop.
Linux service DL restart
On the OpenText Functional Testing Lab connector, open the metrics-config.properties file for editing. Set the value for METRICS_PROMETHEUS_ENABLE to true and save.
OS | Default location |
---|---|
Windows | C:\Program Files\Functional Testing Lab for Mobile and Web Server Connector\connector\conf\metrics-config.properties |
Linux | /opt/FunctionalTestingLabForMobileAndWeb/connector/conf/metrics-config.properties |
Configure Prometheus
- On the Prometheus server, open the prometheus.yml file for editing.
- Add a job to collect metrics.
License Details OpenText Functional Testing Lab We recommend managing metrics centrally at the server level.
To collect server metrics, add the following job which includes metrics from all remote connectors:
- job_name: 'FunctionalTestingLabForMobileAndWeb _metrics_central_management'
scrape_interval: 5s
metrics_path: /rest/prometheus
scheme: <http/https>
static_configs:
- targets: ['<FunctionalTestingLabForMobileAndWeb_server_address>:<FunctionalTestingLabForMobileAndWeb_server_port>']OpenText Functional Testing Lab To collect metrics for a connector, add the following job to the scrape_configs section:
- job_name: 'FunctionalTestingLabForMobileAndWeb_remote_connector_metrics''
scrape_interval: 5s
metrics_path: /hp4m-connector/rest/prometheus
scheme: <http/https>
static_configs:
- targets: ['<FunctionalTestingLabForMobileAndWeb_remote_connector_address>:<FunctionalTestingLabForMobileAndWeb_remote_connector_port>'] - SSL connection only. When using a secure connection to OpenText Functional Testing Lab with a self-signed certificate, the certificate needs to be imported to your Windows machine so that Prometheus trusts it:
- Export the OpenText Functional Testing Lab certificate.
Using Chrome for example, go to the Lab console. Click the Not secure or the lock icon in the address bar and select to view the certificate. Go to the Details tab and select Copy to file (use the defaults). On the Prometheus machine, select to install the certificate file for the Local Machine and in the Trusted Root Certification Authorities.
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.
- Export the OpenText Functional Testing Lab certificate.
- Verify the Prometheus integration.
- Open the Prometheus web interface. The default port is 9090.
- Select Status > Targets and make sure that the OpenText Functional Testing Lab targets have been added and the State is Up.
Select Graph > scrape_samples_scraped metric and execute. Make sure that the targets expose samples, and that the value for the element of the OpenText Functional Testing Lab job is higher than 0.
Prometheus metrics
The following table describes the OpenText Functional Testing Lab metrics that are monitored by Prometheus:
Name | Metric | Values |
---|---|---|
Device connection |
mc_console_tenant_< >_device_< >_connectedGauge |
Available for OpenText Functional Testing Lab only, when monitoring metrics at the server level. Device connection status from the server. This metric indicates if a device is on and is connected to the OpenText Functional Testing Lab server. 1 =
Connected; 0 = Disconnected. |
Device connection | mc_connector_device_< >_connectedGauge |
Device connection status from connector. This metric indicates if a device is on and is recognized by the connector. 1 = Connected; 0 = Disconnected. When a value of 0 is returned, no data is available for other device metrics. |
Device battery health |
mc_connector_device_< >_batteryHealthGauge gauge |
Android only. 1 = Unknown; 2 = Good; 3 = Overheat; 4 = Dead; 5 = Over Voltage; 6 = Unspecified Failure; 7 = Cold. |
Device free disk space |
mc_connector_device_< >_freeDiskSpaceGauge |
Measured in GB. |
Device WiFi connection |
mc_connector_device_< >_wifiConnectedGauge |
1 = Connected; 0 = Disconnected. |
Device WiFi strength |
mc_connector_device_< >_wifiSignalStrengthGauge gauge |
Integer 1- 5. 5 represents the strongest signal. |
Device thermal state |
mc_connector_device_< >_thermalStateGauge |
iOS: 1= Nominal ; 2 = Fair ; 3 = Serious; 4 = Critical. Android: 0 = None; 1 = Light; 2 = Moderate; 3 = Severe; 4 = Critical, 5 = Emergency; 6 = Shutdown. |
Device temperatures |
mc_connector_device_< >_temperatureGauge |
Measured in Celsius. |
Configure Grafana and connect to the lab
The following steps explain how to install and configure Grafana to work with OpenText Functional Testing Lab. For full details about installing, configuring, and using Grafana refer to the Grafana documentation.
- Download and install Grafana for Windows from the Grafana website.
-
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 > 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.
Example: [smtp]
enabled = true
host = smtp.swinfra.net:25
from_address = grafana@opentext.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 preferred. Enter the email address/es and click Save.
- Import the preconfigured dashboard.
- Download the Grafana dashboard.
- To import the file into Grafana, select Create > Import > Upload .json file. Upload the lab 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 OpenText Functional Testing Lab metrics from Grafana.