Tuesday, 14 October 2025

Enable Prometheus Data Scraping for RabbitMQ Cluster Deployed with RabbitMQ Cluster Operator on AKS with Managed Prometheus

 Once we have "Setup Managed Prometheus for AKS via Terraform" and  "Set Up RabbitMQ Cluster in AKS Using RabbitMQ Cluster Operator", we can enable monitoring for RabbitMQ in AKS. To enable Prometheus data scraping for RabbitMQ cluster on AKS, we need to deploy a service monitor. Additionally, we can deploy a pod monitor as well to scrape metrics from the RabbitMQ clsuter operator. When data scraping enabled, we would be able to get the metrics data for RabbitMQ as shown below, on Azure managed grafana using Azure managed prometheus on AKS as the data source, via an Azure monitoring workspace.


The metrics data are already made available in RabbitMQ cluster operator via port 9782 with name metrics, when we "Set Up RabbitMQ Cluster Operator and Topology Operator via Azure Pipelines in AKS"


We can enable Prometheus data scraping for RabbitMQ using a pod monitor, which can be deployed with below yaml. Create a yaml file with below content and use kubectl apply to deploy it. Notice that we use azmonitoring.coreos.com as we are using AKS Azure managed Prometheus. 

apiVersion: azmonitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: rabbitmq-cluster-operator
  namespace: rabbitmq-system
spec:
  podMetricsEndpoints:
  - port: metrics
  selector:
    matchLabels:
      app.kubernetes.io/component: rabbitmq-operator
  namespaceSelector:
    matchNames:
    - rabbitmq-system

With the pod monitor deployed we can see metrics such as below from RabbitMQ clsuter operator available in Azure Managed Grafana.


Above setup will only get metrics data from RabbitMQ cluster operator. To get the RabbitMQ cluster metrics we need to use a service monitor. RabbiitMQ cluster pods also expose metrics as shown below via port 15692  with name prometheus, when we "Set Up RabbitMQ Cluster in AKS Using RabbitMQ Cluster Operator".


We have to setup a service monitor as shown below, using , since we are using Azure Managed Prometheus on AKS.

apiVersion: azmonitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: rabbitmq
  namespace: rabbitmq
spec:
  endpoints:
  - port: prometheus
    scheme: http
    interval: 15s
    scrapeTimeout: 14s
  - port: prometheus-tls
    scheme: https
    interval: 15s
    scrapeTimeout: 14s
    tlsConfig:
      insecureSkipVerify: true
  - port: prometheus
    scheme: http
    path: /metrics/detailed
    params:
      family:
        - queue_coarse_metrics
        - queue_metrics
    interval: 15s
    scrapeTimeout: 14s
  - port: prometheus-tls
    scheme: https
    path: /metrics/detailed
    params:
      family:
        - queue_coarse_metrics
        - queue_metrics
    interval: 15s
    scrapeTimeout: 14s
    tlsConfig:
      insecureSkipVerify: true
  selector:
    matchLabels:
      app.kubernetes.io/component: rabbitmq
  namespaceSelector:
    matchNames:
    - rabbitmq

Once setup we will start getting metrics data on Azure Managed Grafana for RabbitMQ cluster on AKS as shown below. In future posts, let's look at how to setup visualizations for monitoring a RabbitMQ cluster deployed on AKS via RabbitMQ cluster operator. Refer to "Setup Managed Prometheus for AKS via Terraform" to see how to allow selecting prometheus datasource dynamically in an Azure managed grafana dashboard.


No comments:

Popular Posts