JVM Metrics of Jenkins with Ansible

I am using Ansible for Jenkins configuration and for installing the Prometheus exporters that I need for monitoring.

If you want to monitor the JVM Metrics of Jenkins with Prometheus and Grafana you can use Prometheus JMX Exporter Ansible role

It will install the Prometheus JMX Exporter in your Jenkins instance.

I have deployed it as an independent HTTP server instead of using it as a Java Agent.

In order to make it work, you need to add some system properties when Jenkins is started. In my case, I am using GeerlingGuy Ansible Role Jenkins for my Jenkins configuration, so I added these system properties:

jenkins_system_properties: >-

Once you have deployed the JMX Exporter, you can import this JVM Grafana dashboard.

You will get something like this:

I hope this helps!