RabbitMQ
Rapport de recherche Datadog : Bilan sur l'adoption de l'informatique sans serveur Rapport : Bilan sur l'adoption de l'informatique sans serveur

RabbitMQ

Agent Check Check de l'Agent

Supported OS: Linux Mac OS Windows

Dashboard RabbitMQ

Présentation

Ce check permet de surveiller RabbitMQ avec l’Agent Datadog. Il peut être utilisé pour :

  • Surveiller des statistiques liées aux files d’attente : la taille de file d’attente, le nombre de clients, les messages sans accusé de réception, les messages renvoyés, etc.
  • Surveiller des statistiques liées aux nœuds : processus en attente, sockets utilisés, descripteurs de fichiers utilisés, etc.
  • Surveiller la disponibilité et le nombre de connexions des vhosts.

Et plus encore.

Implémentation

Installation

Le check RabbitMQ est inclus avec le paquet de l’Agent Datadog. Vous n’avez donc rien d’autre à installer sur votre serveur.

Configuration

Préparer RabbitMQ

Activez le plug-in de gestion RabbitMQ. Consultez la documentation relative à RabbitMQ pour l’activer. L’utilisateur Agent doit alors au moins disposer du tag monitoring et de ces autorisations :

AutorisationCommande
conf^aliveness-test$
write^amq\.default$
read.*

Créez un utilisateur Agent pour votre vhost par défaut avec les commandes suivantes :

rabbitmqctl add_user datadog <SECRET>
rabbitmqctl set_permissions  -p / datadog "^aliveness-test$" "^amq\.default$" ".*"
rabbitmqctl set_user_tags datadog monitoring

Ici, / correspond au host par défaut. Définissez ce paramètre sur le hostname virtuel que vous avez spécifié. Consultez la documentation relative à RabbitMQ pour en savoir plus.

Host

Suivez les instructions ci-dessous pour installer et configurer ce check lorsque l’Agent est exécuté sur un host. Consultez la section Environnement conteneurisé pour en savoir plus sur les environnements conteneurisés.

Collecte de métriques
  1. Modifiez le fichier rabbitmq.d/conf.yaml dans le dossier conf.d/ à la racine du répertoire de configuration de votre Agent pour commencer à recueillir vos métriques RabbitMQ. Consultez le fichier d’exemple rabbitmq.d/conf.yaml pour découvrir toutes les options de configuration disponibles.

    init_config:
    
    instances:
     ## @param rabbit_api_url - string - required
     ## For every instance a 'rabbitmq_api_url' must be provided, pointing to the api
     ## url of the RabbitMQ Managment Plugin (http://www.rabbitmq.com/management.html).
     #
     - rabbitmq_api_url: http://localhost:15672/api/

    Remarque : par défaut, l’Agent effectue des checks sur toutes les files d’attente, tous les vhosts et tous les nœuds, mais vous pouvez définir des listes ou des expressions régulières pour limiter ce comportement. Consultez le fichier rabbitmq.d/conf.yaml pour découvrir des exemples.

  2. Redémarrez l’Agent.

Collecte de logs

