Use Node-Red and Telegram to Monitor Discourse Status

Please note that this is a different application than sending Discourse application notifications using the Discourse Telegram Notifications plugin. This NR application is for monitoring the server, Docker and the Discourse application, in general.

Like most of you busy sys admins, when we are on the go we find it helpful to monitor production applications from our mobile phones.

We use Telegram and Node-Red (NR) for this task. For example, some of our current Discourse NR tasks:

  1. Node-Red does a HTTPS GET request (every minute) on a category (created for this purpose) and sends an alert to our Telegram bot when it detects Discourse is DOWN (and back UP again, without flapping).

  2. Our basic Telegram bot, UNIXForumBot has a number of checks we can do, including:

  • Manually check to see if Discourse is running.
  • Quickly show which Discourse container is being used by our reverse proxy.
  • Check server uptime.
  • Check disk utilization.
  • Ping other LAMP applications on the same server.

Example Telegram Screenshots:

Our Setup and Background Information

Background Information

The reason we check which Discourse container is running is because if there is an issue, or I simply want to upgrade or make changes, we always want to know quickly which container is running Discourse before logging into the server.

We always run Discourse behind a reverse proxy. Because we have many other web apps running on the same server (LAMP apps running with Discourse Docker apps) we run Discourse as follows:

  • Separate Discourse data and applications containers.
  • Discourse application containers only expose a unix domain docket to the host (the reverse proxy).

This means, for those not familiar with this setup, that we can build Discourse when a new upgrade comes out and cut over to that new version of Discourse with zero downtime by specifying a different unix docket in the reverse proxy configuration.

If there was an issue with the latest beta, no problem we can quickly and easily revert back to the other container which was running an earlier Discourse version. Works flawlessly.

Node-Red Diagram for the Telegram Bot We Use To Monitor Discourse

For anyone interested to monitor their Discourse applications using Telegram and NR, I have made the Node-Red nodes for this application available. You can customize as. you like:

In the future, we plan to expand the Docker and Discourse monitoring functions in the Telegram app.

See also:

Hope other sys admins who are interested in monitoring their production server and Discourse application find this short topic useful.

3 Likes