From fa535b0ca5610129161d72a0b02ceda339a0ada2 Mon Sep 17 00:00:00 2001 From: Cyrus Kalbrener Date: Wed, 14 Aug 2024 17:40:33 +0100 Subject: [PATCH 1/7] Updating to more secure dependencies, adding JUnit5 test --- pom.xml | 680 +++++++++++++----- .../haproxy/HAProxyMonitorTaskJunit5Test.java | 579 +++++++++++++++ .../haproxy/HAProxyMonitorTaskTest.java | 82 ++- 3 files changed, 1114 insertions(+), 227 deletions(-) create mode 100644 src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskJunit5Test.java diff --git a/pom.xml b/pom.xml index 457645e..0de0315 100644 --- a/pom.xml +++ b/pom.xml @@ -1,199 +1,499 @@ + - - - 4.0.0 - - com.appdynamics.extensions - haproxy-monitoring-extension - 2.2.2 - jar - - haproxy-monitoring-extension - http://maven.apache.org - - - UTF-8 - yyyy-MM-dd HH:mm:ss - ${project.build.directory}/HAProxyMonitor - - + + 4.0.0 + com.appdynamics.extensions + haproxy-monitoring-extension + 2.2.2 + jar + haproxy-monitoring-extension + http://maven.apache.org + + scm:git:https://github.com/Appdynamics/haproxy-monitoring-extension.git + + + UTF-8 + yyyy-MM-dd HH:mm:ss + ${project.build.directory}/HAProxyMonitor + + - - com.appdynamics - machineagent-repackaged - 4.0.5.1 - provided - - - com.appdynamics - appd-exts-commons - 2.2.4 - - - junit - junit - 4.11 - test - - - org.powermock - powermock-module-junit4 - 1.5.6 - test - - - org.powermock - powermock-api-mockito - 1.5.6 - test - - - org.mockito - mockito-all - 1.9.5 - test - + + com.fasterxml.jackson + jackson-core + 2.17.2 + + + com.fasterxml.jackson.core + jackson-databind + 2.17.2 + + + com.sun.istack + istack-commons-runtime + 3.0.8 + + + commons-codec + commons-codec + 1.17.1 + + + commons-logging + commons-logging + 1.2 + + + javax.xml.bind + jaxb-api + 2.3.1 + + + org.apache.httpcomponents + httpclient + 4.5.13 + + + org.eclipse.jetty + jetty-io + 9.4.55.v20240627 + + + org.eclipse.jetty + jetty-security + 12.0.12 + + + org.eclipse.jetty + jetty-servlet + 11.0.22 + + + org.glassfish.jaxb + txw2 + 2.3.2 + + + + org.junit + junit-bom + 5.10.3 + pom + import + + + org.junit.jupiter + junit-jupiter-api + 5.10.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.10.3 + test + + + org.mockito + mockito-inline + 5.2.0 + test + + + org.objenesis + objenesis + 3.4 + - - ${project.artifactId} - - - src/main/resources - - - - - src/test/resources - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-shade-plugin - 2.2 - - false - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - package - - shade - - - - - - - - HAProxy Monitor v${project.version} Build Date ${maven.build.timestamp} - - - com.appdynamics.extensions.workbench.WorkbenchServerLauncher - - - - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.6 - - - install - install - - - - - - - - - - - - - - - - - - - - - - - - - - - - - run - - - - - - org.codehaus.mojo - versions-maven-plugin - 2.1 - - - maven-scm-plugin - 1.8.1 - - ${project.artifactId}-${project.version} - - - - - - - github-maven-repo - - true - - - false - - https://github.com/Appdynamics/maven-repo/raw/master/releases - - - - scm:git:https://github.com/Appdynamics/haproxy-monitoring-extension.git - + + + + com.appdynamics + appd-exts-commons + 2.2.13-SNAPSHOT + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.google.code.gson + gson + + + com.google.errorprone + error_prone_annotations + + + com.google.guava + guava + + + com.google.j2objc + j2objc-annotations + + + com.sun.istack + istack-commons-runtime + + + commons-codec + commons-codec + + + commons-httpclient + commons-httpclient + + + commons-io + commons-io + + + commons-io + commons-io + + + javax.activation + activation + + + javax.xml.bind + jaxb-api + + + net.objecthunter + exp4j + + + org.apache.commons + commons-lang3 + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpmime + + + org.checkerframework + checker-qual + + + org.eclipse.jetty + jetty-io + + + org.eclipse.jetty + jetty-servlet + + + org.glassfish.jaxb + jaxb-core + + + org.glassfish.jaxb + jaxb-runtime + + + org.glassfish.jaxb + txw2 + + + org.nanohttpd + nanohttpd + + + org.slf4j + slf4j-api + + + org.unix4j + unix4j-base + + + org.unix4j + unix4j-command + + + org.yaml + snakeyaml + + + rg.glassfish.jaxb + jaxb-core + + + + + + commons-codec + commons-codec + + + com.fasterxml.jackson.core + jackson-core + 2.17.2 + + + com.fasterxml.jackson.core + jackson-databind + + + org.eclipse.jetty + jetty-io + + + org.eclipse.jetty + jetty-security + + + org.eclipse.jetty + jetty-servlet + + + com.appdynamics + machineagent-repackaged + 4.0.5.1 + provided + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.mockito + mockito-inline + test + + + org.mockito + mockito-junit-jupiter + 5.12.0 + test + + + + + + true + + + true + + github-maven-repo + https://github.com/Appdynamics/maven-repo/raw/master/releases + + + + ${project.artifactId} + + + src/main/resources + + + + + src/test/resources + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 11 + 11 + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + false + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + com.appdynamics:appd-exts-commons + + javax/servlet/** + jetty-dir.css + META-INF/FastDoubleParser-LICENSE + META-INF/FastDoubleParser-NOTICE + META-INF/versions/9/module-info* + META-INF/versions/*/com/fasterxml/jackson/core/io/doubleparser/* + META-INF/maven/org.eclipse.jetty/** + META-INF/maven/com.fasterxml.jackson*/** + META-INF/maven/javax.servlet/** + META-INF/maven/commons-codec/** + META-INF/maven/org.slf4j/** + com/fasterxml/jackson/annotation/** + com/fasterxml/jackson/core/** + com/fasterxml/jackson/databind/** + org/apache/commons/codec/** + org/eclipse/jetty/** + org/slf4j/** + + + + + + com.fasterxml.jackson.core:jackson-databind:2.14.1.redhat-00001 + + + + + + + shade + + package + + + + + + HAProxy Monitor v${project.version} Build Date ${maven.build.timestamp} + com.appdynamics.extensions.workbench.WorkbenchServerLauncher + true + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 3.1.0 + + + install + + run + + install + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.codehaus.mojo + versions-maven-plugin + 2.17.1 + + + maven-scm-plugin + 2.1.0 + + ${project.artifactId}-${project.version} + + + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + + prepare-agent + + + + report + + report + + prepare-package + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.3.1 + + + org.junit.jupiter + junit-jupiter-engine + 5.10.3 + + + + + + + + + org.jacoco + jacoco-maven-plugin + + + + + report + + + + + + diff --git a/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskJunit5Test.java b/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskJunit5Test.java new file mode 100644 index 0000000..a7369d1 --- /dev/null +++ b/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskJunit5Test.java @@ -0,0 +1,579 @@ +/* + * + * Copyright 2018. AppDynamics LLC and its affiliates. + * All Rights Reserved. + * This is unpublished proprietary source code of AppDynamics LLC and its affiliates. + * The copyright notice above does not evidence any actual or intended publication of such source code. + * + */ + +package com.appdynamics.extensions.haproxy; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import com.appdynamics.extensions.MetricWriteHelper; +import com.appdynamics.extensions.TasksExecutionServiceProvider; +import com.appdynamics.extensions.conf.MonitorContext; +import com.appdynamics.extensions.conf.MonitorContextConfiguration; +import com.appdynamics.extensions.haproxy.config.MetricConfig; +import com.appdynamics.extensions.haproxy.config.MetricConverter; +import com.appdynamics.extensions.haproxy.config.ProxyStats; +import com.appdynamics.extensions.haproxy.config.Stat; +import com.appdynamics.extensions.http.HttpClientUtils; +import com.appdynamics.extensions.metrics.Metric; +import org.apache.http.impl.client.CloseableHttpClient; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.MockedStatic; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * + */ +@ExtendWith(MockitoExtension.class) +public class HAProxyMonitorTaskJunit5Test { + + @Mock + private TasksExecutionServiceProvider serviceProvider; + + @Mock + private MetricWriteHelper metricWriter; + + @Mock + private MonitorContextConfiguration contextConfiguration; + + @Mock + private MonitorContext context; + + @Mock + private ProxyStats proxyStats; + + @Mock + private CloseableHttpClient httpClient; + + @Mock + private Stat stat; + + @Captor + private ArgumentCaptor> pathCaptor; + + private HAProxyMonitorTask haProxyMonitorTask; + + private Map expectedValueMap; + private AutoCloseable closeable; + + @BeforeEach + @SuppressWarnings("unchecked") + public void before() { + closeable = MockitoAnnotations.openMocks(this); + pathCaptor = ArgumentCaptor.forClass(List.class); + + when(contextConfiguration.getContext()).thenReturn(context); + + when(contextConfiguration.getMetricPrefix()).thenReturn("Custom Metrics|HAProxy"); + + when(context.getHttpClient()).thenReturn(httpClient); + + when(serviceProvider.getMetricWriteHelper()).thenReturn(metricWriter); + + when(contextConfiguration.getMetricsXml()).thenReturn(proxyStats); + Mockito.doReturn(Map.of("encryptionKey", "")).when(contextConfiguration).getConfigYml(); + + String[] attr = {"qcur", "qmax", "scur", "smax", "slim", "stot", "bin", "bout", "dreq", "dresp", "ereq", "econ", "eresp", "wretr", "wredis", "status", "weight", "act", "bck", "chkfail", "chkdown", "lastchg", "downtime", "qlimit", "lbtot", "tracked", "type", "rate", "rate_lim", "rate_max", "check_status", "check_code", "check_duration", "hrsp_1xx", "hrsp_2xx", "hrsp_3xx", "hrsp_4xx", "hrsp_5xx", "hrsp_other", "hanafail", "req_rate", "req_rate_max", "req_tot", "cli_abrt", "srv_abrt", "comp_in", "comp_out", "comp_byp", "comp_rsp", "lastsess", "qtime", "ctime", "rtime", "ttime"}; + String[] alias = {"queued_requests", "max_queued_requests", "current sessions", "max sessions", "session limit", "total sessions", "bytes in", "bytes out", "denied requests", "denied responses", "error requests", "connection errors", "response errors", "connection retries", "request redispatches", "status", "server weight", "active servers", "backup servers", "checks failed", "number of transitions", "last transition", "total downtime", "maxqueue", "lbtot", "tracked", "type", "rate", "rate_limit", "rate_max", "check_status", "check_code", "check_duration", "hrsp_1xx", "hrsp_2xx", "hrsp_3xx", "hrsp_4xx", "hrsp_5xx", "hrsp_other", "failed health check", "req_rate", "req_rate_max", "req_tot", "client aborts", "server abortes", "comp_in", "comp_out", "comp_byp", "comp_rsp", "lastsess", "qtime", "ctime", "rtime", "ttime"}; + int[] column = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59}; + String[] status = {"UP", "OPEN"}; + String[] check_status = {"UNK", "INI", "SOCKERR", "L4OK", "L4TOUT", "L4CON", "L6OK", "L6TOUT", "L6RSP", "L7OK", "L7OKC", "L7TOUT", "L7RSP", "L7STS"}; + int numOfMetricConfigs = attr.length; + MetricConfig[] metricConfigs = new MetricConfig[numOfMetricConfigs]; + for (int i = 0; i < numOfMetricConfigs; i++) { + metricConfigs[i] = new MetricConfig(); + metricConfigs[i].setAttr(attr[i]); + metricConfigs[i].setAlias(alias[i]); + metricConfigs[i].setColumn(column[i]); + if (metricConfigs[i].getAttr().equals("status")) { + MetricConverter[] converters = new MetricConverter[status.length]; + for (int index = 0; index < converters.length; index++) { + converters[index] = new MetricConverter(); + converters[index].setLabel(status[index]); + converters[index].setValue("1"); + } + metricConfigs[i].setConvert(converters); + } + if (metricConfigs[i].getAttr().equals("check_status")) { + MetricConverter[] converters = new MetricConverter[check_status.length]; + for (int index = 0; index < converters.length; index++) { + converters[index] = new MetricConverter(); + converters[index].setLabel(check_status[index]); + converters[index].setValue(String.valueOf(index)); + } + metricConfigs[i].setConvert(converters); + } + } + + when(proxyStats.getStat()).thenReturn(stat); + when(stat.getMetricConfig()).thenReturn(metricConfigs); + + Map server = new HashMap<>(); + server.put("displayName", "Local HA-Proxy"); + server.put("host", "demo.haproxy.org"); + server.put("port", 80); + server.put("csvExportUri", ";csv"); + List> proxyServers = new LinkedList<>(); + Map map1 = new HashMap<>(); + map1.put("pxname", "http.*"); + String[] svname = {"FRONTEND", ".*-direct", "IPv4-.*", "local.*"}; + map1.put("svname", Arrays.asList(svname)); + proxyServers.add(map1); + Map map2 = new HashMap<>(); + map2.put("pxname", "www"); + String[] svname1 = {"b.*", "ww.*"}; + map2.put("svname", Arrays.asList(svname1)); + proxyServers.add(map2); + + Map map3 = new HashMap<>(); + map3.put("pxname", "demo"); + String[] svname2 = {"b.*", "ww.*"}; + map3.put("svname", Arrays.asList(svname2)); + proxyServers.add(map3); + + Map map4 = new HashMap<>(); + map4.put("pxname", "git"); + String[] svname3 = {"b.*", "ww.*"}; + map4.put("svname", Arrays.asList(svname3)); + proxyServers.add(map4); + + server.put("proxyServers", proxyServers); + + haProxyMonitorTask = new HAProxyMonitorTask(contextConfiguration, serviceProvider.getMetricWriteHelper(), server); + + } + @AfterEach + public void after() throws Exception { + closeable.close(); + } + + //read from the csv file which is the response of the httpClient + private String readFromCSV() throws IOException { + return Files.readString(Paths.get("src/test/resources/demo.csv")); + } + + @Test + public void testHAProxyResponseRunTest() throws IOException { + expectedValueMap = getExpectedResultMap(); + try(MockedStatic hcu = Mockito.mockStatic(HttpClientUtils.class)){ + hcu.when(() -> HttpClientUtils.getResponseAsStr(any(CloseableHttpClient.class), anyString())).thenReturn(readFromCSV()); + haProxyMonitorTask.run(); + } + validateMetrics(); + assertTrue( expectedValueMap.isEmpty(), "The expected values were not sent. The missing values are " + expectedValueMap); + } + + @SuppressWarnings("unchecked") + private void validateMetrics() { + verify(metricWriter).transformAndPrintMetrics(pathCaptor.capture()); + for (Metric metric : pathCaptor.getValue()) { + String actualValue = metric.getMetricValue(); + String metricName = metric.getMetricPath(); + if (expectedValueMap.containsKey(metricName)) { + String expectedValue = expectedValueMap.get(metricName); + assertEquals(expectedValue, actualValue, "The value of the metric " + metricName + " failed"); + expectedValueMap.remove(metricName); + } else { + System.out.println("\"" + metricName + "\",\"" + actualValue + "\""); + fail("Unknown Metric " + metricName); + } + } + } + + private Map getExpectedResultMap() { + Map map = new HashMap<>(); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|current sessions", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|max sessions", "42"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|session limit", "100"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|total sessions", "1519275"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|bytes in", "333499537"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|bytes out", "6338133277"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|denied requests", "738400"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|error requests", "16134"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|type", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|rate", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|rate_limit", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|rate_max", "50"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_1xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_2xx", "697370"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_3xx", "72283"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_4xx", "41188"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_5xx", "75"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_other", "738521"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|req_rate", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|req_rate_max", "50"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|req_tot", "1539497"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|comp_in", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|comp_out", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|comp_byp", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|comp_rsp", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|current sessions", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|max sessions", "33"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|session limit", "100"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|total sessions", "808403"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|bytes in", "135050797"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|bytes out", "1188864381"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|denied requests", "729660"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|error requests", "10"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|type", "3"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|max sessions", "15"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|session limit", "100"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|total sessions", "652397"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|bytes in", "185024074"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|bytes out", "4716795289"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|denied requests", "1574"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|error requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|type", "3"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|max sessions", "41"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|session limit", "100"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|total sessions", "45355"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|bytes in", "11023081"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|bytes out", "312920138"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|denied requests", "228"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|error requests", "16124"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|type", "3"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|max sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|session limit", "100"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|total sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|bytes in", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|bytes out", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|denied requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|error requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|type", "3"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|max sessions", "5"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|session limit", "100"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|total sessions", "21397"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|bytes in", "2401585"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|bytes out", "119553469"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|denied requests", "6938"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|error requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|type", "3"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|max_queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|max sessions", "20"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|session limit", "20"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|total sessions", "456944"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|bytes in", "170279920"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|bytes out", "5814720367"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|connection errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|response errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|connection retries", "9"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|request redispatches", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|server weight", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|active servers", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|backup servers", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|checks failed", "3"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|number of transitions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|last transition", "3952709"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|total downtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|lbtot", "456950"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|type", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|rate", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|rate_max", "44"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|check_status", "9"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|check_code", "200"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|check_duration", "6"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_1xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_2xx", "416068"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_3xx", "16352"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_4xx", "24441"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_5xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_other", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|client aborts", "26733"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|server abortes", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|lastsess", "5"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|qtime", "OK"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|rtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|ttime", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|max_queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|max sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|session limit", "10"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|total sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|bytes in", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|bytes out", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|connection errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|response errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|connection retries", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|request redispatches", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|server weight", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|active servers", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|backup servers", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|checks failed", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|number of transitions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|last transition", "3952709"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|total downtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|lbtot", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|type", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|rate", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|rate_max", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|check_status", "9"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|check_code", "200"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|check_duration", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_1xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_2xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_3xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_4xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_5xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_other", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|client aborts", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|server abortes", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|lastsess", "-1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|qtime", "OK"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|rtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|ttime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|max_queued_requests", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|max sessions", "24"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|session limit", "100"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|total sessions", "457291"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|bytes in", "170297227"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|bytes out", "5814781091"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|denied requests", "323"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|connection errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|response errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|connection retries", "9"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|request redispatches", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|server weight", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|active servers", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|backup servers", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|number of transitions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|last transition", "3952709"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|total downtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|lbtot", "456950"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|type", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|rate", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|rate_max", "44"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_1xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_2xx", "416068"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_3xx", "16352"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_4xx", "24770"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_5xx", "75"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_other", "26"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|req_tot", "457291"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|client aborts", "26743"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|server abortes", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|comp_in", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|comp_out", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|comp_byp", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|comp_rsp", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|lastsess", "5"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|rtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|ttime", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|max_queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|max sessions", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|session limit", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|total sessions", "653"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|bytes in", "304655"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|bytes out", "20066675"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|connection errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|response errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|connection retries", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|request redispatches", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|server weight", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|active servers", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|backup servers", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|checks failed", "3"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|number of transitions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|last transition", "3952709"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|total downtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|lbtot", "650"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|type", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|rate", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|rate_max", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|check_status", "9"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|check_code", "200"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|check_duration", "4"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_1xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_2xx", "633"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_3xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_4xx", "20"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_5xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_other", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|client aborts", "33"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|server abortes", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|lastsess", "2902"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|qtime", "OK"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|rtime", "4"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|ttime", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|max_queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|max sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|session limit", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|total sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|bytes in", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|bytes out", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|connection errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|response errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|connection retries", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|request redispatches", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|server weight", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|active servers", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|backup servers", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|checks failed", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|number of transitions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|last transition", "3952709"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|total downtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|lbtot", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|type", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|rate", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|rate_max", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|check_status", "9"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|check_code", "200"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|check_duration", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_1xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_2xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_3xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_4xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_5xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_other", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|client aborts", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|server abortes", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|lastsess", "-1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|qtime", "OK"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|rtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|ttime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|max_queued_requests", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|current sessions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|max sessions", "3"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|session limit", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|total sessions", "653"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|bytes in", "306399"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|bytes out", "20066675"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|denied requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|connection errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|response errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|connection retries", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|request redispatches", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|server weight", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|active servers", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|backup servers", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|number of transitions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|last transition", "3952709"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|total downtime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|lbtot", "650"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|type", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|rate", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|rate_max", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_1xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_2xx", "633"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_3xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_4xx", "20"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_5xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_other", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|req_tot", "653"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|client aborts", "33"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|server abortes", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|comp_in", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|comp_out", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|comp_byp", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|comp_rsp", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|lastsess", "2902"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|rtime", "4"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|ttime", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|max_queued_requests", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|current sessions", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|max sessions", "6"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|session limit", "20"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|total sessions", "19333"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|bytes in", "6287622"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|bytes out", "454680661"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|denied requests", "40"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|denied responses", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|connection errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|response errors", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|connection retries", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|request redispatches", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|status", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|server weight", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|active servers", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|backup servers", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|number of transitions", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|last transition", "3952709"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|lbtot", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|type", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|rate", "1"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|rate_max", "5"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_1xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_2xx", "18574"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_3xx", "38"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_4xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_5xx", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_other", "720"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|req_tot", "19332"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|client aborts", "72"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|server abortes", "196"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|comp_in", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|comp_out", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|comp_byp", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|comp_rsp", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|lastsess", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|rtime", "2"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|ttime", "0"); + map.put("Custom Metrics|HAProxy|Local HA-Proxy|HeartBeat", "1"); + return map; + } +} \ No newline at end of file diff --git a/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskTest.java b/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskTest.java index 3a68485..c879f29 100644 --- a/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskTest.java +++ b/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskTest.java @@ -9,47 +9,55 @@ package com.appdynamics.extensions.haproxy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.verify; import com.appdynamics.extensions.MetricWriteHelper; import com.appdynamics.extensions.TasksExecutionServiceProvider; import com.appdynamics.extensions.conf.MonitorContext; import com.appdynamics.extensions.conf.MonitorContextConfiguration; -import com.appdynamics.extensions.haproxy.config.*; -import com.appdynamics.extensions.http.HttpClientUtils; +import com.appdynamics.extensions.haproxy.config.MetricConfig; +import com.appdynamics.extensions.haproxy.config.MetricConverter; +import com.appdynamics.extensions.haproxy.config.ProxyServerConfig; +import com.appdynamics.extensions.haproxy.config.ProxyStats; +import com.appdynamics.extensions.haproxy.config.ServerConfig; +import com.appdynamics.extensions.haproxy.config.Stat; import com.appdynamics.extensions.logging.ExtensionsLoggerFactory; import com.appdynamics.extensions.metrics.Metric; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.entity.InputStreamEntity; import org.apache.http.impl.client.CloseableHttpClient; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import org.slf4j.Logger; -import java.io.*; -import java.util.*; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.verify; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; /** * */ -@RunWith(PowerMockRunner.class) -@PrepareForTest(HttpClientUtils.class) -@PowerMockIgnore("javax.net.ssl.*") +//@RunWith(PowerMockRunner.class) +//@PrepareForTest({HttpClientUtils.class, CloseableHttpClient.class}) +//@PowerMockIgnore({"javax.net.ssl.*", "jdk.internal.reflect.*"}) +@Disabled("This test was written for JUnit 4, and it uses PowerMockito. It has been rewritten for JUnit 5.") public class HAProxyMonitorTaskTest { public static final Logger logger = ExtensionsLoggerFactory.getLogger(HAProxyMonitorTaskTest.class); @@ -91,7 +99,7 @@ public class HAProxyMonitorTaskTest { private ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); - @Before + @BeforeEach public void before() throws IOException { Mockito.when(contextConfiguration.getContext()).thenReturn(context); @@ -188,15 +196,15 @@ public void before() throws IOException { haProxyMonitorTask = Mockito.spy(new HAProxyMonitorTask(contextConfiguration, serviceProvider.getMetricWriteHelper(), server)); - PowerMockito.mockStatic(HttpClientUtils.class); - PowerMockito.mockStatic(CloseableHttpClient.class); - - PowerMockito.when(HttpClientUtils.getResponseAsStr(any(CloseableHttpClient.class), anyString())).thenAnswer( - new Answer() { - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - return readFromCSV(); - } - }); +// PowerMockito.mockStatic(HttpClientUtils.class); +// PowerMockito.mockStatic(CloseableHttpClient.class); +// +// PowerMockito.when(HttpClientUtils.getResponseAsStr(any(CloseableHttpClient.class), anyString())).thenAnswer( +// new Answer() { +// public Object answer(InvocationOnMock invocationOnMock) throws Throwable { +// return readFromCSV(); +// } +// }); } //read from the csv file which is the response of the httpClient @@ -216,11 +224,11 @@ private String readFromCSV() throws IOException { return responseString; } - @Before + @BeforeEach public void setUp() throws Exception { } - @After + @AfterEach public void tearDown() throws Exception { } @@ -229,7 +237,7 @@ public void testHAProxyResponseRunTest() throws IOException { expectedValueMap = getExpectedResultMap(); haProxyMonitorTask.run(); validateMetrics(); - Assert.assertTrue("The expected values were not sent. The missing values are " + expectedValueMap, expectedValueMap.isEmpty()); + assertTrue(expectedValueMap.isEmpty(), "The expected values were not sent. The missing values are " + expectedValueMap); } private void validateMetrics() { @@ -239,11 +247,11 @@ private void validateMetrics() { String metricName = metric.getMetricPath(); if (expectedValueMap.containsKey(metricName)) { String expectedValue = expectedValueMap.get(metricName); - Assert.assertEquals("The value of the metric " + metricName + " failed", expectedValue, actualValue); + assertEquals(expectedValue, actualValue, "The value of the metric " + metricName + " failed"); expectedValueMap.remove(metricName); } else { System.out.println("\"" + metricName + "\",\"" + actualValue + "\""); - Assert.fail("Unknown Metric " + metricName); + fail("Unknown Metric " + metricName); } } } From aaf8fc55a535080894e73a769eaa18455b8997bf Mon Sep 17 00:00:00 2001 From: Cyrus Kalbrener Date: Fri, 16 Aug 2024 09:43:16 +0100 Subject: [PATCH 2/7] Trimmed out some overrides, but kept the exclusions to make the build cleaner and more deterministic. --- pom.xml | 120 ++++++++++++++++---------------------------------------- 1 file changed, 34 insertions(+), 86 deletions(-) diff --git a/pom.xml b/pom.xml index 0de0315..ef6306b 100644 --- a/pom.xml +++ b/pom.xml @@ -24,85 +24,37 @@ - com.fasterxml.jackson - jackson-core - 2.17.2 - - - com.fasterxml.jackson.core - jackson-databind - 2.17.2 - - - com.sun.istack - istack-commons-runtime - 3.0.8 - - - commons-codec - commons-codec - 1.17.1 - - - commons-logging - commons-logging - 1.2 - - - javax.xml.bind - jaxb-api - 2.3.1 - - - org.apache.httpcomponents - httpclient - 4.5.13 - - - org.eclipse.jetty - jetty-io - 9.4.55.v20240627 - - - org.eclipse.jetty - jetty-security - 12.0.12 - - - org.eclipse.jetty - jetty-servlet - 11.0.22 - - - org.glassfish.jaxb - txw2 - 2.3.2 + com.appdynamics + machineagent-repackaged + 4.0.5.1 org.junit junit-bom - 5.10.3 pom - import + test + 5.11.0 org.junit.jupiter junit-jupiter-api 5.10.3 - test org.junit.jupiter junit-jupiter-engine 5.10.3 - test org.mockito mockito-inline 5.2.0 - test + + + org.mockito + mockito-junit-jupiter + 5.12.0 org.objenesis @@ -240,43 +192,23 @@ - - commons-codec - commons-codec - - - com.fasterxml.jackson.core - jackson-core - 2.17.2 - - - com.fasterxml.jackson.core - jackson-databind - - - org.eclipse.jetty - jetty-io - - - org.eclipse.jetty - jetty-security - - - org.eclipse.jetty - jetty-servlet - com.appdynamics machineagent-repackaged - 4.0.5.1 provided + + + org.junit + junit-bom + pom + import + org.junit.jupiter junit-jupiter-api test - org.junit.jupiter junit-jupiter-engine @@ -290,9 +222,12 @@ org.mockito mockito-junit-jupiter - 5.12.0 test + + org.objenesis + objenesis + @@ -355,13 +290,26 @@ META-INF/versions/*/com/fasterxml/jackson/core/io/doubleparser/* META-INF/maven/org.eclipse.jetty/** META-INF/maven/com.fasterxml.jackson*/** + META-INF/maven/com.sun.istack/** + META-INF/maven/jakarta.activation/jakarta.activation-api/** + META-INF/maven/javax.activation/javax.activation-api/** META-INF/maven/javax.servlet/** + META-INF/maven/javax.xml.bind/jaxb-api/** META-INF/maven/commons-codec/** + META-INF/maven/commons-logging/** + META-INF/maven/org.glassfish.jaxb/txw2/** + META-INF/maven/org.apache.httpcomponents/httpclient/** META-INF/maven/org.slf4j/** com/fasterxml/jackson/annotation/** com/fasterxml/jackson/core/** com/fasterxml/jackson/databind/** + com/sun/istack/** + com/sun/xml/txw2/** + javax/activation/** + javax/xml/bind/* org/apache/commons/codec/** + org/apache/commons/logging/** + org/apache/http/** org/eclipse/jetty/** org/slf4j/** From 82cf878ee253927037db208a2e9c8847a0bc77a3 Mon Sep 17 00:00:00 2001 From: Cyrus Kalbrener Date: Wed, 28 Aug 2024 14:33:06 +0100 Subject: [PATCH 3/7] trying to keep the conflicts down between the ext shaded jar and the shading happening in this build. --- pom.xml | 225 ++++++++++++++++++++++---------------------------------- 1 file changed, 88 insertions(+), 137 deletions(-) diff --git a/pom.xml b/pom.xml index ef6306b..ebfb2ed 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 com.appdynamics.extensions haproxy-monitoring-extension - 2.2.2 + 2.2.3 jar haproxy-monitoring-extension http://maven.apache.org @@ -28,6 +28,36 @@ machineagent-repackaged 4.0.5.1 + + org.eclipse.jetty + jetty-security + 12.0.12 + + + org.eclipse.jetty + jetty-server + 12.0.12 + + + org.eclipse.jetty + jetty-servlet + 11.0.22 + + + org.eclipse.jetty + jetty-io + 9.4.55.v20240627 + + + org.eclipse.jetty + jetty-util + 9.4.55.v20240627 + + + org.eclipse.jetty + jetty-util-ajax + 9.4.55.v20240627 + org.junit @@ -67,129 +97,7 @@ com.appdynamics appd-exts-commons - 2.2.13-SNAPSHOT - - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-core - - - com.fasterxml.jackson.core - jackson-databind - - - com.google.code.gson - gson - - - com.google.errorprone - error_prone_annotations - - - com.google.guava - guava - - - com.google.j2objc - j2objc-annotations - - - com.sun.istack - istack-commons-runtime - - - commons-codec - commons-codec - - - commons-httpclient - commons-httpclient - - - commons-io - commons-io - - - commons-io - commons-io - - - javax.activation - activation - - - javax.xml.bind - jaxb-api - - - net.objecthunter - exp4j - - - org.apache.commons - commons-lang3 - - - org.apache.httpcomponents - httpclient - - - org.apache.httpcomponents - httpmime - - - org.checkerframework - checker-qual - - - org.eclipse.jetty - jetty-io - - - org.eclipse.jetty - jetty-servlet - - - org.glassfish.jaxb - jaxb-core - - - org.glassfish.jaxb - jaxb-runtime - - - org.glassfish.jaxb - txw2 - - - org.nanohttpd - nanohttpd - - - org.slf4j - slf4j-api - - - org.unix4j - unix4j-base - - - org.unix4j - unix4j-command - - - org.yaml - snakeyaml - - - rg.glassfish.jaxb - jaxb-core - - + 2.2.13 @@ -202,7 +110,7 @@ org.junit junit-bom pom - import + test org.junit.jupiter @@ -235,7 +143,7 @@ true - true + false github-maven-repo https://github.com/Appdynamics/maven-repo/raw/master/releases @@ -283,35 +191,74 @@ com.appdynamics:appd-exts-commons javax/servlet/** - jetty-dir.css - META-INF/FastDoubleParser-LICENSE - META-INF/FastDoubleParser-NOTICE - META-INF/versions/9/module-info* - META-INF/versions/*/com/fasterxml/jackson/core/io/doubleparser/* - META-INF/maven/org.eclipse.jetty/** + META-INF/FastDoubleParser-LICENSE + META-INF/FastDoubleParser-NOTICE + META-INF/mailcap.default META-INF/maven/com.fasterxml.jackson*/** + META-INF/maven/com.google.code.gson/** + META-INF/maven/com.google.errorprone/** + META-INF/maven/com.google.gson/** + META-INF/maven/com.google.guava/** + META-INF/maven/com.google.j2objc/** META-INF/maven/com.sun.istack/** + META-INF/maven/com.sun.xml.fastinfoset/FastInfoset/** + META-INF/maven/commons-codec/** + META-INF/maven/commons-io/commons-io/** + META-INF/maven/commons-logging/** META-INF/maven/jakarta.activation/jakarta.activation-api/** + META-INF/maven/jakarta.xml.bind/jakarta.xml.bind-api/** META-INF/maven/javax.activation/javax.activation-api/** META-INF/maven/javax.servlet/** META-INF/maven/javax.xml.bind/jaxb-api/** - META-INF/maven/commons-codec/** - META-INF/maven/commons-logging/** - META-INF/maven/org.glassfish.jaxb/txw2/** + META-INF/maven/net.objecthunter/exp4j/** + META-INF/maven/org.apache.commons/commons-lang3/** META-INF/maven/org.apache.httpcomponents/httpclient/** + META-INF/maven/org.apache.httpcomponents/httpcore/** + META-INF/maven/org.apache.httpcomponents/httpmime/** + META-INF/maven/org.eclipse.jetty/** + META-INF/maven/org.eclipse.jetty/** + META-INF/maven/org.glassfish.jaxb/jaxb-core/** + META-INF/maven/org.glassfish.jaxb/jaxb-runtime/** + META-INF/maven/org.glassfish.jaxb/txw2/** + META-INF/maven/org.jvnet.staxex/stax-ex/** META-INF/maven/org.slf4j/** + META-INF/maven/org.unix4j/** + META-INF/mimetypes.default + META-INF/proguard/** + META-INF/versions/*/com/fasterxml/jackson/core/io/doubleparser/* + META-INF/versions/9/module-info* + codegen/** com/fasterxml/jackson/annotation/** com/fasterxml/jackson/core/** com/fasterxml/jackson/databind/** + com/google/thirdparty/publicsuffix/** + com/google/common/** + com/google/errorprone/** + com/google/gson/** + com/google/j2objc/** + com/sun/activation/registries/** + com/sun/activation/viewers/** com/sun/istack/** + com/sun/xml/bind/** + com/sun/xml/fastinfoset/** com/sun/xml/txw2/** + command-definition/** javax/activation/** - javax/xml/bind/* + javax/xml/bind/** + jetty-dir.css + net/objecthunter/exp4j/** org/apache/commons/codec/** + org/apache/commons/io/** + org/apache/commons/lang3/** org/apache/commons/logging/** org/apache/http/** + org/checkerframework/** org/eclipse/jetty/** + org/jvnet/fastinfoset/** + org/jvnet/staxex/** org/slf4j/** + org/unix4j/** + org/yaml/** @@ -328,13 +275,17 @@ package + true + + + HAProxy Monitor v${project.version} Build Date ${maven.build.timestamp} com.appdynamics.extensions.workbench.WorkbenchServerLauncher - true + false From 93bbec678f83f8c91231bbcab09a19e592c90365 Mon Sep 17 00:00:00 2001 From: Cyrus Kalbrener Date: Thu, 29 Aug 2024 09:52:34 +0100 Subject: [PATCH 4/7] Updating to appd-ext-commons 2.2.13 --- pom.xml | 578 ++++++----------- .../haproxy/HAProxyMonitorTaskJunit5Test.java | 579 ------------------ 2 files changed, 190 insertions(+), 967 deletions(-) delete mode 100644 src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskJunit5Test.java diff --git a/pom.xml b/pom.xml index ebfb2ed..9ba1dfe 100644 --- a/pom.xml +++ b/pom.xml @@ -5,394 +5,196 @@ ~ * This is unpublished proprietary source code of AppDynamics LLC and its affiliates. ~ * The copyright notice above does not evidence any actual or intended publication of such source code. --> - - 4.0.0 - com.appdynamics.extensions - haproxy-monitoring-extension - 2.2.3 - jar - haproxy-monitoring-extension - http://maven.apache.org - - scm:git:https://github.com/Appdynamics/haproxy-monitoring-extension.git - - - UTF-8 - yyyy-MM-dd HH:mm:ss - ${project.build.directory}/HAProxyMonitor - - + + + 4.0.0 + + com.appdynamics.extensions + haproxy-monitoring-extension + 2.2.2 + jar + + haproxy-monitoring-extension + http://maven.apache.org + + + UTF-8 + yyyy-MM-dd HH:mm:ss + ${project.build.directory}/HAProxyMonitor + + - - com.appdynamics - machineagent-repackaged - 4.0.5.1 - - - org.eclipse.jetty - jetty-security - 12.0.12 - - - org.eclipse.jetty - jetty-server - 12.0.12 - - - org.eclipse.jetty - jetty-servlet - 11.0.22 - - - org.eclipse.jetty - jetty-io - 9.4.55.v20240627 - - - org.eclipse.jetty - jetty-util - 9.4.55.v20240627 - - - org.eclipse.jetty - jetty-util-ajax - 9.4.55.v20240627 - - - - org.junit - junit-bom - pom - test - 5.11.0 - - - org.junit.jupiter - junit-jupiter-api - 5.10.3 - - - org.junit.jupiter - junit-jupiter-engine - 5.10.3 - - - org.mockito - mockito-inline - 5.2.0 - - - org.mockito - mockito-junit-jupiter - 5.12.0 - - - org.objenesis - objenesis - 3.4 - + + com.appdynamics + machineagent-repackaged + 4.0.5.1 + provided + + + com.appdynamics + appd-exts-commons + 2.2.13 + + + junit + junit + 4.11 + test + + + org.powermock + powermock-module-junit4 + 1.5.6 + test + + + org.powermock + powermock-api-mockito + 1.5.6 + test + + + org.mockito + mockito-all + 1.9.5 + test + - - - - com.appdynamics - appd-exts-commons - 2.2.13 - - - - com.appdynamics - machineagent-repackaged - provided - - - - org.junit - junit-bom - pom - test - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.mockito - mockito-inline - test - - - org.mockito - mockito-junit-jupiter - test - - - org.objenesis - objenesis - - - - - - true - - - false - - github-maven-repo - https://github.com/Appdynamics/maven-repo/raw/master/releases - - - - ${project.artifactId} - - - src/main/resources - - - - - src/test/resources - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.13.0 - - 11 - 11 - - - - org.apache.maven.plugins - maven-shade-plugin - 3.6.0 - - false - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - com.appdynamics:appd-exts-commons - - javax/servlet/** - META-INF/FastDoubleParser-LICENSE - META-INF/FastDoubleParser-NOTICE - META-INF/mailcap.default - META-INF/maven/com.fasterxml.jackson*/** - META-INF/maven/com.google.code.gson/** - META-INF/maven/com.google.errorprone/** - META-INF/maven/com.google.gson/** - META-INF/maven/com.google.guava/** - META-INF/maven/com.google.j2objc/** - META-INF/maven/com.sun.istack/** - META-INF/maven/com.sun.xml.fastinfoset/FastInfoset/** - META-INF/maven/commons-codec/** - META-INF/maven/commons-io/commons-io/** - META-INF/maven/commons-logging/** - META-INF/maven/jakarta.activation/jakarta.activation-api/** - META-INF/maven/jakarta.xml.bind/jakarta.xml.bind-api/** - META-INF/maven/javax.activation/javax.activation-api/** - META-INF/maven/javax.servlet/** - META-INF/maven/javax.xml.bind/jaxb-api/** - META-INF/maven/net.objecthunter/exp4j/** - META-INF/maven/org.apache.commons/commons-lang3/** - META-INF/maven/org.apache.httpcomponents/httpclient/** - META-INF/maven/org.apache.httpcomponents/httpcore/** - META-INF/maven/org.apache.httpcomponents/httpmime/** - META-INF/maven/org.eclipse.jetty/** - META-INF/maven/org.eclipse.jetty/** - META-INF/maven/org.glassfish.jaxb/jaxb-core/** - META-INF/maven/org.glassfish.jaxb/jaxb-runtime/** - META-INF/maven/org.glassfish.jaxb/txw2/** - META-INF/maven/org.jvnet.staxex/stax-ex/** - META-INF/maven/org.slf4j/** - META-INF/maven/org.unix4j/** - META-INF/mimetypes.default - META-INF/proguard/** - META-INF/versions/*/com/fasterxml/jackson/core/io/doubleparser/* - META-INF/versions/9/module-info* - codegen/** - com/fasterxml/jackson/annotation/** - com/fasterxml/jackson/core/** - com/fasterxml/jackson/databind/** - com/google/thirdparty/publicsuffix/** - com/google/common/** - com/google/errorprone/** - com/google/gson/** - com/google/j2objc/** - com/sun/activation/registries/** - com/sun/activation/viewers/** - com/sun/istack/** - com/sun/xml/bind/** - com/sun/xml/fastinfoset/** - com/sun/xml/txw2/** - command-definition/** - javax/activation/** - javax/xml/bind/** - jetty-dir.css - net/objecthunter/exp4j/** - org/apache/commons/codec/** - org/apache/commons/io/** - org/apache/commons/lang3/** - org/apache/commons/logging/** - org/apache/http/** - org/checkerframework/** - org/eclipse/jetty/** - org/jvnet/fastinfoset/** - org/jvnet/staxex/** - org/slf4j/** - org/unix4j/** - org/yaml/** - - - - - - com.fasterxml.jackson.core:jackson-databind:2.14.1.redhat-00001 - - - - - - - shade - - package - - true - - - - - - - - HAProxy Monitor v${project.version} Build Date ${maven.build.timestamp} - com.appdynamics.extensions.workbench.WorkbenchServerLauncher - false - - - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 3.1.0 - - - install - - run - - install - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.codehaus.mojo - versions-maven-plugin - 2.17.1 - - - maven-scm-plugin - 2.1.0 - - ${project.artifactId}-${project.version} - - - - org.jacoco - jacoco-maven-plugin - 0.8.12 - - - - prepare-agent - - - - report - - report - - prepare-package - - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.3.1 - - - org.junit.jupiter - junit-jupiter-engine - 5.10.3 - - - - - - - - - org.jacoco - jacoco-maven-plugin - - - - - report - - - - - - + + ${project.artifactId} + + + src/main/resources + + + + + src/test/resources + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-shade-plugin + 2.2 + + false + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + package + + shade + + + + + + + + HAProxy Monitor v${project.version} Build Date ${maven.build.timestamp} + + + com.appdynamics.extensions.workbench.WorkbenchServerLauncher + + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.6 + + + install + install + + + + + + + + + + + + + + + + + + + + + + + + + + + + + run + + + + + + org.codehaus.mojo + versions-maven-plugin + 2.1 + + + maven-scm-plugin + 1.8.1 + + ${project.artifactId}-${project.version} + + + + + + + github-maven-repo + + true + + + false + + https://github.com/Appdynamics/maven-repo/raw/master/releases + + + + scm:git:https://github.com/Appdynamics/haproxy-monitoring-extension.git + diff --git a/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskJunit5Test.java b/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskJunit5Test.java deleted file mode 100644 index a7369d1..0000000 --- a/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskJunit5Test.java +++ /dev/null @@ -1,579 +0,0 @@ -/* - * - * Copyright 2018. AppDynamics LLC and its affiliates. - * All Rights Reserved. - * This is unpublished proprietary source code of AppDynamics LLC and its affiliates. - * The copyright notice above does not evidence any actual or intended publication of such source code. - * - */ - -package com.appdynamics.extensions.haproxy; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import com.appdynamics.extensions.MetricWriteHelper; -import com.appdynamics.extensions.TasksExecutionServiceProvider; -import com.appdynamics.extensions.conf.MonitorContext; -import com.appdynamics.extensions.conf.MonitorContextConfiguration; -import com.appdynamics.extensions.haproxy.config.MetricConfig; -import com.appdynamics.extensions.haproxy.config.MetricConverter; -import com.appdynamics.extensions.haproxy.config.ProxyStats; -import com.appdynamics.extensions.haproxy.config.Stat; -import com.appdynamics.extensions.http.HttpClientUtils; -import com.appdynamics.extensions.metrics.Metric; -import org.apache.http.impl.client.CloseableHttpClient; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.MockedStatic; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * - */ -@ExtendWith(MockitoExtension.class) -public class HAProxyMonitorTaskJunit5Test { - - @Mock - private TasksExecutionServiceProvider serviceProvider; - - @Mock - private MetricWriteHelper metricWriter; - - @Mock - private MonitorContextConfiguration contextConfiguration; - - @Mock - private MonitorContext context; - - @Mock - private ProxyStats proxyStats; - - @Mock - private CloseableHttpClient httpClient; - - @Mock - private Stat stat; - - @Captor - private ArgumentCaptor> pathCaptor; - - private HAProxyMonitorTask haProxyMonitorTask; - - private Map expectedValueMap; - private AutoCloseable closeable; - - @BeforeEach - @SuppressWarnings("unchecked") - public void before() { - closeable = MockitoAnnotations.openMocks(this); - pathCaptor = ArgumentCaptor.forClass(List.class); - - when(contextConfiguration.getContext()).thenReturn(context); - - when(contextConfiguration.getMetricPrefix()).thenReturn("Custom Metrics|HAProxy"); - - when(context.getHttpClient()).thenReturn(httpClient); - - when(serviceProvider.getMetricWriteHelper()).thenReturn(metricWriter); - - when(contextConfiguration.getMetricsXml()).thenReturn(proxyStats); - Mockito.doReturn(Map.of("encryptionKey", "")).when(contextConfiguration).getConfigYml(); - - String[] attr = {"qcur", "qmax", "scur", "smax", "slim", "stot", "bin", "bout", "dreq", "dresp", "ereq", "econ", "eresp", "wretr", "wredis", "status", "weight", "act", "bck", "chkfail", "chkdown", "lastchg", "downtime", "qlimit", "lbtot", "tracked", "type", "rate", "rate_lim", "rate_max", "check_status", "check_code", "check_duration", "hrsp_1xx", "hrsp_2xx", "hrsp_3xx", "hrsp_4xx", "hrsp_5xx", "hrsp_other", "hanafail", "req_rate", "req_rate_max", "req_tot", "cli_abrt", "srv_abrt", "comp_in", "comp_out", "comp_byp", "comp_rsp", "lastsess", "qtime", "ctime", "rtime", "ttime"}; - String[] alias = {"queued_requests", "max_queued_requests", "current sessions", "max sessions", "session limit", "total sessions", "bytes in", "bytes out", "denied requests", "denied responses", "error requests", "connection errors", "response errors", "connection retries", "request redispatches", "status", "server weight", "active servers", "backup servers", "checks failed", "number of transitions", "last transition", "total downtime", "maxqueue", "lbtot", "tracked", "type", "rate", "rate_limit", "rate_max", "check_status", "check_code", "check_duration", "hrsp_1xx", "hrsp_2xx", "hrsp_3xx", "hrsp_4xx", "hrsp_5xx", "hrsp_other", "failed health check", "req_rate", "req_rate_max", "req_tot", "client aborts", "server abortes", "comp_in", "comp_out", "comp_byp", "comp_rsp", "lastsess", "qtime", "ctime", "rtime", "ttime"}; - int[] column = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59}; - String[] status = {"UP", "OPEN"}; - String[] check_status = {"UNK", "INI", "SOCKERR", "L4OK", "L4TOUT", "L4CON", "L6OK", "L6TOUT", "L6RSP", "L7OK", "L7OKC", "L7TOUT", "L7RSP", "L7STS"}; - int numOfMetricConfigs = attr.length; - MetricConfig[] metricConfigs = new MetricConfig[numOfMetricConfigs]; - for (int i = 0; i < numOfMetricConfigs; i++) { - metricConfigs[i] = new MetricConfig(); - metricConfigs[i].setAttr(attr[i]); - metricConfigs[i].setAlias(alias[i]); - metricConfigs[i].setColumn(column[i]); - if (metricConfigs[i].getAttr().equals("status")) { - MetricConverter[] converters = new MetricConverter[status.length]; - for (int index = 0; index < converters.length; index++) { - converters[index] = new MetricConverter(); - converters[index].setLabel(status[index]); - converters[index].setValue("1"); - } - metricConfigs[i].setConvert(converters); - } - if (metricConfigs[i].getAttr().equals("check_status")) { - MetricConverter[] converters = new MetricConverter[check_status.length]; - for (int index = 0; index < converters.length; index++) { - converters[index] = new MetricConverter(); - converters[index].setLabel(check_status[index]); - converters[index].setValue(String.valueOf(index)); - } - metricConfigs[i].setConvert(converters); - } - } - - when(proxyStats.getStat()).thenReturn(stat); - when(stat.getMetricConfig()).thenReturn(metricConfigs); - - Map server = new HashMap<>(); - server.put("displayName", "Local HA-Proxy"); - server.put("host", "demo.haproxy.org"); - server.put("port", 80); - server.put("csvExportUri", ";csv"); - List> proxyServers = new LinkedList<>(); - Map map1 = new HashMap<>(); - map1.put("pxname", "http.*"); - String[] svname = {"FRONTEND", ".*-direct", "IPv4-.*", "local.*"}; - map1.put("svname", Arrays.asList(svname)); - proxyServers.add(map1); - Map map2 = new HashMap<>(); - map2.put("pxname", "www"); - String[] svname1 = {"b.*", "ww.*"}; - map2.put("svname", Arrays.asList(svname1)); - proxyServers.add(map2); - - Map map3 = new HashMap<>(); - map3.put("pxname", "demo"); - String[] svname2 = {"b.*", "ww.*"}; - map3.put("svname", Arrays.asList(svname2)); - proxyServers.add(map3); - - Map map4 = new HashMap<>(); - map4.put("pxname", "git"); - String[] svname3 = {"b.*", "ww.*"}; - map4.put("svname", Arrays.asList(svname3)); - proxyServers.add(map4); - - server.put("proxyServers", proxyServers); - - haProxyMonitorTask = new HAProxyMonitorTask(contextConfiguration, serviceProvider.getMetricWriteHelper(), server); - - } - @AfterEach - public void after() throws Exception { - closeable.close(); - } - - //read from the csv file which is the response of the httpClient - private String readFromCSV() throws IOException { - return Files.readString(Paths.get("src/test/resources/demo.csv")); - } - - @Test - public void testHAProxyResponseRunTest() throws IOException { - expectedValueMap = getExpectedResultMap(); - try(MockedStatic hcu = Mockito.mockStatic(HttpClientUtils.class)){ - hcu.when(() -> HttpClientUtils.getResponseAsStr(any(CloseableHttpClient.class), anyString())).thenReturn(readFromCSV()); - haProxyMonitorTask.run(); - } - validateMetrics(); - assertTrue( expectedValueMap.isEmpty(), "The expected values were not sent. The missing values are " + expectedValueMap); - } - - @SuppressWarnings("unchecked") - private void validateMetrics() { - verify(metricWriter).transformAndPrintMetrics(pathCaptor.capture()); - for (Metric metric : pathCaptor.getValue()) { - String actualValue = metric.getMetricValue(); - String metricName = metric.getMetricPath(); - if (expectedValueMap.containsKey(metricName)) { - String expectedValue = expectedValueMap.get(metricName); - assertEquals(expectedValue, actualValue, "The value of the metric " + metricName + " failed"); - expectedValueMap.remove(metricName); - } else { - System.out.println("\"" + metricName + "\",\"" + actualValue + "\""); - fail("Unknown Metric " + metricName); - } - } - } - - private Map getExpectedResultMap() { - Map map = new HashMap<>(); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|current sessions", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|max sessions", "42"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|session limit", "100"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|total sessions", "1519275"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|bytes in", "333499537"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|bytes out", "6338133277"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|denied requests", "738400"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|error requests", "16134"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|type", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|rate", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|rate_limit", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|rate_max", "50"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_1xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_2xx", "697370"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_3xx", "72283"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_4xx", "41188"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_5xx", "75"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|hrsp_other", "738521"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|req_rate", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|req_rate_max", "50"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|req_tot", "1539497"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|comp_in", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|comp_out", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|comp_byp", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|FRONTEND|comp_rsp", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|current sessions", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|max sessions", "33"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|session limit", "100"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|total sessions", "808403"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|bytes in", "135050797"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|bytes out", "1188864381"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|denied requests", "729660"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|error requests", "10"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-direct|type", "3"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|max sessions", "15"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|session limit", "100"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|total sessions", "652397"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|bytes in", "185024074"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|bytes out", "4716795289"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|denied requests", "1574"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|error requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv4-cached|type", "3"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|max sessions", "41"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|session limit", "100"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|total sessions", "45355"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|bytes in", "11023081"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|bytes out", "312920138"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|denied requests", "228"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|error requests", "16124"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|IPv6-direct|type", "3"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|max sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|session limit", "100"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|total sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|bytes in", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|bytes out", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|denied requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|error requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local|type", "3"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|max sessions", "5"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|session limit", "100"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|total sessions", "21397"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|bytes in", "2401585"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|bytes out", "119553469"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|denied requests", "6938"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|error requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|http-in|local-https|type", "3"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|max_queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|max sessions", "20"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|session limit", "20"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|total sessions", "456944"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|bytes in", "170279920"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|bytes out", "5814720367"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|connection errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|response errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|connection retries", "9"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|request redispatches", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|server weight", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|active servers", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|backup servers", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|checks failed", "3"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|number of transitions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|last transition", "3952709"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|total downtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|lbtot", "456950"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|type", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|rate", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|rate_max", "44"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|check_status", "9"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|check_code", "200"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|check_duration", "6"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_1xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_2xx", "416068"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_3xx", "16352"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_4xx", "24441"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_5xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|hrsp_other", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|client aborts", "26733"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|server abortes", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|lastsess", "5"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|qtime", "OK"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|rtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|www|ttime", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|max_queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|max sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|session limit", "10"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|total sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|bytes in", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|bytes out", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|connection errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|response errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|connection retries", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|request redispatches", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|server weight", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|active servers", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|backup servers", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|checks failed", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|number of transitions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|last transition", "3952709"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|total downtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|lbtot", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|type", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|rate", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|rate_max", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|check_status", "9"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|check_code", "200"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|check_duration", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_1xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_2xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_3xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_4xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_5xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|hrsp_other", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|client aborts", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|server abortes", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|lastsess", "-1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|qtime", "OK"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|rtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|bck|ttime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|max_queued_requests", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|max sessions", "24"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|session limit", "100"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|total sessions", "457291"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|bytes in", "170297227"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|bytes out", "5814781091"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|denied requests", "323"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|connection errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|response errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|connection retries", "9"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|request redispatches", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|server weight", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|active servers", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|backup servers", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|number of transitions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|last transition", "3952709"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|total downtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|lbtot", "456950"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|type", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|rate", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|rate_max", "44"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_1xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_2xx", "416068"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_3xx", "16352"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_4xx", "24770"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_5xx", "75"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|hrsp_other", "26"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|req_tot", "457291"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|client aborts", "26743"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|server abortes", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|comp_in", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|comp_out", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|comp_byp", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|comp_rsp", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|lastsess", "5"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|rtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|www|BACKEND|ttime", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|max_queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|max sessions", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|session limit", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|total sessions", "653"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|bytes in", "304655"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|bytes out", "20066675"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|connection errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|response errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|connection retries", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|request redispatches", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|server weight", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|active servers", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|backup servers", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|checks failed", "3"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|number of transitions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|last transition", "3952709"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|total downtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|lbtot", "650"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|type", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|rate", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|rate_max", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|check_status", "9"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|check_code", "200"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|check_duration", "4"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_1xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_2xx", "633"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_3xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_4xx", "20"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_5xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|hrsp_other", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|client aborts", "33"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|server abortes", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|lastsess", "2902"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|qtime", "OK"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|rtime", "4"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|www|ttime", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|max_queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|max sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|session limit", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|total sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|bytes in", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|bytes out", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|connection errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|response errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|connection retries", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|request redispatches", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|server weight", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|active servers", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|backup servers", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|checks failed", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|number of transitions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|last transition", "3952709"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|total downtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|lbtot", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|type", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|rate", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|rate_max", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|check_status", "9"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|check_code", "200"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|check_duration", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_1xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_2xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_3xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_4xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_5xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|hrsp_other", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|client aborts", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|server abortes", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|lastsess", "-1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|qtime", "OK"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|rtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|bck|ttime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|max_queued_requests", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|current sessions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|max sessions", "3"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|session limit", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|total sessions", "653"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|bytes in", "306399"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|bytes out", "20066675"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|denied requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|connection errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|response errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|connection retries", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|request redispatches", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|server weight", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|active servers", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|backup servers", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|number of transitions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|last transition", "3952709"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|total downtime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|lbtot", "650"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|type", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|rate", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|rate_max", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_1xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_2xx", "633"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_3xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_4xx", "20"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_5xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|hrsp_other", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|req_tot", "653"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|client aborts", "33"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|server abortes", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|comp_in", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|comp_out", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|comp_byp", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|comp_rsp", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|lastsess", "2902"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|rtime", "4"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|git|BACKEND|ttime", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|max_queued_requests", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|current sessions", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|max sessions", "6"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|session limit", "20"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|total sessions", "19333"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|bytes in", "6287622"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|bytes out", "454680661"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|denied requests", "40"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|denied responses", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|connection errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|response errors", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|connection retries", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|request redispatches", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|status", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|server weight", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|active servers", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|backup servers", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|number of transitions", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|last transition", "3952709"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|lbtot", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|type", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|rate", "1"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|rate_max", "5"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_1xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_2xx", "18574"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_3xx", "38"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_4xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_5xx", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|hrsp_other", "720"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|req_tot", "19332"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|client aborts", "72"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|server abortes", "196"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|comp_in", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|comp_out", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|comp_byp", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|comp_rsp", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|lastsess", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|rtime", "2"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|demo|BACKEND|ttime", "0"); - map.put("Custom Metrics|HAProxy|Local HA-Proxy|HeartBeat", "1"); - return map; - } -} \ No newline at end of file From e823c1c6423173f6a285b9add359204a97f0dce0 Mon Sep 17 00:00:00 2001 From: Cyrus Kalbrener Date: Thu, 29 Aug 2024 09:54:30 +0100 Subject: [PATCH 5/7] Updating to appd-ext-commons 2.2.13 --- .../haproxy/HAProxyMonitorTaskTest.java | 59 ++++++++++--------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskTest.java b/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskTest.java index c879f29..eeca24f 100644 --- a/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskTest.java +++ b/src/test/java/com/appdynamics/extensions/haproxy/HAProxyMonitorTaskTest.java @@ -9,10 +9,8 @@ package com.appdynamics.extensions.haproxy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; -import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.verify; import com.appdynamics.extensions.MetricWriteHelper; import com.appdynamics.extensions.TasksExecutionServiceProvider; @@ -24,19 +22,27 @@ import com.appdynamics.extensions.haproxy.config.ProxyStats; import com.appdynamics.extensions.haproxy.config.ServerConfig; import com.appdynamics.extensions.haproxy.config.Stat; +import com.appdynamics.extensions.http.HttpClientUtils; import com.appdynamics.extensions.logging.ExtensionsLoggerFactory; import com.appdynamics.extensions.metrics.Metric; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.entity.InputStreamEntity; import org.apache.http.impl.client.CloseableHttpClient; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; import org.slf4j.Logger; import java.io.BufferedReader; @@ -54,10 +60,9 @@ /** * */ -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({HttpClientUtils.class, CloseableHttpClient.class}) -//@PowerMockIgnore({"javax.net.ssl.*", "jdk.internal.reflect.*"}) -@Disabled("This test was written for JUnit 4, and it uses PowerMockito. It has been rewritten for JUnit 5.") +@RunWith(PowerMockRunner.class) +@PrepareForTest(HttpClientUtils.class) +@PowerMockIgnore("javax.net.ssl.*") public class HAProxyMonitorTaskTest { public static final Logger logger = ExtensionsLoggerFactory.getLogger(HAProxyMonitorTaskTest.class); @@ -99,7 +104,7 @@ public class HAProxyMonitorTaskTest { private ArgumentCaptor pathCaptor = ArgumentCaptor.forClass(List.class); - @BeforeEach + @Before public void before() throws IOException { Mockito.when(contextConfiguration.getContext()).thenReturn(context); @@ -196,15 +201,15 @@ public void before() throws IOException { haProxyMonitorTask = Mockito.spy(new HAProxyMonitorTask(contextConfiguration, serviceProvider.getMetricWriteHelper(), server)); -// PowerMockito.mockStatic(HttpClientUtils.class); -// PowerMockito.mockStatic(CloseableHttpClient.class); -// -// PowerMockito.when(HttpClientUtils.getResponseAsStr(any(CloseableHttpClient.class), anyString())).thenAnswer( -// new Answer() { -// public Object answer(InvocationOnMock invocationOnMock) throws Throwable { -// return readFromCSV(); -// } -// }); + PowerMockito.mockStatic(HttpClientUtils.class); + PowerMockito.mockStatic(CloseableHttpClient.class); + + PowerMockito.when(HttpClientUtils.getResponseAsStr(any(CloseableHttpClient.class), anyString())).thenAnswer( + new Answer() { + public Object answer(InvocationOnMock invocationOnMock) throws Throwable { + return readFromCSV(); + } + }); } //read from the csv file which is the response of the httpClient @@ -224,11 +229,11 @@ private String readFromCSV() throws IOException { return responseString; } - @BeforeEach + @Before public void setUp() throws Exception { } - @AfterEach + @After public void tearDown() throws Exception { } @@ -237,7 +242,7 @@ public void testHAProxyResponseRunTest() throws IOException { expectedValueMap = getExpectedResultMap(); haProxyMonitorTask.run(); validateMetrics(); - assertTrue(expectedValueMap.isEmpty(), "The expected values were not sent. The missing values are " + expectedValueMap); + Assert.assertTrue("The expected values were not sent. The missing values are " + expectedValueMap, expectedValueMap.isEmpty()); } private void validateMetrics() { @@ -247,11 +252,11 @@ private void validateMetrics() { String metricName = metric.getMetricPath(); if (expectedValueMap.containsKey(metricName)) { String expectedValue = expectedValueMap.get(metricName); - assertEquals(expectedValue, actualValue, "The value of the metric " + metricName + " failed"); + Assert.assertEquals("The value of the metric " + metricName + " failed", expectedValue, actualValue); expectedValueMap.remove(metricName); } else { System.out.println("\"" + metricName + "\",\"" + actualValue + "\""); - fail("Unknown Metric " + metricName); + Assert.fail("Unknown Metric " + metricName); } } } From 02228de28de15fad26ec1363a7979052f25fd998 Mon Sep 17 00:00:00 2001 From: Cyrus Kalbrener Date: Thu, 29 Aug 2024 09:56:44 +0100 Subject: [PATCH 6/7] Updating to appd-ext-commons 2.2.13 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77e1614..037b5eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +#### 2.2.3 - Aug 29, 2024, +1. Upgraded to appd-exts-commons 2.2.13 +2. ### 2.2.2 - Jan 08, 2021 1. Upgraded to appd-exts-commons 2.2.4 From df2e96f25a540674bc5df288a83da14d4ffbbc36 Mon Sep 17 00:00:00 2001 From: Cyrus Kalbrener Date: Fri, 30 Aug 2024 15:20:27 +0100 Subject: [PATCH 7/7] bump release version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9ba1dfe..240178e 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ com.appdynamics.extensions haproxy-monitoring-extension - 2.2.2 + 2.2.3 jar haproxy-monitoring-extension