【问题标题】:Opscode Nagios Cookbook Not pulling Cloud IP addressOpscode Nagios Cookbook 不提取云 IP 地址
【发布时间】:2013-04-10 03:24:39
【问题描述】:

我正在尝试从标准操作码 nagios 食谱生成 nagios hosts.cfg 文件。使用标准配方,我不断从以下几行中得到相同的错误:

    Chef::Mixin::Template::TemplateError (undefined method `[]' for 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']

完整的文件在这里:

http://pastebin.com/FqcdUnSE

原文件注释如下:

    <% # decide whether to use internal or external IP addresses for this node
    # if the nagios server is not in the cloud, always use public IP addresses for cloud nodes.
    # if the nagios server is in the cloud, use private IP addresses for any
    #   cloud servers in the same cloud, public IPs for servers in other clouds
    #   (where other is defined by node['cloud']['provider'])
    # if the cloud IP is nil then use the standard IP address attribute.  This is a work around
    #   for OHAI incorrectly identifying systems on Cisco hardware as being in Rackspace

【问题讨论】:

  • 能否请您提供有关您的节点配置的相关信息?你有node['cloud'] 设置吗?你想达到什么目的?
  • 我在寻找节点“云”,但它不是一个属性,但它看起来确实是我看过的其他 SO 的搜索选项。 /n 根据原始文档,这也在上下文中。 (添加上面的大小)
  • 请不要忘记将答案标记为正确! :)

标签: ruby amazon-web-services chef-infra nagios cookbook


【解决方案1】:

我没有尝试解决此问题,而是采取了以下解决方法:

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

这有效,而不是使用云 ip 配置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-24
    • 2016-12-30
    • 2012-11-03
    • 1970-01-01
    • 2012-10-18
    • 2010-11-04
    • 1970-01-01
    相关资源
    最近更新 更多