Setting Up Grafana Webhooks Integration: 2 Easy Steps

By: Published: October 19, 2021

Grafana Webhooks - FEATURE IMAGE

Companies use various Dashboards, charts, and other visualization tools to monitor their infrastructure and log analytics. As data grows, it becomes essential for companies to get an overview of data. Many Visualisation tools are available in the market, but still, many companies don’t want to load data to 3rd party vendors for privacy. 

Grafana is an open-source visualization and analytics software that can seamlessly query data no matter where it is stored. Companies use Grafana for visualizing and exploring datasets. Using open-source software like Grafana provides flexibility and allows developers to build plugins from scratch. Grafana can easily integrate with other external data sources using Grafna Webhooks.

Grafana Webhooks is the fastest and efficient way to integrate data sources to Grafana and visualize data seamlessly. In this article, you will learn the steps to Grafana Webhooks Integration that will make the notification alerts easy. With this, you can get automated alerts on different platforms that your companies use daily.

Table of Contents

Introduction to Grafana

Grafana Logo
Image Source

Grafana is an open-source tool built to run Data Analytics, extract Key Performance Indicators from the data, and monitor the apps with the help of a dashboard. Grafana has a variety of connections available to connect various data sources like Graphite, Elastic Search, MySQL, PostgreSQL, etc.

Grafana is an open-source tool, and it allows users to build plugins that connect to data sources from scratch, thereby making Grafana a fully customizable tool. It helps the user analyze and monitor data over time and performs time-series analytics on the data.

Key Features of Grafana

The following are the key features of Grafana are listed below:

  • Visualization – Grafana has a ton of visualization options to visualize the data. From Graphs to Histogram, Grafana has it all. Also, Grafana has several in-built Dashboard templates available that allow you to build the visualization quickly.
  • Dashboard templating – Grafana allows users to create a Dashboard template that can be used in different environments. For example, the developer can use the Grafana dashboard of the test environment in the production environment. The values in the dashboard are not hard-coded; instead, they are picked in real-time from the backend database.
  • Collaborative Sharing – Grafana allows you to share the Dashboards across teams within your organization that helps in joint development and review of the work.
  • Alerts and Notifications – Grafana allows you to create notifications and alerts for thresholds. You can configure notifications to Slack, PagerDuty, SMS, E-Mail, and many more.
  • Ease of Provisioning – Grafana supports automation. Users can create automation scripts to create a Grafana dashboard with the right server, IP address, and data sources.
  • SQL data sources: Grafana has native SQL support that helps users turn any data in SQL databases into Graphs to visualize.  
  • Security & Authentication: Grafana supports different authentication styles, such as LDAP and OAuth, and allows you to create a secure environment.

To know more about Grafana, click here.

Introduction to Webhooks

Webhooks Logo
Image Source

Webhooks are the ways of communicating between two apps by sending notifications or alerts when something happens. There are several use-cases when webhooks are very helpful. Some examples are listed below: 

  • Notification E-Mail from Paypal alerts you when the client pays you.
  • In Bitbucket, every time a user pushes commits in a repository, you can use Webhooks to instantiate the CI pipeline.
  • Sending success/failure E-Mails when the build passes/fails.

Webhooks are event-driven systems, which means it becomes active only when the desired event happens, and they are restricted to communicate over web protocol-HTTP.

Simplify Data Analysis with Hevo’s No-code Data Pipeline

Hevo Data, a No-code Data Pipeline helps to load data from any data source such as Kafka, Databases, SaaS applications, Cloud Storage, SDK,s, and Streaming Services and simplifies the ETL process. It supports 150+ data sources and is a 3-step process by just selecting the data source, providing valid credentials, and choosing the destination. Hevo not only loads the data onto the desired Data Warehouse/destination but also enriches the data and transforms it into an analysis-ready form without having to write a single line of code.

Get Started with Hevo for Free

Its completely automated pipeline offers data to be delivered in real-time without any loss from source to destination. Its fault-tolerant and scalable architecture ensures that the data is handled in a secure, consistent manner with zero data loss and supports different forms of data. The solutions provided are consistent and work with different BI tools as well.

Check out why Hevo is the Best:

  1. Secure: Hevo has a fault-tolerant architecture that ensures that the data is handled in a secure, consistent manner with zero data loss.
  2. Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  3. Minimal Learning: Hevo, with its simple and interactive UI, is extremely simple for new customers to work on and perform operations.
  4. Hevo Is Built To Scale: As the number of sources and the volume of your data grows, Hevo scales horizontally, handling millions of records per minute with very little latency.
  5. Incremental Data Load: Hevo allows the transfer of data that has been modified in real-time. This ensures efficient utilization of bandwidth on both ends.
  6. Live Support: The Hevo team is available round the clock to extend exceptional support to its customers through chat, E-Mail, and support calls.
  7. Live Monitoring: Hevo allows you to monitor the data flow and check where your data is at a particular point in time.
Sign up here for a 14-Day Free Trial!

Steps to Set Up Grafana Webhooks Integration for Alerts

Now that we have a basic understanding of Grafana Webhook. In this section, you will learn the steps to how to integrate Grafana Webhooks. The steps for Grafana Webhooks are listed below:

Step 1: Adding a Notification Channel

  • Log in to the Grafana console, and on the sidebar, click on Alerting (bell) icon and click Notification channels.
  • Click on Add Channel and select the available options to configure alerts.
Grafana Webhooks - Adding Channel
Image Source

Step 2: Configuring Notification Channel Fields

  • On the next page, provide the Name of the Notification alerts that you want to create.
  • From the Type section, select the available and supported notifiers. The supported notifiers are listed below:
