How to Send Discord Notifications
Resoto constantly monitors your infrastructure, and can alert you to any detected issues.
One way to receive these alerts is via Discord. In this guide, we will configure Resoto to send alerts to a Discord text channel.
This guide assumes that you have already installed and configured Resoto to collect your cloud resources.
You will also need the Manage Webhooks permission for the target text channel in your Discord server.
Create a webhook in your Discord server. Be sure to select the channel to which you want Resoto to send alerts.tip
Customize the webhook name and avatar to make it easier to distinguish multiple webhooks for different alerts or services.
Define search criteria that will trigger an alert. For example, let's say we have a test account
test-accountwhere instances with more than 4GB of RAM are not permitted:
> search is(instance) and instance_memory>4 and /ancestors.account.reported.name==test-account
Now that we've defined the alert trigger, we will simply pipe the result of the search query to the
discordcustom command, replacing the
titlewith your desired alert text and
webhookwith your Discord webhook URL:
> search is(instance) and instance_memory>4 and /ancestors.account.reported.name==test-account | discord title="Large instances found in test-account" webhook="https://discord.com/api/webhooks/..."
If the defined condition is currently true, you should see a new message in the specified Discord text channel:
Finally, we want to automate checking of the defined alert trigger and send alerts to Discord whenever the result is true. We can accomplish this by creating a job:
> jobs add --id notify_large_test_instances --wait-for-event post_collect 'search is(instance) and instance_memory>4 and /ancestors.account.reported.name==test-account | discord title="Large instances found in test-account" webhook="https://discord.com/api/webhooks/..."'
A default webhook URL can be specified in the
discord custom command configuration, so that you can simply execute