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

**URL:** https://discourse.sensu.io/t/sensu-chef-cookbook-undefined-method-or-attribute-cluster-on-node/370
**Category:** Sensu Classic (EOL)
**Created:** [February 24, 2015, 8:31pm UTC](https://discourse.sensu.io/t/sensu-chef-cookbook-undefined-method-or-attribute-cluster-on-node/370 "2015-02-24T20:31:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Anthony\_Kong](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Anthony\_Kong](https://discourse.sensu.io/u/Anthony_Kong)
#### Post date: [February 24, 2015, 8:31pm UTC](https://discourse.sensu.io/t/sensu-chef-cookbook-undefined-method-or-attribute-cluster-on-node/370/1 "2015-02-24T20:31:47Z")

</div>

Hi,

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

I literally copy and paste this into my cookbook:

```auto
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

---

<div class="post-metadata">

### Author: ![Sean\_Porter1](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@Sean\_Porter1](https://discourse.sensu.io/u/Sean_Porter1)
#### Post date: [February 24, 2015, 9:26pm UTC](https://discourse.sensu.io/t/sensu-chef-cookbook-undefined-method-or-attribute-cluster-on-node/370/2 "2015-02-24T21:26:42Z")

</div>

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](mailto:anthony.hw.kong@gmail.com) wrote:
> 
> > Hi,
> 
> > 
> 
> > I am using this chef cookbook to create a client ([https://github.com/sensu/sensu-chef](https://github.com/sensu/sensu-chef))
> 
> > 
> 
> > I literally copy and paste this into my cookbook:
> 
> > 
> 
> > ```auto
> > 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
> 
> > 
> 
> >

---

<div class="post-metadata">

### Author: ![Anthony\_Kong](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Anthony\_Kong](https://discourse.sensu.io/u/Anthony_Kong)
#### Post date: [February 24, 2015, 10:52pm UTC](https://discourse.sensu.io/t/sensu-chef-cookbook-undefined-method-or-attribute-cluster-on-node/370/3 "2015-02-24T22:52:36Z")

</div>

Thanks for the answer.

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

Cheers, Tony
