Where is the documentation to connect Carbon to RabbitMQ?

Asked by AquaL1te

I'm trying to get data from the message queue of RabbitMQ, but so far unsuccessful.

/etc/rabbitmq/rabbit.config:
[{kernel,[{inet_dist_use_interface,{127,0,0,1}}]}].

/etc/rabbitmq/rabbitmq-env.conf:
export RABBITMQ_NODENAME=rabbit@localhost
export RABBITMQ_NODE_IP_ADDRESS=127.0.0.1
export ERL_EPMD_ADDRESS=127.0.0.1
export RABBITMQ_CONFIG_FILE="/etc/rabbitmq/rabbit"

/etc/carbon/carbon.conf:
AMQP_VERBOSE = True
AMQP_HOST = rabbit@localhost
AMQP_PORT = 5672
AMQP_VHOST = /
AMQP_USER = guest
AMQP_PASSWORD = guest
AMQP_EXCHANGE = graphite
AMQP_METRIC_NAME_IN_BODY = True

Script to push data to RabbitMQ:
#!/usr/bin/env python

import subprocess, time
import pika # imported via a virtual environment (local pip)

def get_data():
    command = subprocess.Popen(["sinfo", "-h", "-a", "-o %F"],
                               stdout=subprocess.PIPE).communicate()[0]
    return(command, int(time.time()))

def sort_data(data):
    data = data.replace("/", " ").rstrip("\n")
    data_l = data.split(" ")
    data_l.remove("")
    return(tuple(data_l))

def send_data(data_s, queue_name, server):
    connection = pika.BlockingConnection(pika.ConnectionParameters(server))
    channel = connection.channel()
    channel.queue_declare(queue=queue_name)
    channel.basic_publish(exchange='amq.direct',
                                   routing_key=queue_name,
                                   body=data_s)
    connection.close()

def main():
    server = "localhost"
    queue_name = "graphite"
    metric_paths = ("rabbitmq.slurm.job_allocation.alloc",
                    "rabbitmq.slurm.job_allocation.idle",
                    "rabbitmq.slurm.job_allocation.other",
                    "rabbitmq.slurm.job_allocation.total")

    data, timestamp = get_data()
    data_t = sort_data(data)

    for metric in range(len(metric_paths)):
        data_s = "%s, %d, %d" % (metric_paths[metric],
                                 int(data_t[metric]), timestamp)
        send_data(data_s, queue_name, server)

if __name__ == "__main__":
    main()

Data is pushed to RabbitMQ:
[root@gtw1 carbon]# rabbitmqctl list_queues
Listing queues ...
graphite 12
...done.

But Carbon doesn't get the data from the queue. I think this has to do with the exchange types. The default in the configuration file is set to 'AMQP_EXCHANGE = graphite', but when I run:
[root@gtw1 carbon]# rabbitmqctl list_exchanges
Listing exchanges ...
        direct
amq.direct direct
amq.fanout fanout
amq.headers headers
amq.match headers
amq.rabbitmq.log topic
amq.rabbitmq.trace topic
amq.topic topic
...done.

I don't get that exchange. I can't find any documentation about this setup. Is there any?

Question information

Language:
English Edit question
Status:
Expired
For:
Graphite Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
AquaL1te (aqual1te) said :
#2

Anybody? My rabbitmq messages aren't being fetched by carbon-cache. My configurations are listed in my initial email.

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.