All articles

Monitoring a Discord bot, shard by shard

Yann1 min readLire en français

Know which shard of your bot went down, without ever handing over its token: how it works and how to set it up.

A large Discord bot is split into shards, each one handling part of the servers. When a shard disconnects, the bot seems fine, but some of your users no longer get any answer. It is exactly the kind of outage you find out about too late.

Your bot reports on itself

With the Discord bot (shards) type, your bot sends the state of its shards to NorminUp every minute. You never hand over the bot token: NorminUp does not log in to Discord on your behalf.

Setting it up in three steps

  1. Create a Discord bot (shards) service and copy its NorminUp token.
  2. Paste the provided snippet into your bot (discord.js, discord.py, or any language that can send a JSON POST request), with this token in NORMINUP_TOKEN.
  3. Restart the bot: the shards show up on a grid within a minute.

The snippet cannot stop your bot: it waits 5 seconds at most and ignores its own errors.

What you see

  • The state of each shard: ready, reconnecting or silent.
  • Alerts that name the shards involved, instead of a vague “the bot has a problem”.
  • “9/10 shards online” on your status page, and a badge for your bot’s README.

The number of shards tracked depends on the plan: 2 on Free, 8 on Starter, 32 on Pro. A bot counts as a single service, whatever its number of shards.

All the details are in the documentation.

Monitoring a Discord bot, shard by shard | NorminUp