diff --git a/monitoring/pom.xml b/monitoring/pom.xml
index 59fdd5f1df..5c045df996 100644
--- a/monitoring/pom.xml
+++ b/monitoring/pom.xml
@@ -24,15 +24,24 @@
3.4.2-SNAPSHOT
thingsboard
+
monitoring
3.4.2-SNAPSHOT
- Monitoring service
+ ThingsBoard Monitoring Service
jar
UTF-8
${basedir}/..
- monitoring-service
+ java
+ false
+ process-resources
+ package
+ tb-monitoring
+ false
+ ${project.build.directory}/windows
+ ThingsBoard Monitoring Service
+ org.thingsboard.monitoring.ThingsboardMonitoringApplication
@@ -47,7 +56,7 @@
org.thingsboard
rest-client
- provided
+ compile
org.springframework.boot
@@ -87,6 +96,21 @@
Java-WebSocket
compile
+
+ org.seleniumhq.selenium
+ selenium-java
+ 4.6.0
+
+
+ com.google.guava
+ guava
+ 31.1-jre
+
+
+ io.github.bonigarcia
+ webdrivermanager
+ 5.3.1
+
org.apache.commons
commons-lang3
@@ -119,14 +143,42 @@
org.apache.maven.plugins
- maven-compiler-plugin
+ maven-resources-plugin
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
org.springframework.boot
spring-boot-maven-plugin
-
+
+ org.thingsboard
+ gradle-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ org.apache.maven.plugins
+ maven-install-plugin
+
-
+
+
+ jenkins
+ Jenkins Repository
+ https://repo.jenkins-ci.org/releases
+
+ false
+
+
+
diff --git a/monitoring/src/main/java/org/thingsboard/aba/LatencyMsg.java b/monitoring/src/main/java/org/thingsboard/aba/LatencyMsg.java
deleted file mode 100644
index 8c49ee8b27..0000000000
--- a/monitoring/src/main/java/org/thingsboard/aba/LatencyMsg.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright © 2016-2022 The Thingsboard Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.thingsboard.aba;
-
-import lombok.Data;
-
-@Data
-public class LatencyMsg {
-
- private long restClientLoginLatency;
- private long deviceCredLatency;
- private long getDeviceLatency;
-
- private long wsSubInitLatency;
-
- private long mqttConnectLatency;
- private long mqttSendLatency;
- private long mqttTotalLatency;
-
- private long httpSendLatency;
- private long httpTotalLatency;
-
- private long mqttErrors;
- private long mqttReconnects;
-
-
- public boolean hasLongLatency(long threshold) {
- return restClientLoginLatency > threshold
- || deviceCredLatency > threshold
- || getDeviceLatency > threshold
- || wsSubInitLatency > threshold
- || mqttConnectLatency > threshold
- || mqttSendLatency > threshold
- || mqttTotalLatency > threshold
- || httpSendLatency > threshold
- || httpTotalLatency > threshold;
- }
-}
diff --git a/monitoring/src/main/java/org/thingsboard/aba/SaasApi.java b/monitoring/src/main/java/org/thingsboard/aba/SaasApi.java
deleted file mode 100644
index 17d196a5aa..0000000000
--- a/monitoring/src/main/java/org/thingsboard/aba/SaasApi.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/**
- * Copyright © 2016-2022 The Thingsboard Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.thingsboard.aba;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.http.ssl.SSLContextBuilder;
-import org.apache.http.ssl.SSLContexts;
-import org.apache.http.ssl.TrustStrategy;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpRequest;
-import org.springframework.http.client.support.HttpRequestWrapper;
-import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.client.RestTemplate;
-import org.thingsboard.rest.client.RestClient;
-import org.thingsboard.server.common.data.Device;
-import org.thingsboard.server.common.data.EntityType;
-import org.thingsboard.server.common.data.id.DeviceId;
-import org.thingsboard.server.common.data.security.DeviceCredentials;
-
-import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicLong;
-
-@Component
-@Slf4j
-public class SaasApi {
-
- private static final long wsResponseWaitSec = 300;
-
-
- @Value("${saas.host}")
- private String host;
-
- private AtomicLong counter = new AtomicLong();
- private SampleMqttClient mqttClient;
- private AtomicLong mqttErrors = new AtomicLong();
- private AtomicLong mqttReconnects = new AtomicLong();
-
- public void checkMqtt(Device device, DeviceCredentials deviceCredentials, RestClient restClient, LatencyMsg latency) {
- try {
- WsClient wsClient = subscribeToWebSocket(device.getId(), "tsSubCmds", restClient, latency);
-
- long msgTs = System.currentTimeMillis();
- long submittedValue = counter.incrementAndGet();
- sendMqtt(deviceCredentials, submittedValue, msgTs, latency);
-
- WsTelemetryResponse actualLatestTelemetry = wsClient.getLastMessage(wsResponseWaitSec);
- if(actualLatestTelemetry == null) {
- latency.setMqttTotalLatency(-1*wsResponseWaitSec);
- } else {
- validateWsResponse(actualLatestTelemetry, msgTs, submittedValue);
- long responseReadyTs = System.currentTimeMillis();
- latency.setMqttTotalLatency(responseReadyTs - msgTs);
-
- }
- wsClient.closeBlocking();
- latency.setMqttErrors(mqttErrors.getAndSet(0L));
- latency.setMqttReconnects(mqttReconnects.getAndSet(0L));
- } catch (Exception ex) {
- throw new IllegalStateException("Could not check mqtt: " + ex.getMessage(), ex);
- }
- }
-
- public void checkHttp(Device device, DeviceCredentials deviceCredentials, RestClient restClient, LatencyMsg latency) {
- try {
- WsClient wsClient = subscribeToWebSocket(device.getId(), "tsSubCmds", restClient, latency);
- long msgTs = System.currentTimeMillis();
- long submittedValue = counter.incrementAndGet();
- sendHttp(restClient, deviceCredentials, submittedValue, msgTs, latency);
- WsTelemetryResponse actualLatestTelemetry = wsClient.getLastMessage(wsResponseWaitSec);
- if(actualLatestTelemetry == null) {
- latency.setHttpTotalLatency(-1*wsResponseWaitSec);
- } else {
- validateWsResponse(actualLatestTelemetry, msgTs, submittedValue);
- long responseReadyTs = System.currentTimeMillis();
- latency.setHttpTotalLatency(responseReadyTs - msgTs);
- }
- wsClient.closeBlocking();
- } catch (Exception ex) {
- throw new IllegalStateException("Could not check http: " + ex.getMessage(), ex);
- }
- }
-
-
- private void validateWsResponse(WsTelemetryResponse response, long expectedTs, long expectedVal) {
- try {
- List