Prometheus and Grafana with CloudAMQP

Two popular tools exist for long-term monitoring of dedicated CloudAMQP clusters running RabbitMQ version 3.8.0 and above – Prometheus, a monitoring plugin and Grafana, a metrics visualization plugin. When installed together, these two plugins form a powerful system for long-term data collection and monitoring. Let’s take a look at Prometheus and Grafana for RabbitMQ on a CloudAMQP instance.

Prometheus

To enable the Prometheus plugin, from the CloudAMQP Console go to Plugins and enable rabbitmq_prometheus. When enabled, metrics will be exposed on the /metrics endpoint - for example https://[HOST]/metrics

Metrics are exposed in the following format:

# TYPE rabbitmq_connections_opened_total counter
# HELP rabbitmq_connections_opened_total Total number of connections opened
  rabbitmq_connections_opened_total 2
# TYPE rabbitmq_connections_closed_total counter
# HELP rabbitmq_connections_closed_total Total number of connections closed or terminated
  rabbitmq_connections_closed_total 11

Before you get started, we recommend reviewing the Prometheus documentation here.

We also recommend that you install Prometheus on a separate server to your CloudAMQP instance. After the installation of Prometheus, you need to change a couple of values in the prometheus.yml file. The following is an example configuration file with recommendations:

# global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 60 seconds
  scrape_timeout: 15s  # How long until a scrape request times out. Default is 10 seconds
# A list of scrape configurations.
scrape_configs:
  # The job name assigned to scraped metrics by default.
  - job_name: 'cloudamqp'
    basic_auth:
      username: 'USERNAME'
      password: 'PASSWORD'
    scheme: https #necessary for cloudamqp instances
    # metrics_path defaults to '/metrics', which is the one used by cloudamqp instances so no need to define.
    # static_configs allows specifying a list of targets and a common label set for them.
    static_configs:
    - targets: ['your-host-01.rmq.cloudamqp.com', 'your-host-02.rmq.cloudamqp.com']

Those of you running multi-node clusters should make sure you are targeting each node in the cluster, as the example shows. For more ways to configure Prometheus, read the documentation here.

After starting Prometheus, review the targets to make sure they are running without errors. If you are having issues, Prometheus can be started with the option --log.level=debug for debugging.

Grafana

For metrics visualization, install Grafana on a separate server to your CloudAMQP instance. Either download or get a hosted version of Grafana here.

The RabbitMQ core team has created a number of dashboards that can be imported, including those found here. To import a dashboard, follow these steps.

More information from RabbitMQ can be found here.

Feel free to contact us at support@cloudamqp.com if you have any suggestions or feedback.

CloudAMQP - industry leading RabbitMQ as a service

Start your managed cluster today. CloudAMQP is 100% free to try.

13,000+ users including these smart companies