All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.m3y.prometheus.exporter.knox.HomePageServlet Maven / Gradle / Ivy

Go to download

The Prometheus blackbox exporter samples Apache Knox WebHdfs/HBase/Hive endpoints collecting error and duration metrics.

There is a newer version: 1.0
Show newest version
package de.m3y.prometheus.exporter.knox;

import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Displays a welcome page containing build info and link to metrics.
 */
public class HomePageServlet extends HttpServlet {

    private final Config config;
    private final BuildInfoExporter buildInfoExporter;
    private final String knoxGatewayUrl;

    HomePageServlet(String knoxGatewayUrl, Config config, BuildInfoExporter buildInfoExporter) {
        this.knoxGatewayUrl = knoxGatewayUrl;
        this.config = config;
        this.buildInfoExporter = buildInfoExporter;
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        StringBuilder buf = new StringBuilder().append("\n"
                + "Apache Knox Exporter\n"
                + "\n"
                + "

Apache Knox Exporter

\n" + "

Metrics

\n" + "

Build info

" + "
    " + "
  • App version: ").append(buildInfoExporter.getAppVersion()).append("
  • " + "
  • Build time : ").append(buildInfoExporter.getBuildTimeStamp()).append("
  • " + "
  • SCM branch : ").append(buildInfoExporter.getBuildScmBranch()).append("
  • " + "
  • SCM version : ").append(buildInfoExporter.getBuildScmVersion()).append("
  • " + "
" + "

Configuration

    " + "
  • Knox gateway URL : ").append(knoxGatewayUrl).append("
  • " + "
  • username : ").append(config.getUsername()).append("
  • " + "
  • webHdfStatusPath : ").append(config.getWebHdfStatusPath()).append("
  • " + "
  • hiveJdbcUrl : ").append(config.getHiveJdbcUrl()).append("
  • " + "
  • hiveQuery : ").append(config.getHiveQuery()).append("
  • " + "
\n" + ""); resp.setContentType("text/html"); resp.getWriter().print(buf); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy