本文整理汇总了Golang中bosun/org/cmd/bosun/conf.Notifications.Get方法的典型用法代码示例。如果您正苦于以下问题:Golang Notifications.Get方法的具体用法?Golang Notifications.Get怎么用?Golang Notifications.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bosun/org/cmd/bosun/conf.Notifications
的用法示例。
在下文中一共展示了Notifications.Get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: groupActionNotifications
func (s *Schedule) groupActionNotifications(aks []models.AlertKey) (map[*conf.Notification][]*models.IncidentState, error) {
groupings := make(map[*conf.Notification][]*models.IncidentState)
for _, ak := range aks {
alert := s.RuleConf.GetAlert(ak.Name())
status, err := s.DataAccess.State().GetLatestIncident(ak)
if err != nil {
return nil, err
}
if alert == nil || status == nil {
continue
}
var n *conf.Notifications
if status.WorstStatus == models.StWarning || alert.CritNotification == nil {
n = alert.WarnNotification
} else {
n = alert.CritNotification
}
if n == nil {
continue
}
nots := n.Get(s.RuleConf, ak.Group())
for _, not := range nots {
if !not.RunOnActions {
continue
}
groupings[not] = append(groupings[not], status)
}
}
return groupings, nil
}
示例2: groupActionNotifications
func (s *Schedule) groupActionNotifications(aks []models.AlertKey) map[*conf.Notification][]*State {
groupings := make(map[*conf.Notification][]*State)
for _, ak := range aks {
alert := s.Conf.Alerts[ak.Name()]
status := s.GetStatus(ak)
if alert == nil || status == nil {
continue
}
var n *conf.Notifications
if status.Status() == StWarning {
n = alert.WarnNotification
} else {
n = alert.CritNotification
}
if n == nil {
continue
}
nots := n.Get(s.Conf, ak.Group())
for _, not := range nots {
if !not.RunOnActions {
continue
}
groupings[not] = append(groupings[not], status)
}
}
return groupings
}