Sensu chef cookbook: Undefined method or attribute `cluster' on `node'


#1

Hi,

I am using this chef cookbook to create a client (https://github.com/sensu/sensu-chef)

I literally copy and paste this into my cookbook:

sensu_client node.name do
  address node.ipaddress
subscriptions node.roles + ["all"  ]
additional(:cluster => node.cluster)
end

And it throw an exception at the ‘addtitonal’ line

   Relevant File Content:
···
   ----------------------

   /tmp/kitchen/cache/cookbooks/project/recipes/monitor_client.rb:

   

    10:  # include_recipe 'git'

    11:  include_recipe 'sensu::default'

    12:  include_recipe 'sensu::client_service'

    13:  

    14:  sensu_client node.name do

    15:    address node.ipaddress

    16:    subscriptions node.roles + ["all"]

    17>>   additional(:cluster => node.cluster)

    18:  end

The error is

   NoMethodError

   -------------

   Undefined method or attribute `cluster' on `node'

Do you know what is the cluster? How is it used by sensu?

Thanks, Tony


#2

You’re trying to use a Chef attribute “node.cluster” for a Sensu client definition attribute value. You have not defined that Chef attribute anywhere (in any cookbook attribute file or recipes).

Sean.

···

On Feb 24, 2015 12:31 PM, “Anthony Kong” anthony.hw.kong@gmail.com wrote:

Hi,

I am using this chef cookbook to create a client (https://github.com/sensu/sensu-chef)

I literally copy and paste this into my cookbook:

sensu_client [node.name](http://node.name) do
  address node.ipaddress subscriptions node.roles + ["all"  ] additional(:cluster => node.cluster) end

And it throw an exception at the ‘addtitonal’ line

   Relevant File Content:
   ----------------------
   /tmp/kitchen/cache/cookbooks/project/recipes/monitor_client.rb:
    10:  # include_recipe 'git'
    11:  include_recipe 'sensu::default'
    12:  include_recipe 'sensu::client_service'
    13:  
    14:  sensu_client [node.name](http://node.name) do
    15:    address node.ipaddress
    16:    subscriptions node.roles + ["all"]
    17>>   additional(:cluster => node.cluster)
    18:  end

The error is

   NoMethodError
   -------------
   Undefined method or attribute `cluster' on `node'

Do you know what is the cluster? How is it used by sensu?

Thanks, Tony


#3

Thanks for the answer.

Sorry, for me sometimes it is hard to tell if a problem lies with chef or sensu cookbook

Cheers, Tony