当前位置: 首页>>代码示例>>Golang>>正文


Golang conf.Notifications类代码示例

本文整理汇总了Golang中bosun/org/cmd/bosun/conf.Notifications的典型用法代码示例。如果您正苦于以下问题:Golang Notifications类的具体用法?Golang Notifications怎么用?Golang Notifications使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Notifications类的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
}
开发者ID:nicollet,项目名称:bosun,代码行数:30,代码来源:notify.go

示例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
}
开发者ID:eswdd,项目名称:bosun,代码行数:27,代码来源:notify.go


注:本文中的bosun/org/cmd/bosun/conf.Notifications类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。