7.3.1 • Published 12 months ago

redis-smq-monitor v7.3.1

Weekly downloads
301
License
MIT
Repository
github
Last release
12 months ago

RedisSMQ Monitor

RedisSMQ Monitor is an application which lets you monitor, debug, and manage RedisSMQ message queue.

The monitor uses and ships with RedisSMQ Monitor Client as a default Web UI client.

An HTTP API is also provided. The HTTP API interface enables you to manage the message queue from your application using the HTTP protocol.

Installation

npm install redis-smq-common redis-smq redis-smq-monitor --save

Considerations:

  • Minimal Node.js version is >= 14 (RedisSMQ Monitor is tested under current active LTS and maintenance LTS Node.js releases).
  • Minimal Redis server version is 2.6.12 (RedisSMQ Monitor is tested under Redis v2.6, v3, v4, v5, and v6).

Configuration

The monitor configuration extends RedisSMQ Configuration with additional parameters.

'use strict';
const { ConsumerEventListener, ProducerEventListener } = require('redis-smq-monitor');

module.exports = {
  namespace: 'testing',
  redis: {
    client: 'redis',
    options: {
      host: '127.0.0.1',
      port: 6379,
      connect_timeout: 3600000,
    },
  },
  logger: {
    enabled: true,
    options: {
      level: 'info',
      /*
      streams: [
          {
              path: path.normalize(`${__dirname}/../logs/redis-smq-monitor.log`)
          },
      ],
      */
    },
  },
  eventListeners: {
    consumerEventListeners: [ConsumerEventListener],
    producerEventListeners: [ProducerEventListener],
  },
  server: {
    host: '127.0.0.1',
    port: 3000,
    socketOpts: {
      // ...
    }
  }
};

Parameters

Usage

Before launching the monitor server, you should first configure RedisSMQ to use the monitor event listeners.

RedisSMQ Monitor comes with a couple of event listeners that you need to register within RedisSMQ for having such features as:

  • Real-time message rates:
    • Overall acknowledged/dead-lettered/published message rates
    • Acknowledged/dead-lettered/published message rates per queue
    • Acknowledged/dead-lettered/published message rates per queue/consumer
  • Historical time series graphs of message rate with the ability to navigate through the timeline

Monitor Event Listeners

The monitor provides:

  • ConsumerEventListener for handling consumers message rates.
  • ProducerEventListener for handling producers message rates.
const { ConsumerEventListener, ProducerEventListener } = require('redis-smq-monitor');

const config = {
  eventListeners: {
    consumerEventListeners: [ConsumerEventListener],
    producerEventListeners: [ProducerEventListener],
  },
}

See RedisSMQ/Configuration for more details. See RedisSMQ/Event Listeners for more details.

Launching the monitor application

Once your consumers/producers are now using the plugins, the monitor can be launched from any other process or host (as well as the host can access the Redis server) and used as shown in the example bellow:

'use strict';
const config = require('./config');
const { MonitorServer } = require('redis-smq-monitor');

const monitorServer = MonitorServer.createInstance(config);
monitorServer.listen();

Running RedisSMQ Monitor behind a reverse proxy

To run the monitor behind a reverse proxy server you need first to configure correctly your server.

Depending on your setup, some extra steps may be required. The easiest way to start with is to serve the monitor using a transparent proxy.

I am using Nginx as a proxy server, but you can use any other server depending on your preferences.

Transparent reverse proxy

Sample Nginx configuration:

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}
upstream redis-smq {
    server 127.0.0.1:3000;
}
server {
    listen       5000;
    listen  [::]:5000;
    location / {
        proxy_pass http://redis-smq;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
}

No additional configuration is required.

Reverse proxy with URL rewrite

Sample Nginx configuration:

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}
upstream redis-smq {
    server 127.0.0.1:3000;
}
server {
    listen       5000;
    listen  [::]:5000;
    location /monitor {
        proxy_pass http://redis-smq;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        rewrite  ^/monitor/(.*)  /$1 break;
    }
}

Additionally, you need to configure the basePath.

Sample configuration:

'use strict';

module.exports = {
  server: {
    host: '127.0.0.1',
    port: 3000,
    basePath: '/monitor' // <-- using the base path
  }
};

License

MIT

7.3.1

12 months ago

7.3.0

1 year ago

7.1.1

2 years ago

7.2.1

1 year ago

7.2.0

1 year ago

7.1.0

2 years ago

7.0.7

2 years ago

7.0.6

2 years ago

7.0.5

2 years ago

7.0.0-rc.4

2 years ago

7.0.0-rc.3

2 years ago

7.0.0-rc.5

2 years ago

7.0.0-rc.2

2 years ago

7.0.0-rc.1

2 years ago

7.0.0

2 years ago

7.0.4

2 years ago

7.0.3

2 years ago

7.0.2

2 years ago

7.0.1

2 years ago

6.5.6

2 years ago

6.5.7

2 years ago

7.0.0-rc.0

2 years ago

6.5.4

2 years ago

6.5.5

2 years ago

5.0.6

2 years ago

5.0.4

2 years ago

6.1.0

2 years ago

6.0.0

2 years ago

6.3.0

2 years ago

6.2.0

2 years ago

6.5.0

2 years ago

6.4.0

2 years ago

6.5.2

2 years ago

6.5.1

2 years ago

6.5.3

2 years ago

5.0.7

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.0.0

2 years ago

3.0.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago