In this page we explain how to add monitoring to your RabbitMQ configuration.

In the scenario below:

  • A simple fan out pattern is used from one Magnolia author instance to N public instances.
  • Acknowledgements are not delegated to RabbitMQ. Instead, notifications of activation success or failure are sent back to the author instance from the consumers.
  • The AMQP 0-9-1 (Advanced Message Queuing Protocol) messaging protocol is used.

Make sure the  magnolia-rabbitmq-monitoring  module is installed.


Public Monitoring app

The RabbitMQ Monitoring module includes the Public Monitoring app and the Public monitoring REST service

In the Public Monitoring app can can follow the state of any instance that is consuming on a queue. The app will return information messages containing the status of activations, provided the ACK exchange is configured correctly, 

The monitoring app shows you all activations and their state for each user.

  • IOA – Message in queue not yet received by consumer but sent by author.
  • BOA – Beginning of activation, message received by consumer, nodes will be consumed shortly after.
  • EOA – End of activation, message consumed and reemitted after all nodes were successfully consumed.
  • EXA – Exceptions on activation, nodes were not processed correctly and the consumer sent the exceptions to the author before shutting itself down.

If an activation fails, the message is put back into the queue and an exception is pushed into the ackQueue. The consumer is then stopped allowing you to fix the problem and to remove the faulty instance from the load balancer. There are techniques to fix the problem which are discussed in ACK queue blocked by unacked node

Configuring monitoring

For monitoring to function correctly the ACK client needs to be configured and enabled and the monitoring module installed. 

Monitoring is configured on the instance responsible for monitoring, typically the author or producing instance.

Configuration involves three steps:

  1. Configuring the ACK client.
  2. Adding the ACK exchange name to the activation consumer definition
  3. Configuring REST endpoints.

Configuring the ACK client

The ACK client is configured in the connector module.

The example ACK client configuration is in /modules/rabbitmq-connector/rabbitmq-client/ackClient/consumerDefinitions/ackConsumer.

Node name

Value

 rabbitmq-connector


 rabbitmq-client


 ackClient


 exchangeConfig


 queueConfigList


 name

actExchange

 type

direct 

 consumerDefinitions


 ackConsumer


 ackExchangeName

 -

 clientName

ack-client

 consumerClass

info.magnolia.rabbitmq.consumers.ConfirmationConsumerJob 

 enabled

false

 name

confirmConsumer

 queueName

ackQueue

 notifyUserOnStatus

true

 clientName

ack-client

 enabled

false 

 hostName

localhost 

 password

guest 

 portNumber

5672 

 userName

guest 

 virtualHost

Properties: 

rabbitmq-client

required

RabbitMQ client folder.

ackClient

optional

ACK client node.

exchangeConfig

required

Exchange configuration node.

queueConfigList

required

Queue configuration list node.

name

required

Name of the ACT exchange.

type

required

Exchange type. See AMQP 0-9-1 Model Explained for more.

consumerDefinitions

required

Consumer definitions node.

ackConsumer

required

ACK consumer node.

ackExchangeName

optional

The name of the ACK exchange to use.

clientName

required

Name of the client to use.

consumerClass

required

Consumer class to use.

ConfirmationConsumerJob : Confirmation consumer job.

enabled

optional

Enables and disables the ACK consumer. Toggling this property shuts down and restarts the consumer.

name

required

Name of the consumer.

queueName

required

Name of the queue to monitor.

notifyUserOnStatus

optional , default is true

Set to false to stop receiving messages containing the status of activations.

<client properties>

required/optional

See Configuring the RabbitMQ connector for details.

Adding the ACK exchange name

The next step to configuring monitoring is to link the ACT client in the the activation consumer definition

To do this add the actExchangeName to the activation consumer definition in /modules/rabbitmq-connector/rabbitmq-client/sampleClient/consumerDefinitions/activationConsumer/ackExchangeName, for example.

Node name

Value

 sampleClient


 consumerDefinitions


 activationConsumer


 ackExchangeName

ackExchange

 clientName

sample-client

 consumerClass

info.magnolia.rabbitmq.activation.jobs.ActivationConsumerJob 

 enabled

true

 name

activationConsumer

 queueName

fan1 

 verifyAuthorSignature

false

Configuring REST endpoints

The final step to configuring monitoring is to configure REST endpoints and add the access rights to them. Permissions to issue REST requests are controlled by Magnolia's standard role-based security mechanism.

REST endpoints are used for getting information frommonitoring and controlling the activation status

SyncState REST service

The SyncState REST service allows you to get the current state of activation immediately (without checking the ACK return queue). 

The service is configured in the activation module in /modules/rabbitmq-activation/rest-endpoints/syncstate.

