[RabbitMQ][cinder] Listen to messages
Hey there, it seems to me as if ask.openstack.org is down, so I ask my question here: I'd like to listen to oslo messages from cinder as I do for neutron and octavia to know what is going on. For me the following code worked for neutron: EXCHANGE_NAME = os.getenv('EXCHANGE_NAME', 'neutron') ROUTING_KEY = os.getenv('ROUTING_KEY', 'notifications.info') QUEUE_NAME = os.getenv('QUEUE_NAME', 'messaging_queue') BROKER_URI = os.getenv('BROKER_URI', 'UNDEFINED') BROKER_PASSWORD = os.getenv('BROKER_PASSWORD', '') class Messages(ConsumerMixin): def __init__(self, connection): self.connection = connection return def get_consumers(self, consumer, channel): exchange = Exchange(EXCHANGE_NAME, type="topic", durable=False) queue = Queue(QUEUE_NAME, exchange, routing_key=ROUTING_KEY, durable=False, auto_delete=True, no_ack=True) return [consumer(queues=[queue], callbacks=[self.on_message])] def on_message(self, body, message): try: print(message) except Exception as e: log.info(repr(e)) if __name__ == "__main__": log.info("Connecting to broker {}".format(BROKER_URI)) with BrokerConnection(hostname=BROKER_URI, userid='messaging', password=BROKER_PASSWORD, virtual_host='/'+EXCHANGE_NAME, heartbeat=4, failover_strategy='round-robin') as connection: Messaging(connection).run() BrokerConnection.connection.close() But on the cinder vhost (/cinder) I can't find an exchange that the code is working on. (cinder, cinder-backup, .) I tried using the rabbitmq tracer: <https://www.rabbitmq.com/firehose.html> https://www.rabbitmq.com/firehose.html And got all the cinder messages but I don't want to use it in production because of performance issues. Does anyone have an idea how to find the correct exchange for the notification info queue in cinder? Cheers, Merlin
Le ven. 15 nov. 2019 à 10:17, Blom, Merlin, NMU-OI < merlin.blom@bertelsmann.de> a écrit :
Hey there,
it seems to me as if ask.openstack.org is down, so I ask my question here:
I’d like to listen to oslo messages from cinder as I do for neutron and octavia to know what is going on.
For me the following code worked for neutron:
EXCHANGE_NAME = os.getenv('EXCHANGE_NAME', 'neutron')
ROUTING_KEY = os.getenv('ROUTING_KEY', 'notifications.info')
QUEUE_NAME = os.getenv('QUEUE_NAME', 'messaging_queue')
BROKER_URI = os.getenv('BROKER_URI', 'UNDEFINED')
BROKER_PASSWORD = os.getenv('BROKER_PASSWORD', '')
class Messages(ConsumerMixin):
def __init__(self, connection):
self.connection = connection
return
def get_consumers(self, consumer, channel):
exchange = Exchange(EXCHANGE_NAME, type="topic", durable=False)
queue = Queue(QUEUE_NAME, exchange, routing_key=ROUTING_KEY, durable=False, auto_delete=True, no_ack=True)
return [consumer(queues=[queue], callbacks=[self.on_message])]
def on_message(self, body, message):
try:
print(message)
except Exception as e:
log.info(repr(e))
if __name__ == "__main__":
log.info("Connecting to broker {}".format(BROKER_URI))
with BrokerConnection(hostname=BROKER_URI, userid='messaging', password=BROKER_PASSWORD,
virtual_host='/'+EXCHANGE_NAME,
heartbeat=4, failover_strategy='round-robin') as connection:
Messaging(connection).run()
BrokerConnection.connection.close()
But on the cinder vhost (/cinder)
Are you sure cinder use a dedicated vhost? I'm notconviced, if I'm right they all use the default vhost '/'. I can’t find an exchange that the code is working on. (cinder,
cinder-backup, …)
I tried using the rabbitmq tracer: https://www.rabbitmq.com/firehose.html
And got all the cinder messages but I don’t want to use it in production because of performance issues.
Does anyone have an idea how to find the correct exchange for the notification info queue in cinder?
Cheers,
Merlin
-- Hervé Beraud Senior Software Engineer Red Hat - Openstack Oslo irc: hberaud -----BEGIN PGP SIGNATURE----- wsFcBAABCAAQBQJb4AwCCRAHwXRBNkGNegAALSkQAHrotwCiL3VMwDR0vcja10Q+ Kf31yCutl5bAlS7tOKpPQ9XN4oC0ZSThyNNFVrg8ail0SczHXsC4rOrsPblgGRN+ RQLoCm2eO1AkB0ubCYLaq0XqSaO+Uk81QxAPkyPCEGT6SRxXr2lhADK0T86kBnMP F8RvGolu3EFjlqCVgeOZaR51PqwUlEhZXZuuNKrWZXg/oRiY4811GmnvzmUhgK5G 5+f8mUg74hfjDbR2VhjTeaLKp0PhskjOIKY3vqHXofLuaqFDD+WrAy/NgDGvN22g glGfj472T3xyHnUzM8ILgAGSghfzZF5Skj2qEeci9cB6K3Hm3osj+PbvfsXE/7Kw m/xtm+FjnaywZEv54uCmVIzQsRIm1qJscu20Qw6Q0UiPpDFqD7O6tWSRKdX11UTZ hwVQTMh9AKQDBEh2W9nnFi9kzSSNu4OQ1dRMcYHWfd9BEkccezxHwUM4Xyov5Fe0 qnbfzTB1tYkjU78loMWFaLa00ftSxP/DtQ//iYVyfVNfcCwfDszXLOqlkvGmY1/Y F1ON0ONekDZkGJsDoS6QdiUSn8RZ2mHArGEWMV00EV5DCIbCXRvywXV43ckx8Z+3 B8qUJhBqJ8RS2F+vTs3DTaXqcktgJ4UkhYC2c1gImcPRyGrK9VY0sCT+1iA+wp/O v6rDpkeNksZ9fFSyoY2o =ECSj -----END PGP SIGNATURE-----
Thank you for your answer! “Are you sure cinder use a dedicated vhost? I'm notconviced, if I'm right they all use the default vhost '/'.” Indeed it does, when deployed with openstack-ansible. But I found a way to find the exchange with RMQ Tracing: <https://www.rabbitmq.com/firehose.html> https://www.rabbitmq.com/firehose.html Using the GUI plugin I’ve got all the messages flowing through the cinder vhost and found: The exchange for the notification.* queues is “openstack” not cinder. Sometimes I ask myself if there are any kind of standards for RMQ Communication. :P This may be interesting for someone else to use in their projects. Cheers, Merlin Von: Herve Beraud <hberaud@redhat.com> Gesendet: Freitag, 15. November 2019 11:14 An: Blom, Merlin, NMU-OI <merlin.blom@bertelsmann.de> Cc: openstack-discuss@lists.openstack.org Betreff: Re: [RabbitMQ][cinder] Listen to messages Le ven. 15 nov. 2019 à 10:17, Blom, Merlin, NMU-OI <merlin.blom@bertelsmann.de <mailto:merlin.blom@bertelsmann.de> > a écrit : Hey there, it seems to me as if ask.openstack.org <https://urldefense.proofpoint.com/v2/url?u=http-3A__ask.openstack.org&d=DwMFaQ&c=vo2ie5TPcLdcgWuLVH4y8lsbGPqIayH3XbK3gK82Oco&r=hTUN4-Trlb-8Fh11dR6m5VD1uYA15z7v9WL8kYigkr8&m=I57N0pNdOBJT0zInKg9x19EIcAusOh6tWEYae4pqZec&s=BtHoBhYTWHgOaqVzcSWPazamCNRt3zKyin254OCHTv0&e=> is down, so I ask my question here: I’d like to listen to oslo messages from cinder as I do for neutron and octavia to know what is going on. For me the following code worked for neutron: EXCHANGE_NAME = os.getenv('EXCHANGE_NAME', 'neutron') ROUTING_KEY = os.getenv('ROUTING_KEY', 'notifications.info <https://urldefense.proofpoint.com/v2/url?u=http-3A__notifications.info&d=DwMFaQ&c=vo2ie5TPcLdcgWuLVH4y8lsbGPqIayH3XbK3gK82Oco&r=hTUN4-Trlb-8Fh11dR6m5VD1uYA15z7v9WL8kYigkr8&m=I57N0pNdOBJT0zInKg9x19EIcAusOh6tWEYae4pqZec&s=88zOXIjCk6Wj0OZJoyQ3zn7HKlGt_vUabkgC5UbLy8I&e=> ') QUEUE_NAME = os.getenv('QUEUE_NAME', 'messaging_queue') BROKER_URI = os.getenv('BROKER_URI', 'UNDEFINED') BROKER_PASSWORD = os.getenv('BROKER_PASSWORD', '') class Messages(ConsumerMixin): def __init__(self, connection): self.connection = connection return def get_consumers(self, consumer, channel): exchange = Exchange(EXCHANGE_NAME, type="topic", durable=False) queue = Queue(QUEUE_NAME, exchange, routing_key=ROUTING_KEY, durable=False, auto_delete=True, no_ack=True) return [consumer(queues=[queue], callbacks=[self.on_message])] def on_message(self, body, message): try: print(message) except Exception as e: log.info <https://urldefense.proofpoint.com/v2/url?u=http-3A__log.info&d=DwMFaQ&c=vo2ie5TPcLdcgWuLVH4y8lsbGPqIayH3XbK3gK82Oco&r=hTUN4-Trlb-8Fh11dR6m5VD1uYA15z7v9WL8kYigkr8&m=I57N0pNdOBJT0zInKg9x19EIcAusOh6tWEYae4pqZec&s=eBcN-xWc8Px2a6Np6bf9UZ4Um_ODRGrU9YXh6MfJNpg&e=> (repr(e)) if __name__ == "__main__": log.info <https://urldefense.proofpoint.com/v2/url?u=http-3A__log.info&d=DwMFaQ&c=vo2ie5TPcLdcgWuLVH4y8lsbGPqIayH3XbK3gK82Oco&r=hTUN4-Trlb-8Fh11dR6m5VD1uYA15z7v9WL8kYigkr8&m=I57N0pNdOBJT0zInKg9x19EIcAusOh6tWEYae4pqZec&s=eBcN-xWc8Px2a6Np6bf9UZ4Um_ODRGrU9YXh6MfJNpg&e=> ("Connecting to broker {}".format(BROKER_URI)) with BrokerConnection(hostname=BROKER_URI, userid='messaging', password=BROKER_PASSWORD, virtual_host='/'+EXCHANGE_NAME, heartbeat=4, failover_strategy='round-robin') as connection: Messaging(connection).run() BrokerConnection.connection.close() But on the cinder vhost (/cinder) Are you sure cinder use a dedicated vhost? I'm notconviced, if I'm right they all use the default vhost '/'. I can’t find an exchange that the code is working on. (cinder, cinder-backup, …) I tried using the rabbitmq tracer: <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.rabbitmq.com_firehose.html&d=DwMFaQ&c=vo2ie5TPcLdcgWuLVH4y8lsbGPqIayH3XbK3gK82Oco&r=hTUN4-Trlb-8Fh11dR6m5VD1uYA15z7v9WL8kYigkr8&m=I57N0pNdOBJT0zInKg9x19EIcAusOh6tWEYae4pqZec&s=GH8hzzf_x1wZWdtzgEt_LzG7EyhuIYk6z0ReemFPjag&e=> https://www.rabbitmq.com/firehose.html And got all the cinder messages but I don’t want to use it in production because of performance issues. Does anyone have an idea how to find the correct exchange for the notification info queue in cinder? Cheers, Merlin -- Hervé Beraud Senior Software Engineer Red Hat - Openstack Oslo irc: hberaud -----BEGIN PGP SIGNATURE----- wsFcBAABCAAQBQJb4AwCCRAHwXRBNkGNegAALSkQAHrotwCiL3VMwDR0vcja10Q+ Kf31yCutl5bAlS7tOKpPQ9XN4oC0ZSThyNNFVrg8ail0SczHXsC4rOrsPblgGRN+ RQLoCm2eO1AkB0ubCYLaq0XqSaO+Uk81QxAPkyPCEGT6SRxXr2lhADK0T86kBnMP F8RvGolu3EFjlqCVgeOZaR51PqwUlEhZXZuuNKrWZXg/oRiY4811GmnvzmUhgK5G 5+f8mUg74hfjDbR2VhjTeaLKp0PhskjOIKY3vqHXofLuaqFDD+WrAy/NgDGvN22g glGfj472T3xyHnUzM8ILgAGSghfzZF5Skj2qEeci9cB6K3Hm3osj+PbvfsXE/7Kw m/xtm+FjnaywZEv54uCmVIzQsRIm1qJscu20Qw6Q0UiPpDFqD7O6tWSRKdX11UTZ hwVQTMh9AKQDBEh2W9nnFi9kzSSNu4OQ1dRMcYHWfd9BEkccezxHwUM4Xyov5Fe0 qnbfzTB1tYkjU78loMWFaLa00ftSxP/DtQ//iYVyfVNfcCwfDszXLOqlkvGmY1/Y F1ON0ONekDZkGJsDoS6QdiUSn8RZ2mHArGEWMV00EV5DCIbCXRvywXV43ckx8Z+3 B8qUJhBqJ8RS2F+vTs3DTaXqcktgJ4UkhYC2c1gImcPRyGrK9VY0sCT+1iA+wp/O v6rDpkeNksZ9fFSyoY2o =ECSj -----END PGP SIGNATURE-----
participants (2)
-
Blom, Merlin, NMU-OI
-
Herve Beraud