new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporter.java
@Test
  @DisplayName("Test End to End example from MonitoringExporter github project.")
  public void testEndToEndViaChart() throws Exception {
    wdtImage = createAndVerifyDomainInImage();
    try {
      logger.info("Create wdt domain and verify that it's running");
      createAndVerifyDomain(wdtImage, domain2Uid, domain2Namespace, "Image", replicaCount);
      ingressHost2List =
              createIngressForDomainAndVerify(domain2Uid, domain2Namespace, clusterNameMsPortMap);
      logger.info("Installing Prometheus and Grafana");
      installPrometheusGrafana(PROMETHEUS_CHART_VERSION, GRAFANA_CHART_VERSION,
              domain2Namespace,
              domain2Uid);

      installWebhook();
      installCoordinator(domain2Namespace);

      logger.info("verify access to Monitoring Exporter");
      verifyMonExpAppAccessThroughNginx(ingressHost2List.get(0), managedServersCount);
      logger.info("verify metrics via prometheus");
      String testappPrometheusSearchKey =
              "wls_servlet_invocation_total_count%7Bapp%3D%22test-webapp%22%7D%5B15s%5D";
      checkMetricsViaPrometheus(testappPrometheusSearchKey, "test-webapp");
      logger.info("fire alert by scaling down");
      fireAlert();
      logger.info("switch to monitor another domain");
      String oldRegex = String.format("regex: %s;%s;%s", domain2Namespace, domain2Uid, clusterName);
      String newRegex = String.format("regex: %s;%s;%s", domain1Namespace, domain1Uid, clusterName);
      editPrometheusCM(oldRegex, newRegex);
      String sessionAppPrometheusSearchKey =
              "wls_servlet_invocation_total_count%7Bapp%3D%22myear%22%7D%5B15s%5D";
      checkMetricsViaPrometheus(sessionAppPrometheusSearchKey, "sessmigr");
      checkPromGrafanaLatestVersion();
    } finally {
      logger.info("Shutting down domain2");
      assertTrue(shutdownDomain(domain2Uid, domain2Namespace),
              String.format("shutdown domain %s in namespace %s failed", domain2Uid, domain2Namespace));
    }
  }
/**
   * Test covers end to end sample, provided in the Monitoring Exporter github project.
   * Create Prometheus, Grafana, Webhook, Coordinator.
   * Create domain in Image with monitoring exporter.
   * Verify access to monitoring exporter WebLogic metrics via nginx.
   * Check generated by monitoring exporter WebLogic metrics via Prometheus, Grafana.
   * Fire Alert using Webhook.
   * Change prometheus to add different domain to monitor.
   */
