With MetricFire you can setup notifications for alerts easily using the Alerts API, and the notifications can go directly to your favorite messaging apps. MetricFire supports notifications for alerts in email, Slack, PagerDuty and more. This article will focus on how to set up a notification for an alert in Slack, so you can become aware of any major issues and prevent disasters. We will use MetricFire's product, Hosted Graphite.
To get Slack set up as our notification channel, we need to use a webhook. Webhooks might look like an API, but they are a little different. They are pretty much URLs that receive data from a service. We want Hosted Graphite to send alert data to Slack, so that Slack can post an automated message when an alert goes off from Hosted Graphite. On Hosted Graphite’s Documentation you can see links on how to setup the webhook. This article will show how to setup Slack’s webhooks.
First we will get our Slack channel setup for receiving payload data from our alert system on Hosted Graphite. Click "Add more apps" in the left side menu on Slack's main page. Search for "incoming webhooks" and then add it.
It should take you to a page where you can specify which channel you want to send the alerts to. After selecting and adding your channel, you should get to a page that has your Slack webhook URL.
Now that we have our webhook URL, we can send data to it from our Hosted Graphite interface. In Hosted Graphite, go to the Alerts tab in the left side menu, then click Notification Channels. Click add channel.
Select our text messaging service, which is Slack, give it a name, and finally add the webhook URL.
The next and last step is to link our Alerts to our new Slack Notification Channel. On Hosted Graphite, go to Alerts -> Alerts -> Add Alert.
You can verify a graph image by clicking Check Metric Graph next to the green button.
After getting our metrics, we just need to set when we want the alert, where we want to be notified about the alert, and how fast should the intervals between each alert be.
Now Hosted Graphite will send payload data to the Slack Channel’s webhook URL whenever the alert has gone off from HostedGraphite. This will ping a message onto your channel, notifying you that something has gone wrong. This is very useful if you are monitoring a server that your customers are reliant on for time crucial business, so you can fix a problem quickly if it arises.