GithubHelp home page GithubHelp logo

jx-hook's Introduction

Jx-hook

A webhook that transfer webhook msg to wechat-work (will support other platform in the future).

It's light weight, configurable tool to help resolve different webhook to you own platform.

Usage:

create a wechat sender

PUT "/sender/save"
{
  "id": "sender001", // Empty id means create &  id means modify or specifced id sender
  "name": "jinxin",
  "wechat_robot_key": "123451212312123",
  "template_msg": "Alert from ${alert.host} is ${current_value}"
  "alert_type": "text",
  "enable": true
}

create a custom sender

PUT "/sender/save"
{
  "id": "sender001", // Empty id means create &  id means modify or specifced id sender
  "name": "jinxin",
  "wechat_robot_key": "123451212312123",
  "template_msg": "{\"host\" : \"${alert.host}\", \"current_value\": \"${current_value}\"}"
  "custom_url" : "https://my-own-platform/alert"
  "alert_type": "custom",
  "enable": true
}

And create a alert to send this msg

PUT "/alert/save"
{
  "id": "alert001", // Empty id means create & No-empty id means modify or specifced id alert
  "id" : "xxxx"
  "sender_ids": [ "sender001", "sender002"]
  "enable": true
}

You can configure the web hook url like http://xxxx/alert/do/${alert_id}

So when you received an alert from platform like grafna and its data like blow

{
  "alert": {
    "host": "host001"
  },
  "current_value": 1000
  "xxx": "xxxx"
}

It will automaticlly send a msg to wechat and fill the value of template to "Alert from host001 is 1000"

Here's the grafana's alert template

https://grafana.com/docs/grafana-cloud/alerting/manage-notifications/webhook-notifier/

Install

Requirement:

go >= 1.19.1

redis

Run:

git clone [email protected]:RRRRIC/Jx-Hook.git
cd ./jx-hook
go build

# service default port 8080
# redis default 127.0.0.1:6379 db 1
./jx-hook -c ${YOU_OWN_CONFIG_FILE}

jx-hook's People

Contributors

jinxin-sh avatar rrrric avatar

Stargazers

 avatar SL:) avatar  avatar Protein avatar  avatar

Watchers

 avatar SL:) avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.