Parsers for RabbitMQ

Parsers included in this module are:

RabbitMQUsers - command /usr/sbin/rabbitmqctl list_users

RabbitMQQueues - command /usr/sbin/rabbitmqctl list_queues name messages consumers auto_delete

RabbitMQEnv - file /etc/rabbitmq/rabbitmq-env.conf

class insights.parsers.rabbitmq.RabbitMQEnv(context)[source]

Bases: SysconfigOptions

Parse the content of file /etc/rabbitmq/rabbitmq-env.conf using the SysconfigOptions base class.

Sample content of the file /etc/rabbitmq/rabbitmq-env.conf:

RABBITMQ_SERVER_ERL_ARGS="+K true +P 1048576 -kernel inet_default_connect_options [{nodelay,true},{raw,6,18,<<5000:64/native>>}] -kernel inet_default_listen_options [{raw,6,18,<<5000:64/native>>}]"

Example

>>> rabbitmq_env.rabbitmq_server_erl_args
'+K true +P 1048576 -kernel inet_default_connect_options [{nodelay,true},{raw,6,18,<<5000:64/native>>}] -kernel inet_default_listen_options [{raw,6,18,<<5000:64/native>>}]'
>>> rabbitmq_env.data['RABBITMQ_SERVER_ERL_ARGS']
'+K true +P 1048576 -kernel inet_default_connect_options [{nodelay,true},{raw,6,18,<<5000:64/native>>}] -kernel inet_default_listen_options [{raw,6,18,<<5000:64/native>>}]'
>>> rabbitmq_env.rmq_erl_tcp_timeout
'5000'
rabbitmq_server_erl_args

If RABBITMQ_SERVER_ERL_ARGS otherwise None.

Type:

str

rmq_erl_tcp_timeout

If value of inet_default_connect_options equals value of inet_default_listen_options. Otherwise None.

Type:

str

class insights.parsers.rabbitmq.RabbitMQQueues(context, extra_bad_lines=None)[source]

Bases: CommandParser

Parse the output of the rabbitmqctl list_queues command.

The actual command is rabbitmqctl list_queues name messages consumers auto_delete.

The four columns that are output are:

  1. name - The name of the queue with non-ASCII characters escaped as in C.

  2. messages - Sum of ready and unacknowledged messages (queue depth).

  3. consumers - Number of consumers.

  4. auto_delete - Whether the queue will be deleted automatically when no longer used.

The output of the command looks like:

cinder-scheduler        0       3       false
cinder-scheduler.ha-controller  0       3       false
cinder-scheduler_fanout_ea9c69fb630f41b2ae6120eba3cd43e0        8141    1   true
cinder-scheduler_fanout_9aed9fbc3d4249289f2cb5ea04c062ab        8145    0   true
cinder-scheduler_fanout_b7a2e488f3ed4e1587b959f9ac255b93        8141    0   true

Examples

>>> queues.data[0]
QueueInfo(name='cinder-scheduler', messages=0, consumers=3, auto_delete=False)
>>> queues.data[0].name
'cinder-scheduler'
>>> queues.data[1].name
'cinder-scheduler.ha-controller'
Raises:
  • ParseException -- Raised if the data indicates an error in acquisition or if the auto_delete value is not true or false.

  • ValueError -- Raised if any of the numbers are not valid numbers

class QueueInfo(name, messages, consumers, auto_delete)

Bases: tuple

namedtuple: Structure to hold a line of RabbitMQ queue information.

auto_delete
consumers
messages
name
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.rabbitmq.RabbitMQUsers(context, extra_bad_lines=None)[source]

Bases: CommandParser

parse_content(content)[source]

This method must be implemented by classes based on this class.

insights.parsers.rabbitmq.TRUE_FALSE = {'false': False, 'true': True}

Dictionary for converting true/false strings to bool.

Type:

dict