Coder Social home page Coder Social logo

alarm-dog-golang-sdk's Introduction

xiaotianquan-alarm-go

哮天犬监控告警平台SDK

如何安装此SDK

go get github.com/tal-tech/alarm-dog-golang-sdk

如果显示要输入密码,并且一直输入都没有效,可以尝试先clone一下,然后再次执行go get命令。如下:

git clone https://github.com/tal-tech/alarm-dog-golang-sdk.git

go get github.com/tal-tech/alarm-dog-golang-sdk

如果拉取失败,请尝试加上-u参数,命令如下:

go get -u github.com/tal-tech/alarm-dog-golang-sdk

使用例子

基本例子

package main

import "github.com/tal-tech/alarm-dog-golang-sdk/alarm"

func main() {
    a := alarm.New()
    a.SetTaskID(637).SetToken("349f44f37cdde77b2c393c7761e667f382387b0d")

    var content = make(map[string]string)
    content["errno"] = "10086"
    content["error"] = "您的余额已不足"

    reportBody := alarm.ReportBody{
        Ctn: content,
    }

    response := a.Report(reportBody)
    println(response)
}

开发指南

想要高效的进行Channel添加和修改,我们可以使用receiver/channel目录下的channel.template模板来生成代码。使用例子:

安装工具

go get -u github.com/cheekybits/genny

代码生成

genny -in=channel.template -out=qq.go gen "ChannelType=QQ"

此时,会生成一个名字叫做QQChannel

同时,我们可以生成对应的测试文件:

genny -in=channel_test.template -out=qq_test.go gen "ChannelType=QQ"

执行测试

go test -timeout 30s ./... -count=1

手机告警测试

请确保在哮天犬后台配置了手机号。详情参考

alarm-dog-golang-sdk's People

Contributors

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