NameType
DingDingdingding
Discorddiscord
Emailemail
Google Hangouts Chatgooglechat
Hipchathipchat
Kafkakafka
Lineline
Microsoft Teamsteams
Opsgenieopsgenie
Pagerdutypagerduty
Prometheus Alertmanagerprometheus-alertmanager
Pushoverpushover
Sensusensu
Sensu Gosensugo
Slackslack
Telegramtelegram
Threemathreema
VictorOpsvictorops
Webhookwebhook
  • To create Grafana Webhook, Select the Type as Webhook and fill out the form, as shown in the image below.
Grafana Webhooks - Selecting type of Webhook
Image Source
  • Following is the JSON body for the Grafana Webhook Integration
{
  "dashboardId": 1,
  "evalMatches": [
    {
      "value": 1,
      "metric": "Count",
      "tags": {}
    }
  ],
  "imageUrl": "https://grafana.com/assets/img/blog/mixed_styles.png",
  "message": "Notification Message",
  "orgId": 1,
  "panelId": 2,
  "ruleId": 1,
  "ruleName": "Panel Title alert",
  "ruleUrl": "http://localhost:3000/d/hZ7BuVbWz/test-dashboard?fullscreenu0026editu0026tab=alertu0026panelId=2u0026orgId=1",
  "state": "alerting",
  "tags": {
    "tag name": "tag value"
  },
  "title": "[Alerting] Panel Title alert"
}
  • Once done, click on Save and then click on Test to verify the configurations.
  • Once the test is successful, click on Manage from the left navigation panel.
  • Click on the existing dashboard to add Alerts and rules.
  • Select the Create Alert tab and then click on the Create Alert button.
  • In the Notification section, click the + sign and add the notification channel you have created under Send to.
  • Click Save to save the rules and alerts. 

That’s it, you have completed the Grafana Webhook Integrations alerts on the Dashboard. Now when any changes happen on Dashboard will be notified to the users.

Popular Notification Triggers Using Grafana Webhooks

In Grafana, there are several supported triggers available. However, in this article, you will go through a few Grafana Webhooks Triggers. A few notification triggers using Grafana Webhooks are listed below:

E-Mail

  • To set up E-Mail notifications, first, we need to set up the SMTP configurations in Grafana. In Windows, the configuration file will be at – $WORKING_DIR/conf/defaults.ini, and in macOS, the files will be at – /usr/local/etc/grafana/grafana.ini
  • Add the following configurations to the configuration file. Update the <section> with your configurations.
######### SMTP / Emailing #######
[smtp]
;enabled = true
;host = smtp-mail.outlook.com:587 #Port 25(Without TLS/SSL) 
;user = <email-address>
;password = """<Your-Password>"""
;cert_file =
;key_file =
;skip_verify = true
;from_address = <email-address>
;from_name = <Your-Name>
;ehlo_identity =

[emails]
;welcome_email_on_sign_up = false
;templates_pattern = emails/*.html
  • On the Grafana Alerting page, select the Type – E-Mail, add other relevant information, and click on Save.
  • Click on Send Test to test the connection.

That’s it, and you have successfully configured the Grafana Webhook E-Mail Alerts. Now at every event, Grafana Webhook will send an E-Mail to the specified E-Mail addresses.

Kafka

  • You need to set up Kafka REST Proxy endpoint for Kafka Grafana Webhook. To set up Kafka REST Proxy endpoint, refer to the official Confluent Kafka Blog.
  • Once you set up the Kafka successfully, create a Topic that will accept the incoming notifications/alerts from the Grafana.
  • Once the above two properties are set, on the Grafana create alerts page, select the Type as Kafka and provide other necessary information like REST endpoint, Topic name, authentication credentials to set up the Grafana Webhook, as shown in the image below.
Grafana Webhooks - Choosing Kafka Webhooks
Image Source

Discord

  • To set up the Discord channel Webhook, first, you need to create the Discord channel.
  • To set up a Discord channel, Open the server settings and look for Integration Tab.
  • On the Integration tab, click on Create Webhook to create a new Webhook, as shown in the image below.
Grafana Webhooks - Integrations option in Discord
Image Source
  • On the next page, you will get several options like changing the Avatar, its Name, and the channel where the Webhook will post the notifications, as shown in the image below.
Grafana Webhooks - Creating Discord Webhook
Image Source
  • Fill in the required information and then click on Copy Webhook URL to copy the URL.
  • Once you have the Webhook URL, add the URL and necessary credentials to Grafana, and your Grafana Webhook will be ready. 
  • Any updates will be pushed to the Discord channel automatically. 

Conclusion

In this article, you read about Grafana which is an open-source Data Analytics tool, Webhooks, and how to integrate Grafana Webhooks along with several supported notification channels. Companies use Grafan to analyze and visualize data that saves cost and is a flexible solution for companies that have to preserve the privacy of data. Customizable Dashboards, charts, graphs need data in an analysis-ready form that can be delivered via Data Warehouses. Manually loading data from multiple sources to Data Warehouse is a tedious process. 

Visit our Website to Explore Hevo

Hevo Data is a No-code Data Pipeline that can help you transfer data from Kafka or another data source to desired Data Warehouse. It fully automates the process to load and transform data from 150+ data sources to a destination of your choice without writing a single line of code. 

Want to take Hevo for a spin? Sign Up here for a 14-day free trial and experience the feature-rich Hevo suite first hand.

Share your experience of learning about Grafana Webhook Integration in the comments section below!

Vishal Agrawal
Freelance Technical Content Writer, Hevo Data

Vishal has a passion towards the data realm and applies analytical thinking and a problem-solving approach to untangle the intricacies of data integration and analysis. He delivers in-depth researched content ideal for solving problems pertaining to modern data stack.

No-code Data Pipeline For your Data Warehouse