Giter Club home page Giter Club logo

gin-web-demo's Introduction

gin-Fault-self-healing-demo

顾名思义

实现altermanager告警通过salt去调用定义的方法执行处理对应的告警,然后钉钉返回消息

  • 已经完成处理日志过大

  • 待完成cpu过高分析

  • 待完成MEM过高分析

  • 待完成报表数据汇总管理展示

  • 待完成提供通用的resterful-API

webhook前置条件

#1.vim altermanager.yaml
#配置调用webhook
#golang-webhook调用例子配置告警的接受组
- name: 'golang_webhook'
  webhook_configs:
  - url: 'http://xxx:9090/monitor'
    send_resolved: true
 
#配置prometheus的rule报警规则
groups:
- name: golangwebhookAlert
  rules:
  - alert: gocpuUsageAlert
    expr: (100 - (avg by (instance,hostname)(irate(node_cpu_seconds_total{job="consul_sd_node_exporter",mode="idle"}[1m])) * 100)) >20
    for: 10s
    labels:
      team: golang-webhook
  • 实现的代码逻辑架构图

  • 配置文件修改方式
请求头: Content-Type:application/x-www-form-urlencoded
请求地址: http://你配置文件中写入的地址/config
请求参数:
client:saltstack执行方式
tgt:目标节点
func:执行的函数名称
arg:具体的命令
paraevent:过滤的hostname中包含的字段
switch:是否处理任务的开关(0开1关)
count:saltstack任务执行超时时间
parahost:过滤的instace信息

运行方式

  • 下载代码

  • 执行go构建CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o gin-web main.go

  • 执行Images构建:docker build -t xxxx/xxx/gin-web:v1 .

  • 运行:docker run -itd -p 9090:9090 --name gin-web xxxx/xxx/gin-web:v1

gin-web-demo's People

Contributors

ddy4633 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.