Node name

Value

 rabbitmq-activation


 syncNode


 seq_nbr

2,012

 stamp

1,467,280,192,928

 topo_tag

-

 rest-endpoints


 syncstate


 class

info.magnolia.rest.service.command.definition.ConfiguredCommandEndpointDefinition

 implementationClass

info.magnolia.rabbitmq.activation.rest.SyncStateRestService

Properties:

syncNode

required

Sync node node.

(warning) The properties in this node are updated automatically. They are not for configuration purposes. We recommend you do not edit them.

seq_nbr

required

Sequence number.

stamp

required

Time stamp.

topo_tag

required

Topo tag.

rest-endpoints

optional

REST endpoints folder.

syncstate

optional

SyncState node.

class

required

REST endpoint class.

ConfiguredCommandEndpointDefinition : Command endpoint definition that adds a white-list for enabled commands.

implementationClass

required

REST endpoint implementation class.

SyncStateRestService : Provides sync status of activation by REST.

To enable the service:

  1. In the Security app add the following permissions to the rest role: 

    Access control lists:

    WorkspacePermissionScopePath
    ConfigRead onlySelected and sub nodes/rabbitmq-activation

    Web access:

    PermissionPath
    Get & Post.rest/syncstate/state
  2. Assign the rest role to a user or to anonymous if you need access without credentials. 

You can use the REST endpoint as follows:

curl http://publicaddress:publicport/.rest/syncstate/state

You should get the following (example):

{"seqNbr":2011,"stamp":1467280192928,"topoTag":""}

Public monitoring REST service

The Public monitoring REST service allows you to get the results of all consuming instances returning messages on the ACK queue. This service is used by the Public Monitoring app.

The service is configured in the monitoring module in /modules/magnolia-rabbitmq-monitoring/rest-endpoints/pubstate.

Node name

Value

 magnolia-rabbitmq-monitoring


 rest-endpoints


 pubstate


 class

info.magnolia.rest.service.command.definition.ConfiguredCommandEndpointDefinition

 implementationClass

info.magnolia.rabbitmq.rest.PublicMonitoringService

Properties:

rest-endpoints

optional

REST endpoints folder.

pubstate

optional

Pub state node.

class

required

REST endpoint class.

ConfiguredCommandEndpointDefinition : Command endpoint definition that adds a white-list for enabled commands.

implementationClass

required

REST endpoint implementation class.

PublicMonitoringService : Provides public monitoring status by REST.

To enable the service:

  1. In the Security app add the following permissions to the rest role: 

    Access control lists:

    WorkspacePermissionScopePath
    PblcMntrngRead onlySelected and sub nodes/

    Web access:

    PermissionPath
    Get & Post.rest/public-monitoring*
  2. Assign the rest role to a user or to anonymous if you need access without credentials.

You can use the REST endpoint as follows:

curl http://monitoringinstance:port/.rest/public-monitoring/all

This should return something like:

[{"workspace":"dam","address":"192.168.10.85","name":"administrators-MacBook-Pro.local","syncStamp":"1466422838236","diff":"0","uuid":"2acd7055-7168-4926-b66a-47400ab78d2e","seqNbr":"1977","exceptions":"{}"}]

Properties:

workspaceWorkspace of last activated node.

address

IP of consuming instance.
namehostName of consuming instance.
syncStampTime stamp of last activated node.
diffDifference on seqNbr with other instances who activated a similar node.

uuid

UUID of last activated node.
seqNbrSequence number of last activated node.
exceptionsErrors.

Client control REST service

The client control REST service allows you to restart the consumer on the remote instance via a cURL command.

The service is configured in the connector module in /modules/rabbitmq-connector/rest-endpoints/consumer.

Node name

Value

 rabbitmq-connector


 rest-endpoints


 consumer


 class

info.magnolia.rest.service.command.definition.ConfiguredCommandEndpointDefinition

 implementationClass

info.magnolia.rabbitmq.activation.rest.ClientControlRestService

Properties:

rest-endpoints

optional

REST endpoints folder.

consumer

optional

Consumer node.

class

required

REST endpoint class.

ConfiguredCommandEndpointDefinition : Command endpoint definition that adds a white-list for enabled commands.

implementationClass

required

REST endpoint implementation class.

ClientControlRestService : Provides RabbitMQ client control by REST.

To enable the service:

  1. In the Security app add the following permission to the rest role: 

    Web access:

    PermissionPath
    Get & Post.rest/rbmqClients*
  2. Assign the rest role to a user or to anonymous if you need access without credentials.

You can use the REST endpoint as follows:

curl http://publicaddress:publicport/.rest/rbmqClients/restartAll

The command will restart all consumers and clients on that instance.


#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels