我正在尝试在Nagios中创buildcontacts.cfg ,以便在不同的事件中联系两个不同的电子邮件。 一个是我们的定期电子邮件,一个是我们的gmail,它被configuration为在事件发生时给我们打电话。 以下是我的设置
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 [email protected] 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 [email protected] service_notification_period 24x7 host_notification_period 24x7 } define contactgroup { contactgroup_name nagiosadmin-emergencyadmin members mainemail,emergencyadmin }
和我的错误是
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.
任何人都可以指向正确的方向?
您已经将模板和联系人定义混合在一起(两次)。
只要你有一个包含register 0的对象定义,就表示一个模板。 在使用name而不是contact_name (或host_name , timeperiod_name等)的情况下,使用相同的name 。
你几乎肯定不想把电子邮件地址放在模板中。 而且您也不一定需要使用模板对象定义。
联系人的对象定义部分将向您显示必须在联系人定义中(或通过模板提供)的必需指令。
有关模板的更多信息,请参阅对象inheritance的文档页面 。
哪个版本的Nagios? Nagios Core 3和4需要以下联系人定义:
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_enabled或service_notifications_enabled 。
如果这有帮助,请加快我的回应。 TIA
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectdefinitions.html