首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Nagios接触配置

Nagios接触配置
EN

Server Fault用户
提问于 2015-12-07 22:45:46
回答 2查看 2.8K关注 0票数 1

我试图在Nagios中创建一个contacts.cfg,这样它就可以在不同的事件中联系到两封不同的电子邮件。一个是我们的普通电子邮件,另一个是我们的gmail,它被配置成在一个事件上给我们打电话,事情出了问题。下面是我的设置

代码语言:javascript
复制
define contact {

name                            mainemail
service_notification_options    c,u,r
host_notification_options       d,u,r
service_notification_commands   notify-service-by-email
host_notification_commands      notify-host-by-email
register                        0
email                           alert@xxmail.net
service_notification_period     24x7
host_notification_period        24x7
}


define contact {

name                            emergencyadmin
service_notification_options    c,u
host_notification_options       d,u,r
service_notification_commands   notify-service-by-email
host_notification_commands      notify-host-by-email
register                        0
email                           xxx@gmail.com
service_notification_period     24x7
host_notification_period        24x7
}  

define contactgroup {

contactgroup_name       nagiosadmin-emergencyadmin
members                 mainemail,emergencyadmin
}

我的错误是

代码语言:javascript
复制
Error: Unexpected token or statement in file '/usr/local/nagios/etc/objects/contacts.cfg' on line 7.
Error processing object config files!


***> One or more problems was encountered while processing the config files...

 Check your configuration file(s) to ensure that they contain valid
 directives and data defintions.  If you are upgrading from a previous
 version of Nagios, you should be aware that some variables/definitions
 may have been removed or modified in this version.  Make sure to read
 the HTML documentation regarding the config files, as well as the
 'Whats New' section to find out what has changed.

有人能指出正确的方向吗?

EN

回答 2

Server Fault用户

发布于 2015-12-07 23:52:58

您将模板和联系人定义混合在一起(两次)。

每当您有一个包含register 0的对象定义时,它就指示一个模板。使用name代替contact_name (或host_nametimeperiod_name等,视情况而定)。

您几乎肯定不想将电子邮件地址放在模板中。您也不一定需要使用模板对象定义。

联系人的对象定义部分将向您展示必须在联系人定义中(或通过模板提供)所需的指令。

有关模板的更多信息,请参见关于对象继承的docs页面

票数 2
EN

Server Fault用户

发布于 2015-12-07 23:27:18

哪种版本的Nagios?Nagios Core 3&4要求联系人定义如下:

代码语言:javascript
复制
define contact {
  contact_name                  contact_name
  host_notifications_enabled    [0/1]
  service_notifications_enabled [0/1]
  host_notification_period      timeperiod_name
  service_notification_period   timeperiod_name
  host_notification_options     [d,u,r,f,s,n]
  service_notification_options  [w,u,c,r,f,s,n]
  host_notification_commands    command_name
  service_notification_commands command_name
}

在您的示例中,我没有看到contact_name host_notifications_enabledservice_notifications_enabled

如果这有帮助,请支持我的回答。提亚

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectdefinitions.html

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/741415

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档