本文整理汇总了Golang中github.com/prometheus/alertmanager/config/generated.FlowdockConfig类的典型用法代码示例。如果您正苦于以下问题:Golang FlowdockConfig类的具体用法?Golang FlowdockConfig怎么用?Golang FlowdockConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FlowdockConfig类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: newFlowdockMessage
func newFlowdockMessage(op notificationOp, config *pb.FlowdockConfig, a *Alert) (*flowdockMessage, error) {
status := ""
switch op {
case notificationOpTrigger:
status = "firing"
case notificationOpResolve:
status = "resolved"
}
contentBuf := &bytes.Buffer{}
err := contentTmpl.Execute(contentBuf, struct{ Alert *Alert }{Alert: a})
if err != nil {
return nil, err
}
msg := &flowdockMessage{
Source: "Prometheus",
FromAddress: config.GetFromAddress(),
Subject: html.EscapeString(a.Summary),
Format: "html",
Content: contentBuf.String(),
Link: a.Payload["generatorURL"],
Tags: append(config.GetTag(), status),
}
return msg, nil
}
开发者ID:NuclearDog,项目名称:alertmanager,代码行数:25,代码来源:notifier.go
示例2: sendFlowdockNotification
func (n *notifier) sendFlowdockNotification(op notificationOp, config *pb.FlowdockConfig, a *Alert) error {
flowdockMessage := newFlowdockMessage(op, config, a)
url := strings.TrimRight(*flowdockURL, "/") + "/" + config.GetApiToken()
jsonMessage, err := json.Marshal(flowdockMessage)
if err != nil {
return err
}
httpResponse, err := postJSON(jsonMessage, url)
if err != nil {
return err
}
if err := processResponse(httpResponse, "Flowdock", a); err != nil {
return err
}
return nil
}
开发者ID:tamsky,项目名称:alertmanager,代码行数:16,代码来源:notifier.go
示例3: newFlowdockMessage
func newFlowdockMessage(op notificationOp, config *pb.FlowdockConfig, a *Alert) *flowdockMessage {
status := ""
switch op {
case notificationOpTrigger:
status = "firing"
case notificationOpResolve:
status = "resolved"
}
msg := &flowdockMessage{
Source: "Prometheus",
FromAddress: config.GetFromAddress(),
Subject: html.EscapeString(a.Summary),
Format: "html",
Content: fmt.Sprintf("*%s %s*: %s (<%s|view>)", html.EscapeString(a.Labels["alertname"]), status, html.EscapeString(a.Summary), a.Payload["generatorURL"]),
Link: a.Payload["generatorURL"],
Tags: append(config.GetTag(), status),
}
return msg
}
开发者ID:tamsky,项目名称:alertmanager,代码行数:20,代码来源:notifier.go
注:本文中的github.com/prometheus/alertmanager/config/generated.FlowdockConfig类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论