Parsers for RabbitMQ

Parsers included in this module are:

RabbitMQReport - command /usr/sbin/rabbitmqctl report

RabbitMQReportOfContainers - files docker_exec_-t_rabbitmq-bundle-docker-*_rabbitmqctl_report

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: insights.core.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: insights.core.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.

property auto_delete
property consumers
property messages
property name
parse_content(content)[source]

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

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

Bases: insights.core.CommandParser

parse_content(content)[source]

Support StatusOfNode and Permissions Sections only.

Attrbutes:

results(dict): None if encountered an error while parsing. For example:

self.result =
{'nstat': {
    "'rabbit@overcloud-controller-0'": {
        'file_descriptors': {
            'total_used': '967',
            'sockets_used': '965',
            'total_limit': '3996',
            'sockets_limit': '3594'},
        'uptime': '3075485',
        'pid': '6005',
        'disk_free': '259739344896',
        'disk_free_limit': '50000000'},
    "'rabbit@overcloud-controller-1'": {
        'file_descriptors': {
            'total_used': '853',
            'sockets_used': '851',
            'total_limit': '3996',
            'sockets_limit': '3594'},
        'uptime': '3075482',
        'pid': '9304',
        'disk_free': '260561866752',
        'disk_free_limit': '50000000'}}
 'perm': {
    '/': {
        'redhat1': ['redhat.*', '.*', '.*'],
        'guest': ['.*', '.*', '.*'],
        'redhat':['redhat.*', '.*', '.*']},
    'test_vhost': ''}}
class insights.parsers.rabbitmq.RabbitMQReportOfContainers(context, extra_bad_lines=None)[source]

Bases: insights.parsers.rabbitmq.RabbitMQReport

Parse the rabbitmqctl report command of each container running on the host.

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

Bases: insights.core.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