zoukankan      html  css  js  c++  java
  • 分布式监控系统开发【day38】:报警自动升级代码解析及测试(八)

    一、报警自动升级代码解析

    发送邮件代码

        def action_email(self,action_obj,action_operation_obj,host_id,trigger_data):
            '''
            sending alert email to who concerns.
            :param action_obj: 触发这个报警的action对象
            :param action_operation_obj: 要报警的动作对象
            :param host_id: 要报警的目标主机
            :param trigger_data: 要报警的数据
            :return:
            '''
    
            print("要发报警的数据:",self.alert_counter_dic[action_obj.id][host_id])
            print("action email:",action_operation_obj.action_type,action_operation_obj.notifiers,trigger_data)
            notifier_mail_list = [obj.email for obj in action_operation_obj.notifiers.all()]
            subject = '级别:%s -- 主机:%s -- 服务:%s' %(trigger_data.get('trigger_id'),
                                                  trigger_data.get('host_id'),
                                                  trigger_data.get('service_item'))
    
            send_mail(
                subject,
                action_operation_obj.msg_format,
                settings.DEFAULT_FROM_EMAIL,
                notifier_mail_list,
            )

    二、报警自动升级测试

    1、iowat 过高过程

    截图

      

     2、报警升级过程

    截图

        

     

     3、发送邮件截图

    1、触发器截图

    2、控制台截图

  • 相关阅读:
    Codeforces Round #336 B
    Codeforces Round #336 A
    hiho一下157
    Codeforces Round #420 E
    Codeforces Round #420 C
    Codeforces Round #420 B
    Codeforces Round #420 A
    Codeforces Round #418 C
    Codeforces Round #418 B
    CodeForces 811D Vladik and Favorite Game bfs,模拟
  • 原文地址:https://www.cnblogs.com/luoahong/p/9617581.html
Copyright © 2011-2022 走看看