Magnolia 5.5 reached end of life on November 15, 2019. This branch is no longer supported, see End-of-life policy.
In this page we explain how to add monitoring to your RabbitMQ configuration.
In the scenario below:
Make sure the
magnolia-rabbitmq-monitoring
module is installed.
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.
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
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:
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. |
| optional ACK client node. |
| required Exchange configuration node. |
| required Queue configuration list node. |
| required Name of the ACT exchange. |
| required Exchange type. See AMQP 0-9-1 Model Explained for more. |
| required Consumer definitions node. |
| required ACK consumer node. |
| optional The name of the ACK exchange to use. |
| required Name of the client to use. |
| required Consumer class to use. ConfirmationConsumerJob : Confirmation consumer job. |
| optional Enables and disables the ACK consumer. Toggling this property shuts down and restarts the consumer. |
| required Name of the consumer. |
| required Name of the queue to monitor. |
| optional , default is true Set to false to stop receiving messages containing the status of activations. |
| required/optional See Configuring the RabbitMQ connector for details. |
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 |
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 from, monitoring and controlling the activation status
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.
|
| required Sequence number. |
| required Time stamp. |
| required Topo tag. |
rest-endpoints | optional REST endpoints folder. |
| optional SyncState node. |
| required REST endpoint class. ConfiguredCommandEndpointDefinition : Command endpoint definition that adds a white-list for enabled commands. |
| required REST endpoint implementation class. SyncStateRestService : Provides sync status of activation by REST. |
To enable the service:
rest
role: Access control lists:
Workspace | Permission | Scope | Path |
Config | Read only | Selected and sub nodes | /rabbitmq-activation |
Web access:
Permission | Path |
Get & Post | .rest/syncstate/state
|
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":""}
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. |
| optional Pub state node. |
| required REST endpoint class. ConfiguredCommandEndpointDefinition : Command endpoint definition that adds a white-list for enabled commands. |
| required REST endpoint implementation class. PublicMonitoringService : Provides public monitoring status by REST. |
To enable the service:
rest
role: Access control lists:
Workspace | Permission | Scope | Path |
PblcMntrng | Read only | Selected and sub nodes | / |
Web access:
Permission | Path |
Get & Post | .rest/public-monitoring* |
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:
workspace | Workspace of last activated node. |
| IP of consuming instance. |
name | hostName of consuming instance. |
syncStamp | Time stamp of last activated node. |
diff | Difference on seqNbr with other instances who activated a similar node. |
| UUID of last activated node. |
seqNbr | Sequence number of last activated node. |
exceptions | Errors. |
You can access the monitoring screen at
http://localhost:8080/.resources/magnolia-rabbitmq-monitoring/webresources/visualisations/public_monitoring.html
or in the Public Monitoring app.
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. |
| optional Consumer node. |
| required REST endpoint class. ConfiguredCommandEndpointDefinition : Command endpoint definition that adds a white-list for enabled commands. |
| required REST endpoint implementation class. ClientControlRestService : Provides RabbitMQ client control by REST. |
To enable the service:
rest
role: Web access:
Permission | Path |
Get & Post | .rest/rbmqClients*
|
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.