From f4f5decea4cdb3a8a6f50212bb2b6e5568f4879c Mon Sep 17 00:00:00 2001 From: Domenico Francesco Bruscino Date: Tue, 9 Jul 2024 17:22:01 +0200 Subject: [PATCH] [#976] Add an example to monitor broker metrics by using Prometheus --- docs/help/operator.md | 19 ++++++++----------- examples/artemis/artemis_metrics_monitor.yaml | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 examples/artemis/artemis_metrics_monitor.yaml diff --git a/docs/help/operator.md b/docs/help/operator.md index 96ce8c302..7d0aef323 100644 --- a/docs/help/operator.md +++ b/docs/help/operator.md @@ -993,14 +993,12 @@ In addition, you need to expose the console, for example apiVersion: broker.amq.io/v1beta1 kind: ActiveMQArtemis metadata: - name: ex-aao + name: artemis-with-metrics spec: - deploymentPlan: - size: 1 - enableMetricsPlugin: true - image: placeholder console: expose: true + deploymentPlan: + enableMetricsPlugin: true ``` ### Enable JVM metrics @@ -1011,12 +1009,11 @@ JVM memory metrics are enabled by default. Use the `spec.brokerProperties` field apiVersion: broker.amq.io/v1beta1 kind: ActiveMQArtemis metadata: - name: artemis-jvm + name: artemis-with-metrics spec: console: expose: true deploymentPlan: - size: 1 enableMetricsPlugin: true brokerProperties: - "metricsConfiguration.jvmGc=true" @@ -1026,22 +1023,22 @@ spec: ### Monitor broker metrics by using Prometheus -The operator will expose a containerPort named **wsconj** for the Prometheus to monitor. The following +The operator will expose a port named **console-jolokia** for the Prometheus to monitor. The following is a sample Prometheus ServiceMonitor resource ```yaml apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: example-app + name: artemis-with-metrics-monitor labels: team: prometheus spec: selector: matchLabels: - application: ex-aao-app + application: artemis-with-metrics-app endpoints: - - port: wconsj + - port: console-jolokia ``` For a complete example please refer to this [artemiscloud example](https://github.com/artemiscloud/artemiscloud-examples/tree/main/operator/prometheus). diff --git a/examples/artemis/artemis_metrics_monitor.yaml b/examples/artemis/artemis_metrics_monitor.yaml new file mode 100644 index 000000000..320350b69 --- /dev/null +++ b/examples/artemis/artemis_metrics_monitor.yaml @@ -0,0 +1,19 @@ +apiVersion: broker.amq.io/v1beta1 +kind: ActiveMQArtemis +metadata: + name: artemis-with-metrics +spec: + deploymentPlan: + enableMetricsPlugin: true + size: 2 +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: artemis-with-metrics-monitor +spec: + selector: + matchLabels: + application: artemis-with-metrics-app + endpoints: + - port: console-jolokia