Disponible à partir des versions > 6.0 de l’Agent

  1. Pour modifier l’emplacement du fichier de log par défaut, définissez la variable d’environnement RABBITMQ_LOGS ou ajoutez ces lignes à votre fichier de configuration RabbitMQ (/etc/rabbitmq/rabbitmq.conf) :

     log.dir = /var/log/rabbit
     log.file = rabbit.log
  2. La collecte de logs est désactivée par défaut dans l’Agent Datadog. Vous devez l’activer dans datadog.yaml :

    logs_enabled: true
  3. Ajoutez ce bloc de configuration à votre fichier rabbitmq.d/conf.yaml pour commencer la collecte de vos logs RabbitMQ :

    logs:
     - type: file
       path: /var/log/rabbit/*.log
       source: rabbitmq
       service: myservice
       log_processing_rules:
         - type: multi_line
           name: logs_starts_with_equal_sign
           pattern: "="
  4. Redémarrez l’Agent.

Environnement conteneurisé

Consultez la documentation relative aux modèles d’intégration Autodiscovery pour découvrir comment appliquer les paramètres ci-dessous à un environnement conteneurisé.

Collecte de métriques
ParamètreValeur
<NOM_INTÉGRATION>rabbitmq
<CONFIG_INIT>vide ou {}
<CONFIG_INSTANCE>{"rabbitmq_api_url":"%%host%%:15672/api/"}
Collecte de logs

Disponible à partir des versions > 6.0 de l’Agent

La collecte des logs est désactivée par défaut dans l’Agent Datadog. Pour l’activer, consultez la section Collecte de logs avec Kubernetes.

ParamètreValeur
<CONFIG_LOG>{"source": "rabbitmq", "service": "rabbitmq", "log_processing_rules": {"type":"multi_line","name":"logs_starts_with_equal_sign", "pattern": "="}}

Validation

Lancez la sous-commande status de l’Agent et cherchez rabbitmq dans la section Checks.

Données collectées

Métriques

rabbitmq.node.fd_used
(gauge)
Used file descriptors
rabbitmq.node.disk_free
(gauge)
Current free disk space
Shown as byte
rabbitmq.node.mem_used
(gauge)
Memory used in bytes
Shown as byte
rabbitmq.node.mem_limit
(gauge)
Memory usage high watermark in bytes
Shown as byte
rabbitmq.node.run_queue
(gauge)
Average number of Erlang processes waiting to run
Shown as process
rabbitmq.node.sockets_used
(gauge)
Number of file descriptors used as sockets
rabbitmq.node.partitions
(gauge)
Number of network partitions this node is seeing
rabbitmq.node.running
(gauge)
Is the node running or not
rabbitmq.node.mem_alarm
(gauge)
Does the host has memory alarm
rabbitmq.node.disk_alarm
(gauge)
Does the node have disk alarm
rabbitmq.exchange.messages.ack.count
(gauge)
Number of messages in exchanges delivered to clients and acknowledged
Shown as message
rabbitmq.exchange.messages.ack.rate
(gauge)
Rate of messages in exchanges delivered to clients and acknowledged per second
Shown as message
rabbitmq.exchange.messages.confirm.count
(gauge)
Count of messages in exchanges confirmed
Shown as message
rabbitmq.exchange.messages.confirm.rate
(gauge)
Rate of messages in exchanges confirmed per second
Shown as message
rabbitmq.exchange.messages.deliver_get.count
(gauge)
Sum of messages in exchanges delivered in acknowledgement mode to consumers, in no-acknowledgement mode to consumers, in acknowledgement mode in response to basic.get, and in no-acknowledgement mode in response to basic.get
Shown as message
rabbitmq.exchange.messages.deliver_get.rate
(gauge)
Rate per second of the sum of exchange messages delivered in acknowledgement mode to consumers, in no-acknowledgement mode to consumers, in acknowledgement mode in response to basic.get, and in no-acknowledgement mode in response to basic.get
Shown as message
rabbitmq.exchange.messages.redeliver.count
(gauge)
Count of subset of messages in exchanges in deliver_get which had the redelivered flag set
Shown as message
rabbitmq.exchange.messages.redeliver.rate
(gauge)
Rate of subset of messages in exchanges in deliver_get which had the redelivered flag set per second
Shown as message
rabbitmq.exchange.messages.return_unroutable.count
(gauge)
Count of messages in exchanges returned to publisher as unroutable
Shown as message
rabbitmq.exchange.messages.return_unroutable.rate
(gauge)
Rate of messages in exchanges returned to publisher as unroutable per second
Shown as message
rabbitmq.exchange.messages.publish.count
(gauge)
Count of messages in exchanges published
Shown as message
rabbitmq.exchange.messages.publish.rate
(gauge)
Rate of messages in exchanges published per second
Shown as message
rabbitmq.exchange.messages.publish_in.count
(gauge)
Count of messages published from channels into this exchange
Shown as message
rabbitmq.exchange.messages.publish_in.rate
(gauge)
Rate of messages published from channels into this exchange per sec
Shown as message
rabbitmq.exchange.messages.publish_out.count
(gauge)
Count of messages published from this exchange into queues
Shown as message
rabbitmq.exchange.messages.publish_out.rate
(gauge)
Rate of messages published from this exchange into queues per second
Shown as message
rabbitmq.queue.active_consumers
(gauge)
Number of active consumers, consumers that can immediately receive any messages sent to the queue
rabbitmq.queue.bindings.count
(gauge)
Number of bindings for a specific queue
rabbitmq.queue.consumers
(gauge)
Number of consumers
rabbitmq.queue.consumer_utilisation
(gauge)
The ratio of time that a queue's consumers can take new messages
Shown as fraction
rabbitmq.queue.head_message_timestamp
(gauge)
Timestamp of the head message of the queue
Shown as millisecond
rabbitmq.queue.memory
(gauge)
Bytes of memory consumed by the Erlang process associated with the queue, including stack, heap and internal structures
Shown as byte
rabbitmq.queue.messages
(gauge)
Count of the total messages in the queue
Shown as message
rabbitmq.queue.messages.rate
(gauge)
Count per second of the total messages in the queue
Shown as message
rabbitmq.queue.messages_ready
(gauge)
Number of messages ready to be delivered to clients
Shown as message
rabbitmq.queue.messages_ready.rate
(gauge)
Number per second of messages ready to be delivered to clients
Shown as message
rabbitmq.queue.messages_unacknowledged
(gauge)
Number of messages delivered to clients but not yet acknowledged
Shown as message
rabbitmq.queue.messages_unacknowledged.rate
(gauge)
Number per second of messages delivered to clients but not yet acknowledged
Shown as message
rabbitmq.queue.messages.ack.count
(gauge)
Number of messages in queues delivered to clients and acknowledged
Shown as message
rabbitmq.queue.messages.ack.rate
(gauge)
Number per second of messages delivered to clients and acknowledged
Shown as message
rabbitmq.queue.messages.deliver.count
(gauge)
Count of messages delivered in acknowledgement mode to consumers
Shown as message
rabbitmq.queue.messages.deliver.rate
(gauge)
Rate of messages delivered in acknowledgement mode to consumers
Shown as message
rabbitmq.queue.messages.deliver_get.count
(gauge)
Sum of messages in queues delivered in acknowledgement mode to consumers, in no-acknowledgement mode to consumers, in acknowledgement mode in response to basic.get, and in no-acknowledgement mode in response to basic.get.
Shown as message
rabbitmq.queue.messages.deliver_get.rate
(gauge)
Rate per second of the sum of messages in queues delivered in acknowledgement mode to consumers, in no-acknowledgement mode to consumers, in acknowledgement mode in response to basic.get, and in no-acknowledgement mode in response to basic.get.
Shown as message
rabbitmq.queue.messages.publish.count
(gauge)
Count of messages in queues published
Shown as message
rabbitmq.queue.messages.publish.rate
(gauge)
Rate per second of messages published
Shown as message
rabbitmq.queue.messages.redeliver.count
(gauge)
Count of subset of messages in queues in deliver_get which had the redelivered flag set
Shown as message
rabbitmq.queue.messages.redeliver.rate
(gauge)
Rate per second of subset of messages in deliver_get which had the redelivered flag set
Shown as message
rabbitmq.connections
(gauge)
Number of current connections to a given rabbitmq vhost, tagged 'rabbitmq_vhost:'
Shown as connection
rabbitmq.connections.state
(gauge)
Number of connections in the specified connection state
Shown as connection
rabbitmq.overview.object_totals.connections
(gauge)
Total number of connections
Shown as connection
rabbitmq.overview.object_totals.channels
(gauge)
Total number of channels
Shown as item
rabbitmq.overview.object_totals.queues
(gauge)
Total number of queues
Shown as item
rabbitmq.overview.object_totals.consumers
(gauge)
Total number of consumers
Shown as item
rabbitmq.overview.queue_totals.messages.count
(gauge)
Total number of messages (ready plus unacknowledged)
Shown as message
rabbitmq.overview.queue_totals.messages.rate
(gauge)
Rate of number of messages (ready plus unacknowledged)
Shown as message
rabbitmq.overview.queue_totals.messages_ready.count
(gauge)
Number of messages ready for delivery
Shown as message
rabbitmq.overview.queue_totals.messages_ready.rate
(gauge)
Rate of number of messages ready for delivery
Shown as message
rabbitmq.overview.queue_totals.messages_unacknowledged.count
(gauge)
Number of unacknowledged messages
Shown as message
rabbitmq.overview.queue_totals.messages_unacknowledged.rate
(gauge)
Rate of number of unacknowledged messages
Shown as message
rabbitmq.overview.messages.ack.count
(gauge)
Number of messages delivered to clients and acknowledged
Shown as message
rabbitmq.overview.messages.ack.rate
(gauge)
Rate of messages delivered to clients and acknowledged per second
Shown as message
rabbitmq.overview.messages.confirm.count
(gauge)
Count of messages confirmed
Shown as message
rabbitmq.overview.messages.confirm.rate
(gauge)
Rate of messages confirmed per second
Shown as message
rabbitmq.overview.messages.deliver_get.count
(gauge)
Sum of messages delivered in acknowledgement mode to consumers, in no-acknowledgement mode to consumers, in acknowledgement mode in response to basic.get, and in no-acknowledgement mode in response to basic.get
Shown as message
rabbitmq.overview.messages.deliver_get.rate
(gauge)
Rate per second of the sum of messages delivered in acknowledgement mode to consumers, in no-acknowledgement mode to consumers, in acknowledgement mode in response to basic.get, and in no-acknowledgement mode in response to basic.get
Shown as message
rabbitmq.overview.messages.redeliver.count
(gauge)
Count of subset of messages in deliver_get which had the redelivered flag set
Shown as message
rabbitmq.overview.messages.redeliver.rate
(gauge)
Rate of subset of messages in deliver_get which had the redelivered flag set per second
Shown as message
rabbitmq.overview.messages.return_unroutable.count
(gauge)
Count of messages returned to publisher as unroutable
Shown as message
rabbitmq.overview.messages.return_unroutable.rate
(gauge)
Rate of messages returned to publisher as unroutable per second
Shown as message
rabbitmq.overview.messages.publish.count
(gauge)
Count of messages published
Shown as message
rabbitmq.overview.messages.publish.rate
(gauge)
Rate of messages published per second
Shown as message
rabbitmq.overview.messages.publish_in.count
(gauge)
Count of messages published from channels into this overview
Shown as message
rabbitmq.overview.messages.publish_in.rate
(gauge)
Rate of messages published from channels into this overview per sec
Shown as message
rabbitmq.overview.messages.publish_out.count
(gauge)
Count of messages published from this overview into queues
Shown as message
rabbitmq.overview.messages.publish_out.rate
(gauge)
Rate of messages published from this overview into queues per second
Shown as message

L’Agent tague les métriques rabbitmq.queue.* par nom de file d’attente et les métriques rabbitmq.node.* par nom de nœud.

Événements

Pour des raisons de performances, le check RabbitMQ limite le nombre d’exchanges, de files d’attente et de nœuds pour lesquels il recueille des métriques. Si le check se rapproche de cette limite, il envoie un événement de type warning sur votre flux d’événements.

Si vous avez besoin d’augmenter le nombre d’exchanges, de files d’attente ou de nœuds, contactez l’assistance Datadog.

Checks de service

rabbitmq.aliveness:
L’Agent envoie ce check de service pour tous les vhosts (si vhosts n’est pas configuré) OU pour un sous-ensemble de vhosts (ceux qui sont configurés dans vhosts). Chaque check de service se voit attribuer le tag vhost:<nom_vhost>. Renvoie CRITICAL en cas d’échec du check de disponibilité. Si ce n’est pas le cas, renvoie OK.

rabbitmq.status: Renvoie CRITICAL si l’Agent n’est pas capable de se connecter à RabbitMQ pour recueillir des métriques. Si ce n’est pas le cas, renvoie OK.

Dépannage

Besoin d’aide ? Contactez l’assistance Datadog.

Pour aller plus loin

Documentation, liens et articles supplémentaires utiles :

Blog Datadog

FAQ