All Projects → nlighten → Tomcat_exporter

nlighten / Tomcat_exporter

Licence: apache-2.0
A Prometheus exporter for Apache Tomcat

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Tomcat exporter

Kube State Metrics
Add-on agent to generate and expose cluster-level metrics.
Stars: ✭ 3,433 (+3367.68%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Snmp exporter
SNMP Exporter for Prometheus
Stars: ✭ 705 (+612.12%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Consul exporter
Exporter for Consul metrics
Stars: ✭ 323 (+226.26%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Citrix Adc Metrics Exporter
Export metrics from Citrix ADC (NetScaler) to Prometheus
Stars: ✭ 67 (-32.32%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Systemd exporter
Exporter for systemd unit metrics
Stars: ✭ 82 (-17.17%)
Mutual labels:  metrics, prometheus, prometheus-exporter
s3 exporter
Exports Prometheus metrics about S3 buckets and objects
Stars: ✭ 65 (-34.34%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Statsd exporter
StatsD to Prometheus metrics exporter
Stars: ✭ 608 (+514.14%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Ssl exporter
Exports Prometheus metrics for SSL certificates
Stars: ✭ 211 (+113.13%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Unifiedmetrics
Fully-featured metrics collection agent for Minecraft servers. Supports Prometheus and InfluxDB. Dashboard included out-of-box.
Stars: ✭ 29 (-70.71%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Json Exporter
Prometheus exporter which fetches JSON from a URL and exports one of the values as gauge metrics
Stars: ✭ 26 (-73.74%)
Mutual labels:  metrics, prometheus, prometheus-exporter
aws-ec2-sg-exporter
A dockerized Prometheus exporter that compares desired/wanted IPv4/IPv6 CIDR against currently applied inbound CIDR rules in your security group(s).
Stars: ✭ 23 (-76.77%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Kafka exporter
Kafka exporter for Prometheus
Stars: ✭ 996 (+906.06%)
Mutual labels:  metrics, prometheus, prometheus-exporter
github exporter
Prometheus exporter for GitHub
Stars: ✭ 21 (-78.79%)
Mutual labels:  metrics, prometheus, prometheus-exporter
resoto
Resoto - Find leaky resources, manage quota limits, detect drift, and clean up!
Stars: ✭ 562 (+467.68%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Github Exporter
Prometheus exporter for github metrics
Stars: ✭ 231 (+133.33%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Haproxy exporter
Simple server that scrapes HAProxy stats and exports them via HTTP for Prometheus consumption
Stars: ✭ 465 (+369.7%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Pagespeed exporter
Prometheus pagespeed exporter
Stars: ✭ 149 (+50.51%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Query Exporter
Export Prometheus metrics from SQL queries
Stars: ✭ 166 (+67.68%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Postgresql exporter
A Prometheus exporter for some postgresql metrics
Stars: ✭ 26 (-73.74%)
Mutual labels:  metrics, prometheus, prometheus-exporter
Iperf3 exporter
Simple server that probes iPerf3 endpoints and exports results via HTTP for Prometheus consumption
Stars: ✭ 30 (-69.7%)
Mutual labels:  metrics, prometheus, prometheus-exporter

Prometheus Tomcat Exporter

A set of collectors that can be used to monitor Apache Tomcat instances.

Available metrics

The following Tomcat related metrics are provided:

  • Thread pool metrics
  • Session metrics
  • Request processor metrics
  • Database connection pool metrics
  • Tomcat version info
  • Servlet response time metrics
  • Database response time metrics

Using this library

If you are running Tomcat in the conventional non-embedded setup we recommended to add the following jars (see pom.xml) to the $CATALINA_BASE/lib directory or another directory on the Tomcat common.loader path. Using the common.loader is important as we need to make sure that all metrics are registered using the same class loader.

Next, rename tomcat_exporter_servlet war file to metrics.war and add it to the webapps directory of Tomcat. After restart of tomcat you should be able to access metrics via the /metrics/ endpoint.

Servlet response time metrics

If you want servlet response time metrics you can configure the TomcatServletMetricsFilter by adding it to the $CATALINA_BASE/conf/web.xml as shown below. There is no need to modify already deployed applications.

<filter>
  <filter-name>ServletMetricsFilter</filter-name>
  <filter-class>nl.nlighten.prometheus.tomcat.TomcatServletMetricsFilter</filter-class>
  <async-supported>true</async-supported>
  <init-param>
    <param-name>buckets</param-name>
    <param-value>.01, .05, .1, .25, .5, 1, 2.5, 5, 10, 30</param-value>
  </init-param>
</filter>

<filter-mapping>
  <filter-name>ServletMetricsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

For an explanation on histograms and buckets please see the prometheus documentation.

Database response time metrics

Database response time metrics are only available when using the Tomcat JDBC Pool as this collector uses an interceptor mechanism that is only available for this type of pool.

The interceptor will collect the following metrics:

  • A histogram with global query response times
  • A histogram with per query response times for slow queries (optional)
  • A gauge with per query error counts (optional)

Configuration is usually done in Tomcat's server.xml or context.xml

<Resource name="jdbc/TestDB"
           auth="Container"
           type="javax.sql.DataSource"
           factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
           jdbcInterceptors="nl.nlighten.prometheus.tomcat.TomcatJdbcInterceptor(logFailed=true,logSlow=true,threshold=1000,buckets=.01|.05|.1|1|10,slowQueryBuckets=1|10|30)"
           username="root"
           password="password"
           driverClassName="com.mysql.jdbc.Driver"
           url="jdbc:mysql://localhost:3306/mysql"/>

Configuration options of the interceptor are as shown above and have the following meaning:

  • logFailed: if set to 'true' collect metrics on failed queries
  • logSlow: if set to 'true' collect metrics on metrics exceeding threshold
  • threshold: the threshold in ms above which metrics will be collected if logSlow=true
  • buckets: the buckets separated by a pipe ("|") symbol to be used for the global query response times, defaults to .01|.05|.1|.25|.5|1|2.5|10
  • slowQueryBuckets: the buckets separated by a pipe ("|") symbol to be used for the global query response times, defaults to 1|2.5|10|30

NOTE:

  • Enabling logFailed and logSlow may lead to a lot of additional metrics., so be careful !!!
  • If you are defining your data source on application level (so inside your war), you need to set bindOnInit to ensure that your data source has been initialized before the metrics application starts.

Embedded mode

If you run Tomcat in embedded mode, please look at the AbstractTomcatMetricsTest for an example on how to configure the various exporters when running embedded.

Javadocs

There are canonical examples defined in the class definition Javadoc of the client packages.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].