Giter Site home page Giter Site logo

einsli / alertservice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gagraler/alert-service

0.0 0.0 0.0 100 KB

Implement WebHook alarm notification and alarm message persistence based on alertmanager

License: MIT License

Python 3.12% Go 87.23% Makefile 7.43% Dockerfile 2.23%

alertservice's Introduction

alertService

AlertManager service for Prometheus

  • lark notification alarm message
  • enterprise weChat notification alarm message
  • alarm message persistence

How to use

1. compile service

$ git clone https://github.com/keington/alertService.git

$ cd alertService

$ make -f build/Makefile

2. run service

Please modify the contents in the configuration file before running the service

$ mysql -u root -p'123456' < alertService.sql

$ export LARK_BOT_SIGN_KEY=secret_key
$ export LARK_BOT_URL=lark_url
$ nohup ./alertService > alertService.log 2>&1 &

build docker images

$ docker build -f ./build/Dockerfile -t alertservice:v1.0.1 .

$ docker run -d \
    -e LARK_BOT_SIGN_KEY=secret_key \
    -e LARK_BOT_URL=lark_url \
    -p 8588:8588 \
    alertservice:v1.0.1
    -v /etc/alertService.toml:/opt/alertService.toml

HTTP API

HTTP Api The unified prefix defaults to /api/v1/alertService

test api

WebHook API alertMessage/hook

$ curl --location 'http://localhost:8588/api/v1/alertService/alertMessage/hook' \
--header 'Content-Type: application/json' \
--data '{
    "receiver":"test",
    "status":"firing",
    "alerts":[
        {
            "status":"firing",
            "labels":{
                "alertname":"TestAlert",
                "instance":"Grafana"
            },
            "annotations":{
                "summary":"Notification test"
            },
            "startsAt":"2024-01-11T15:04:03.277535848Z",
            "endsAt":"0001-01-01T00:00:00Z",
            "generatorURL":"",
            "fingerprint":"57c6d9296de2ad39",
            "silenceURL":"http://localhost:3000/alerting/silence/new?alertmanager=grafana&matcher=alertname%3DTestAlert&matcher=instance%3DGrafana",
            "dashboardURL":"",
            "panelURL":"",
            "values":null,
            "valueString":"[ metric='\''foo'\'' labels={instance=bar} value=10 ]"
        }
    ],
    "groupLabels":{
        "alertname":"TestAlert",
        "instance":"Grafana"
    },
    "commonLabels":{
        "alertname":"TestAlert",
        "instance":"Grafana"
    },
    "commonAnnotations":{
        "summary":"Notification test"
    },
    "externalURL":"http://localhost:3000/",
    "version":"1",
    "groupKey":"test-57c6d9296de2ad39-1704985443",
    "truncatedAlerts":0,
    "orgId":1,
    "title":"[FIRING:1] TestAlert Grafana ",
    "state":"alerting",
    "message":"**Firing**\n\nValue: [no value]\nLabels:\n - alertname = TestAlert\n - instance = Grafana\nAnnotations:\n - summary = Notification test\nSilence: http://localhost:3000/alerting/silence/new?alertmanager=grafana&matcher=alertname%3DTestAlert&matcher=instance%3DGrafana\n"
}'

License and Copyright

MIT

alertservice's People

Contributors

gagraler avatar dependabot[bot] 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.