sensu / sensu-chef

Sensu Chef cookbook.
https://supermarket.chef.io/cookbooks/sensu
Apache License 2.0
221 stars 280 forks source link

sensu_check resource - how_to_fix attribute #532

Closed gopalvd closed 7 years ago

gopalvd commented 7 years ago

Sorry if I posting this in the wrong forum. I was using this coobook as an upsteam to install sensu agent and configure my plugins and check definitions.

I want to use the "how_to_fix" attribute, so when the alert criteria met, want to let my team know how to resolve that. I have used that previously. For some reason, i couldnt find in the sensuapp.org site also in your resources plugin.rb file.

I know when i used this attribute, i got an error "undefined method `how_to_fix' for LWRP resource sensu_check from cookbook sensu

I cant use this attribute?

cwjohnston commented 7 years ago

Hi @gopalvd, thanks for opening this issue.

Because how_to_fix is not one of the attributes documented in Sensu's check configuration specification, it would be considered a custom attribute. The sensu_check resource additional parameter accepts a hash argument, describing custom attributes you'd like to add to the check definition.

For example, here's the redis_process check from this cookbook's readme, with a custom how_to_fix attribute:

sensu_check "redis_process" do
  command "check-procs.rb -p redis-server -C 1"
  handlers ["default"]
  subscribers ["redis"]
  interval 30
  additional(
    :how_to_fix => "https://wiki.example.com/how_to_fix_redis",
    :notification => "Redis is not running", 
    :occurrences => 5
  )
end