Test covers end to end sample, provided in the Monitoring Exporter github project.
Create Prometheus, Grafana, Webhook, Coordinator.
Create domain in Image with monitoring exporter.
Verify access to monitoring exporter WebLogic metrics via nginx.
Check generated by monitoring exporter WebLogic metrics via Prometheus, Grafana.
Fire Alert using Webhook.
Change prometheus to add different domain to monitor.
Test covers end to end sample provided in the Monitoring Exporter github project . Create Prometheus Grafana Webhook Coordinator . Create domain in Image with monitoring exporter . Verify access to monitoring exporter WebLogic metrics via nginx . Check generated by monitoring exporter WebLogic metrics via Prometheus Grafana . Fire Alert using Webhook . Change prometheus to add different domain to monitor .
@Test
  @DisplayName("Test End to End example from MonitoringExporter github project.")
  public void testEndToEndViaChart() throws Exception {
    wdtImage = createAndVerifyDomainInImage();
    try {
      logger.info("Create wdt domain and verify that it's running");
      createAndVerifyDomain(wdtImage, domain2Uid, domain2Namespace, "Image", replicaCount);
      ingressHost2List =
              createIngressForDomainAndVerify(domain2Uid, domain2Namespace, clusterNameMsPortMap);
      logger.info("Installing Prometheus and Grafana");
      installPrometheusGrafana(PROMETHEUS_CHART_VERSION, GRAFANA_CHART_VERSION,
              domain2Namespace,
              domain2Uid);
      installWebhook();
      installCoordinator(domain2Namespace);
      logger.info("verify access to Monitoring Exporter");
      verifyMonExpAppAccessThroughNginx(ingressHost2List.get(0), managedServersCount);
      logger.info("verify metrics via prometheus");
      String testappPrometheusSearchKey =
              "wls_servlet_invocation_total_count%7Bapp%3D%22test-webapp%22%7D%5B15s%5D";
      checkMetricsViaPrometheus(testappPrometheusSearchKey, "test-webapp");
      logger.info("fire alert by scaling down");
      fireAlert();
      logger.info("switch to monitor another domain");
      String oldRegex = String.format("regex: %s;%s;%s", domain2Namespace, domain2Uid, clusterName);
      String newRegex = String.format("regex: %s;%s;%s", domain1Namespace, domain1Uid, clusterName);
      editPrometheusCM(oldRegex, newRegex);
      String sessionAppPrometheusSearchKey =
              "wls_servlet_invocation_total_count%7Bapp%3D%22myear%22%7D%5B15s%5D";
      checkMetricsViaPrometheus(sessionAppPrometheusSearchKey, "sessmigr");
      checkPromGrafanaLatestVersion();
    } finally {
      logger.info("Shutting down domain2");
      assertTrue(shutdownDomain(domain2Uid, domain2Namespace),
              String.format("shutdown domain %s in namespace %s failed", domain2Uid, domain2Namespace));
    }
  }
@ Test @ DisplayName ( "Test End to End example from MonitoringExporter github project." ) public void testEndToEndViaChart ( ) throws Exception { wdtImage = createAndVerifyDomainInImage ( ) ; try { logger . info ( "Create wdt domain and verify that it's running" ) ; createAndVerifyDomain ( wdtImage , domain2Uid , domain2Namespace , "Image" , replicaCount ) ; ingressHost2List = createIngressForDomainAndVerify ( domain2Uid , domain2Namespace , clusterNameMsPortMap ) ; logger . info ( "Installing Prometheus and Grafana" ) ; installPrometheusGrafana ( PROMETHEUS_CHART_VERSION , GRAFANA_CHART_VERSION , domain2Namespace , domain2Uid ) ; installWebhook ( ) ; installCoordinator ( domain2Namespace ) ; logger . info ( "verify access to Monitoring Exporter" ) ; verifyMonExpAppAccessThroughNginx ( ingressHost2List . get ( 0 ) , managedServersCount ) ; logger . info ( "verify metrics via prometheus" ) ; String testappPrometheusSearchKey = "wls_servlet_invocation_total_count%7Bapp%3D%22test-webapp%22%7D%5B15s%5D" ; checkMetricsViaPrometheus ( testappPrometheusSearchKey , "test-webapp" ) ; logger . info ( "fire alert by scaling down" ) ; fireAlert ( ) ; logger . info ( "switch to monitor another domain" ) ; String oldRegex = String . format ( "regex: %s;%s;%s" , domain2Namespace , domain2Uid , clusterName ) ; String newRegex = String . format ( "regex: %s;%s;%s" , domain1Namespace , domain1Uid , clusterName ) ; editPrometheusCM ( oldRegex , newRegex ) ; String sessionAppPrometheusSearchKey = "wls_servlet_invocation_total_count%7Bapp%3D%22myear%22%7D%5B15s%5D" ; checkMetricsViaPrometheus ( sessionAppPrometheusSearchKey , "sessmigr" ) ; checkPromGrafanaLatestVersion ( ) ; } finally { logger . info ( "Shutting down domain2" ) ; assertTrue ( shutdownDomain ( domain2Uid , domain2Namespace ) , String . format ( "shutdown domain %s in namespace %s failed" , domain2Uid , domain2Namespace ) ) ; } }
Test covers end to end sample, provided in the Monitoring Exporter github project.
Test covers end to end sample provided in the Monitoring Exporter github project .