Message System Deployment

The Message Bus is the message system for Moogsoft Enterprise, implemented with RabbitMQ. By default, the Moogsoft Enterprise installation includes with a single RabbitMQ broker running on the same server as the other Moogsoft Enterprise components (LAMs, moogfarmd, the Moolets, etc.). You can also configure Moogsoft Enterprise as a distributed system with multiple RabbitMQ broker hosts.

If you encounter any errors or issues with your deployment see Troubleshooting.

Distributed Deployment

Depending on the systems you monitor, you can increase the performance and reliability of your Moogsoft Enterprise deployment with distributed RabbitMQ brokers running on different hosts. Execute the following procedure on each RabbitMQ broker host to install a distributed messaging system:

  1. Install the Erlang package built by RabbitMQ:

    yum -y install https://github.com/rabbitmq/erlang-rpm/releases/download/v20.1.7/erlang-20.1.7-1.el7.centos.x86_64.rpm
  2. Set up RabbitMQ yum repository:

    curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash
  3. Install RabbitMQ:

    yum -y install rabbitmq-server-3.7.4
  4. Copy rabbitmq.config from $MOOGSOFT_HOME/etc/cots/rabbitmq/rabbitmq.config and add it to the following location on each RabbitMQ broker host:

    /etc/rabbitmq/rabbitmq.config
  5. Run the following commands:

    chkconfig rabbitmq-server on
    service rabbitmq-server start
  6. Create a new zone (a RabbitMQ "vhost") on each remote RabbitMQ broker and set the permissions for the default user:

    rabbitmqctl add_vhost <zone>
    Creating vhost "<zone>" ...
     
    rabbitmqctl add_user moogsoft <password>
    Creating user "moogsoft" ...
    
    rabbitmqctl set_permissions -p <zone> moogsoft ".*" ".*" ".*"
    Setting permissions for user "moogsoft" in vhost "<zone>" ...
  7. Edit the "mooms" section in system.conf on the Moogsoft host system, to point to the correct IP addresses and ports (two specified in the example below):

     "mooms" :
        {
            "zone"     : "<zone>",
            "brokers" : [
                {
                    "host"     : "172.16.87.131",
                    "port"     : 5672
                },
                {
    
                    "host"     : "172.16.87.135",
                    "port"     : 5672
                }
            ]
            ,"username"        : "moogsoft",
            "password"        : "<password>"
        },
Cluster Message Bus Brokers

The Message Bus broker is a logical grouping containing one or more Erlang nodes each running RabbitMQ and sharing vhosts, users, queues etc. If you have multiple RabbitMQ brokers running, you should cluster them.

For more information about broker clustering, refer to the RabbitMQ documentation.

Enable Queue Mirroring

As part of a Moogsoft Enterprise High Availability (HA) deployment that employs message persistence, you must set up mirroring for the relevant durable queues across all nodes in a RabbitMQ cluster.

To enable queue mirroring, run the following command from any host running a broker in the RabbitMQ cluster:

rabbitmqctl set_policy -p <zone> ha-all ".+\.HA" '{"ha-mode":"all"}'

For the <zone>, specify the zone you used when you initialized your system. For example, if the zone is set to Moogsoft Enterprise:

rabbitmqctl set_policy -p MoogsoftAIOps ha-all ".+\.HA" '{"ha-mode":"all"}'

This command configures mirroring for all the *.HA queues across all RabbitMQ brokers in the cluster.

Run the following command from any host running a broker in the RabbitMQ cluster to verify the policy is enabled:

rabbitmqctl -p <zone> list_policies

For example:

rabbitmqctl -p MoogsoftAIOps list_policies
Listing policies for vhost "MoogsoftAIOps" ...
MoogsoftAIOps ha-all .+\.HA all {"ha-mode":"all"} 0

For more information about queue mirroring, refer to the RabbitMQ docs.