8

Need the Grafana slack monitoring alert? Let's create it now. - Knoldus Blogs

 3 years ago
source link: https://blog.knoldus.com/grafana-monitoring-slack-alert/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Reading Time: 3 minutes

In my previous blog, we created the first Grafana dashboard. Now in this blog, we will create our first monitoring Grafana alert.

Before creating monitoring alerts, we need to add the notification channel through which we will be notified. Here, we will be adding slack as the notification channel.

Slack notification channel:

First, open the URL http://localhost:3000 in the browser and log in to the Grafana. Then click on the “Notification Channels” option at the left-hand side.

notification_option

Then click on “Add Channel” button and you will get the following screen:

slack_alert

Then, select the Slack from Type field and provide the Slack webhook URL. (Other fields are not mandatory). We can set up other alerts as well by selecting the option from Type field. For slack webhook URL, please see the guide here.

Few key points:

  • If you want to add this channel to all the alerts by default then tick the checkbox for “Send on all alerts”.
  • If you want reminders then tick the checkbox for “Send reminders” and reminder frequency time.

You can test the setup by clicking on “Send Test” button at the bottom.  After setting up all the fields, just click on the Save button. For more details, check out here.

Now let’s create the alert.

Go to Dashboard → Manage →  (Please find these options at left-hand side). Click on Dashboard Edit to set alerts:

edit_dashboard

Go to the Alert section of the dashboard and create an alert there:

alert_section

In alert section, Set the Alert Config and Notification as per the requirement.

alert config:

alert-config

In alert config, we need to add the conditions. We can add multiple conditions here. We need to use either AND or OR to make the relationship between multiple conditions.

As a condition, we get only 5 options:

  • IS ABOVE
  • IS BELOW
  • IS OUTSIDE RANGE
  • IS WITHIN RANGE
  • HAS NO VALUE

You will find “Evaluate every” option there which takes 2 values:

  1. every: Within how many seconds/minutes conditions need to be evaluated
  2. for: For how long the condition needs to be evaluated.

For ex: Evaluate every 20s for 40s.

It means conditions will be evaluated in every 20 seconds but for 40 seconds. It means it will be evaluated 2 times.

Alert is having 3 states:

  • OK: When the overall value of conditions are false
  • Pending: When the overall value of conditions is true
  • Alerting: When the overall value of condition is true continuously until the value of for.

If we take the above example then it will go in alerting mode when the conditions get true for continuous 40 seconds.

notification:

alert_message

Here, we add the notification channel where alert needs to be sent and the alert message. For more details, check out here.

That’s it. I hope, it will be helpful for you and you will be able to create your first alert easily.

References:

https://grafana.com/docs/alerting/rules/

https://grafana.com/docs/alerting/notifications/

Knoldus-blog-footer-image


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK