Folks,
This is another one where I had opened a discussion on this subject at
help.opscode.com, and where I am now moving this thread to this list instead.
Anyway, I have been following as best I can the Nagios quick start tutorial
(seeing as I'm on CentOS 5.6 and not Ubuntu, this means there's a lot of
stuff I have to do differently), and it seems that the file
nagios/templates/default/contacts.cfg.erb requires some non-standard
attributes to be defined for the admins (I added line numbers to make it
easier to see what error was happening where):
25<% @admins.each do |a| -%>
26 define contact {
27 use default-contact
28 contact_name<%= a['id'] %>
29 email<%= a['nagios']['email'] %>
30 }
However, in the "users" data bag, the attribute ['nagios']['email'] is not
defined for any of our admins. So, this value is nil, and we get this error when trying
to install this cookbook:
[Thu, 22 Sep 2011 17:52:14 +0000] INFO: Processing
template[/etc/nagios3/conf.d/contacts.cfg] action create (nagios::server line
28)
[Thu, 22 Sep 2011 17:52:14 +0000] ERROR:
template[/etc/nagios3/conf.d/contacts.cfg] (nagios::server line 28) has had
an error
[Thu, 22 Sep 2011 17:52:14 +0000] ERROR:
template[/etc/nagios3/conf.d/contacts.cfg]
(/var/chef/cache/cookbooks/nagios/definitions/nagios_conf.rb:28:in `block in
from_file') had an error:
Chef::Mixin::Template::TemplateError (undefined method `[]' for nil:NilClass)
on line #29:
27: use default-contact
28: contact_name<%= a['id'] %>
29: email<%= a['nagios']['email'] %>
30: }
31:
Correct me if I'm wrong, but is this template assuming that all admins should
get all nagios notices sent by e-mail? What if we have several admins defined
on the machine but who should not get the notices?
Assuming I'm correct, then shouldn't you test a['nagios']['email'] != nil
before you try to use it in an assignment on line 29, and if it is nil then
skip over this particular admin?
Unfortunately, this issue is preventing me from installing the Nagios
cookbook from the Opscode repository. I'm now moving on to try the icinga
cookbook, to see if that works any better.
Any and all advice or suggestions would be appreciated. Thanks!
Archive powered by MHonArc 2.6.16.