解决nagios报警不发邮件通知一例 技术

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

http://skymax.blog.51cto.com/365901/131770

http://bbs.chinaunix.net/viewthread.php?tid=1416669

http://net.zdnet.com.cn/network_security_zone/2008/0922/1141888.shtml

http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html

今天早上来到公司,打开nagios页面,发现服务这部分有10多个严重的报警,都是红色的,蚊子我就特别的诧异了,周六的时候我还收到了很多的warning的邮件呢,怎么这两天这么消停呢,好在目前还只是在测试阶段,不然,可就郁闷坏了。

不说这个了,先来排查错误吧。

第一个想到的是warning报警发了邮件,而CRITICAL就报警不发邮件通知了,又看了一下nagios的日志,我service的状态变化是出在周六,也就是从warning转变成critical就不发邮件了,问题可能出在服务报警通知那部分,于是先看了一下我定义的所有服务和主机的模板文件,内容如下

# vi genericdef.cfg

  1 define host{
  2     name                                                generic-host
  3     check_period                                  24x7
  4     notifications_enabled                   1
  5     event_handler_enabled               1
  6     process_perf_data                       1
  7     retain_nonstatus_information    0
  8     contact_groups                              admins
  9     notification_interval                       60
10     notification_period                        24x7
11     notification_options                      d,u,r
12     stalking_options                           o,d,u
13     register                                           0
14 }
15
16 define service{
17     name                                               generic-service
18     active_checks_enabled               1
19     passive_checks_enabled           1
20     notifications_enabled                   1
21     event_handler_enabled               1
22     check_period                                  24x7
23     max_check_attempts                   3
24     normal_check_interval                10
25     retry_check_interval                      2
26     contact_groups                             admins
27     notification_options                      w,u,c,r
28     notification_interval                       60
29     notification_period                        24x7
30     register                                            0
31 }

从上面service定义来看,通知选项已经加入了c(CRITICAL)这个参数了,看了问题不是出在这里。

第二个我想到的地方就是contract的配置文件,打开看了一下

1 define contact{
2         contact_name                                    nagios-msn-admin       
3         alias                                                     Nagios msn Admin       
4         email                                                    [email protected]
5         host_notification_commands         notify-host-by-msn
6         host_notification_options                d,u
7         host_notification_period                  24x7
8         service_notification_period             24x7
9         service_notification_options           w,u,r,c         //这个位置之前是没有c
10       service_notification_commands   notify-service-by-msn
11       }
12            
13 define contact{
14         contact_name                                   nagios-mail-admin
15         alias                                                    Nagios mail Admin
16         email                                                   hanzhao.liu@wenzizone.cn
17         host_notification_commands        notify-host-by-email
18         host_notification_options               d,u
19         host_notification_period                 24x7
20         service_notification_period            24x7
21         service_notification_options          w,u,r,c    //这个位置之前没有c
22         service_notification_commands   notify-service-by-email
23         }

在上面的第9和21行的位置加上c之后,然后重新reload一下nagios,如果没有报错,说明配置更新完毕,很快蚊子又可以收到报警的邮件了。

nagios调整是一个细致的活,看了蚊子还需要做很多的工作才行了。

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/ytfhjhv/article/details/83820771
今日推荐