Webhook of Grafana+prometheus system monitoring

Source: Internet
Author: User
Tags grafana webhook


Webhook is an API concept and is becoming more and more popular. The more things we can describe with events, the greater the scope of Webhook. Webhook is becoming more and more useful as a lightweight event-handling application.

To be exact, Webhoo is a Web callback or HTTP push API, a way to provide real-time information to apps or other applications. Webhook sends data as soon as the data is generated, i.e. you can receive data in real time. This is different from the typical API, which requires real-time polling to be fast enough. This is efficient both for production and for consumers, and the only drawback is the initial build-up difficulties.

Webhook is sometimes called a reverse API because he provides API rules that you need to design to use. Webhook will initiate an HTTP request to your app, typically a POST request, and the application is driven by the request.


The first two articles mainly talk about mail and nail alert notification method, but the notification method is single, and relies on third-party services can not do cluster processing. For a more flexible and convenient and highly available implementation of our alert notification feature, here we implement the Webhook function ourselves.

The first two articles look here:
Grafana+prometheus system monitoring of the mail alarm function

Grafana+prometheus System monitoring nail alarm function

Webhook implementation look here:
We use the recently popular spring-boot to implement this function, some of the code is as follows:

/*** JSON data format* body:{* "IMAGEURL": "Http://grafana.org/assets/img/blog/mixed_styles.png",* "message": "Someone is testing the alert notification within Grafana.",* "RuleId": 0,* "RuleName": "Test notification",* "Ruleurl": "http://grafana.52itstyle.com/",* "state": "Alerting",* "title": "[alerting] Test notification",* "evalmatches": [* {"value": +, "metric": "High Value", "tags": null},* {"value": $, "metric": "Higher Value", "tags": null}     *          ]     *  }     */    @RequestMapping("/send") PublicStringWebhook(@RequestBodyString body) {//Process alert information (mail, SMS, Staples)Logger.Info("Webhook alarm system, body:{}", body);return "Success"; }

Code Cloud Address: Https://gitee.com/52itstyle/spring-boot-webhook

Webhook of Grafana+prometheus system monitoring

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.