How to Send Slack Notifications
Fix Inventory constantly monitors your infrastructure, and can alert you to any detected issues.
One way to receive these alerts is via Slack. In this guide, we will configure Fix Inventory to send alerts to a Slack channel.
Prerequisites​
This guide assumes that you have already installed and configured Fix Inventory to collect your cloud resources.
Directions​
-
Create an Incoming Webhook in Slack.
-
Install the
slack
infrastructure app using theapp install
command:> app install slack
-
Define search criteria for which to trigger an alert. For example, let's say we have an account called
test-account
where instances with more than 4 GB of RAM are not permitted:> search is(instance) and instance_memory>4 and /ancestors.account.reported.name==test-account
-
Pipe the result of the search query to the
slack
app with your desired alert text and Slack webhook URL:> search is(instance) and instance_memory>4 and /ancestors.account.reported.name==test-account | slack --title="Large instances found in test-account" --webhook="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
If the defined condition is currently true, you should see a new message appear in Slack:
tipA default webhook URL can be defined in the
slack
app configuration so that you can simply executeslack --title="..."
:> config edit fix.apps.slack
-
To automate the alerts, create 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 | slack --title="Large instances found in test-account" --webhook="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"'