ruby - Opscode Nagios Cookbook Not pulling Cloud IP address -


i trying generate nagios hosts.cfg file standard opscode nagios cookbook. using standard recipe continually getting same errors following lines:

    chef::mixin::template::templateerror (undefined method `[]' nil:nilclass) on line #19:       17:   if node['cloud'].nil? && !n['cloud'].nil?      18:     ip = n['cloud']['public_ipv4'].include?('.') ? n['cloud']['public_ipv4'] : n['ipaddress']      19:   elsif !node['cloud'].nil? && n['cloud']['provider'] != node['cloud']['provider']      20:     ip = n['cloud']['public_ipv4'].include?('.') ? n['cloud']['public_ipv4'] : n['ipaddress']      21:   else      22:     ip = n['ipaddress'] 

the full file here:

http://pastebin.com/fqcdunse

notations on original file follows:

    <% # decide whether use internal or external ip addresses node     # if nagios server not in cloud, use public ip addresses cloud nodes.     # if nagios server in cloud, use private ip addresses     #   cloud servers in same cloud, public ips servers in other clouds     #   (where other defined node['cloud']['provider'])     # if cloud ip nil use standard ip address attribute.  work around     #   ohai incorrectly identifying systems on cisco hardware being in rackspace 

instead of trying fix this, did following workaround:

    define host {     use server     address <%= node['ipaddress'] %>     host_name <%= node[node['nagios']['host_name_attribute']] %>     hostgroups <%= node['nagios']['server_role'] %>,<%= node['os'] %>     } 

this worked instead of using cloud ip configs.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -