I have a question on which I am stuck and I am not quite sure how to resolve it.
In my work project I have an ActiveMQ queue and I want to send some metrics to Prometheus which will help me to create some alerts in Grafana. I know that for ActiveMQ Artemis I can use this plugin, but I don't understand 100% how to configure it.
My application is deployed on a Kubernetes cluster and the ActiveMQ broker is there too. So I have created ActiveMQPrometheusMetricsPlugin class which implements org.apache.activemq.artemis.core.server.metrics.ActiveMQMetricsPlugin
. Now is where I get confused right now I should deploy my application and the metrics would be gather by Prometheus? I should do more configuration?
We usually do not build the application on local env. We are using a pipeline which is building and deploying the app to various envs (dev, test, prod). I should do the configuration similar with the GitHub plugin project, deploy it, and after that find those jars on Kubernetes and move them to the correct location? Also dev-ops said to me that we are using a default conf. I don't know if we have a broker.xml
file.
There are a couple of important points to understand before getting started:
broker.xml
and bootstrap.xml
respectively.The Artemis Prometheus Metrics Plugin provides integration with Prometheus using two modules:
artemis-prometheus-metrics-plugin: This provides the actual implementation of org.apache.activemq.artemis.core.server.metrics.ActiveMQMetricsPlugin
and
packages it with the Micrometer and Prometheus dependencies in an "uber" jar.
artemis-prometheus-metrics-plugin-servlet: This provides a war file containing a simple servlet which can be deployed to the broker's embedded web server which then Prometheus can use to scrape metrics.
Once you clone the Artemis Prometheus Metrics Plugin repository simply run mvn install
to build these two modules. The output will be in their respective target
directories.
After building the modules follow these steps to deploy and configure the Artemis Prometheus Metrics Plugin. If you have some kind of dev-ops group which manages and configures your broker then they would follow these steps.
Copy artemis-prometheus-metrics-plugin/target/artemis-prometheus-metrics-plugin-<VERSION>.jar
to <ARTEMIS_INSTANCE>/lib
.
Add this to your <ARTEMIS_INSTANCE>/etc/broker.xml
:
<metrics-plugin class-name="org.apache.activemq.artemis.core.server.metrics.plugins.ArtemisPrometheusMetricsPlugin"/>
Create the directory <ARTEMIS_INSTANCE>/web
.
Copy artemis-prometheus-metrics-plugin-servlet/target/metrics.war
to <ARTEMIS_INSTANCE>/web
.
Add this to the web
element in <ARTEMIS_INSTANCE>/etc/bootstrap.xml
:
<app url="metrics" war="metrics.war"/>