sms-provider

command module
v0.0.0-...-7becda7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

README

msg-provider

Build Status License

=============

Open-Falcon 告警组件 -- 支持短信、邮件、微信告警。

查看文档

godoc -http=:8080

SMS

使用方法:

短信模版

用户${name},监控平台告警:${context}。
curl http://$ip:8008/sender/sms -d "tos=13523599999,1352358888&context=报警内容"

http://127.0.0.1:8008/sender/sms?tos=13523591108&context=sms_content&name=test

实示例:

EMAIL

使用方法:

Email模版

告警内容:
触发值:
IP地址:
所属团队:
告警时间:
curl http://$ip:8008/sender/mail -d "tos=me@xiexianbin.cn,10972062@qq.com&subject=demo_subject&content=email_content"

http://127.0.0.1:8008/sender/email?tos=me@xiexianbin.cn,10972072@qq.com&subject=demo_subject&content=email_content

实示例:

Wechat

该方法仅支持已认证的微信公众号

支持微信公众号模版消息接受告警信息。详细信息点此

微信告警模版:

{{title.DATA}}
告警主机:{{endpoint.DATA}}
告警条件:{{metric.DATA}}
告警标签:{{tags.DATA}}
触发条件:{{reason.DATA}}
告警最大次数:{{max.DATA}}
当前告警次数:{{current.DATA}}
告警备注:{{note.DATA}}
告警时间:{{timestamp.DATA}}
{{remark.DATA}}

微信发送消息:

https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=GXD-2TpFjGPPb4lZ2b7bZGb9YpsdAOszkPHEnevlvaQNN90s6RCqpvMWM0uSR4U6zlde2OWwjO6K_KdNwt3MfUWD1PnBHwfdDXgAUHJI63K7p-PVCCza5zJF8wHd0_kVPUDiAAAUZI


{
    "touser": "oNvaVuH1Km6fGz3i8V2iHIR9aspk", 
    "template_id": "IJldjH11vTrcaKAwJ2RaGARWuPwA4gLO91b7VZL6n6Q", 
    "url": "http://openfalcon.xiexianbin.cn:5050/template/view/2", 
    "data": {
        "title": {
            "value": "告警平台异常", 
            "color": "#173177"
        }, 
        "endpoint": {
            "value": "xiexianbin_cn", 
            "color": "#173177"
        }, 
        "metric": {
            "value": "net.port.listen", 
            "color": "#bd2636"
        }, 
        "tags": {
            "value": "port=443", 
            "color": "#bd2636"
        }, 
        "reason": {
            "value": "all(#3): 0==0", 
            "color": "#173177"
        }, 
        "max": {
            "value": "6", 
            "color": "#173177"
        }, 
        "current": {
            "value": "5", 
            "color": "#173177"
        }, 
        "note": {
            "value": "网站异常", 
            "color": "#bd2636"
        }, 
        "timestamp": {
            "value": "2017-02-22 22:12:00", 
            "color": "#173177"
        }, 
        "remark": {
            "value": "请相关运维人员尽快恢复该故障,谢谢!", 
            "color": "#173177"
        }
    }
}

msg-provider请求方式:

curl http://$ip:8008/sender/wechat -d "tos=openid1,openid1&title=title_1&endpoint=endpoint_1&metric=metric_1&tags=tags_1&reason=reason_1&max=max_1&current=current_1&note=note_1&timestamp=timestamp_1&remark=remark_1&url=url_1"

http://127.0.0.1:8008/sender/wechat?tos=oNvaVuH1Km6fGz3i8V2iHIR9aspk&title=title_1&endpoint=endpoint_1&metric=metric_1&tags=tags_1&reason=reason_1&max=max_1&current=current_1&note=note_1&timestamp=timestamp_1&remark=remark_1&url=http://openfalcon.xiexianbin.cn:5050/template/view/2

实示例:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
sms
utils
urllib
Package urllib is a httplib for golang
Package urllib is a httplib for golang
uuid
The uuid package generates and inspects UUIDs.
The uuid package generates and inspects UUIDs.
wechat
internal/util
提供一些实用函数
提供一些实用函数
json
Package json implements encoding and decoding of JSON objects as defined in RFC 4627.
Package json implements encoding and decoding of JSON objects as defined in RFC 4627.
mp/account
账号管理.
账号管理.
mp/base
基础模块
基础模块
mp/core
微信公众平台(订阅号&服务号) SDK 的核心库
微信公众平台(订阅号&服务号) SDK 的核心库
mp/message/callback/request
被动接收的基本消息(事件)的数据结构定义, 更多的消息(事件)定义在对应的业务模块内.
被动接收的基本消息(事件)的数据结构定义, 更多的消息(事件)定义在对应的业务模块内.
mp/message/callback/response
被动回复的基本消息的数据结构定义, 更多的消息定义在对应的业务模块内.
被动回复的基本消息的数据结构定义, 更多的消息定义在对应的业务模块内.
mp/message/custom
客服消息.
客服消息.
mp/message/mass
群发消息.
群发消息.
mp/message/mass/mass2all
群发消息给所有用户.
群发消息给所有用户.
mp/message/mass/mass2group
群发消息给特定分组用户.
群发消息给特定分组用户.
mp/message/mass/mass2users
根据OpenID列表群发.
根据OpenID列表群发.
mp/message/mass/preview
预览消息.
预览消息.
mp/message/template
模板消息接口.
模板消息接口.
mp/oauth2
微信网页授权.
微信网页授权.
mp/user
用户管理.
用户管理.
mp/user/group
用户分组管理.
用户分组管理.
oauth2
微信 oauth2 基础库
微信 oauth2 基础库
open/oauth2
微信开放平台 移动应用、网站应用 微信登录功能 SDK.
微信开放平台 移动应用、网站应用 微信登录功能 SDK.
util
提供一些实用函数
提供一些实用函数

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL