zoukankan      html  css  js  c++  java
  • 监控和安全运维 1.7 nagios配置邮件告警

    8. 配置邮件告警

    服务端

    vim /etc/nagios/objects/contacts.cfg

    增加:

    define contact{
            contact_name               123
            use                             generic-contact
            alias                           denny
            email                   836503270@qq.com
            }
    
    define contact{
            contact_name               456
            use                             generic-contact
            alias                            aaa
            email                   wangshaojun@qq.com
            }
    
    define contactgroup{
            contactgroup_name           common
            alias                                  common
            members                          123,456
            }

    然后在要需要告警的服务里面加上contactgroup

     vim /etc/nagios/conf.d/192.168.1.111.cfg
    define service{
            use     generic-service
            host_name       192.168.1.111
            service_description     check_load
            check_command           check_nrpe!check_load
            max_check_attempts 5
            normal_check_interval 1
            contact_groups        common
    }

    想让那个服务告警,就在哪个服务下面添加一行  contact_groups common


    9. 几个重要参数说明
    notifications_enabled : 是否开启提醒功能。1为开启,0为禁用。一般,这个选项会在主配置文件(nagios.cfg)中定义,效果相同。
    notification_interval: 之前刚介绍过,表示重复发送提醒信息的最短间隔时间。默认间隔时间是60分钟。如果这个值设置为0,将不会发送重复提醒。
    notification_period: 发送提醒的时间段。非常重要的主机(服务)我定义为7×24,一般的主机(服务)就定义为上班时间。如果不在定义的时间段内,无论什么问题发生,都不会发送提醒。
    notification_options: 这个参数定义了发送提醒包括的情况:d = 状态为DOWN, u = 状态为UNREACHABLE , r = 状态恢复为OK ,  f = flapping。,n=不发送提醒。
  • 相关阅读:
    寒假记录九
    寒假记录八
    寒假记录七
    Powershell 检测USB存储设备
    [轉載] AttributeError: module 'comtypes.gen.UIAutomationClient' has no attribute 'IUIAutomation'
    使用Pyinstaller对Python文件打包
    Python使用uiautomation实现Windows平台自动化
    Python 相對路徑
    Python使用Win32com實現 Excel多個Sheet截圖
    JavaScript 提取网页数据
  • 原文地址:https://www.cnblogs.com/wangshaojun/p/5100658.html
Copyright © 2011-2022 走看看