Created
August 11, 2011 12:38
-
-
Save octplane/1139542 to your computer and use it in GitHub Desktop.
Chef defines for monitoring: store in definitions/monitored.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Cookbook Name:: monitored | |
| define :monitored, :additional_params => {} do | |
| if ! params[:depends].is_a?(Array) && params[:depends] != nil | |
| raise "Depends must be an array (#{params[:depends].inspect})" | |
| end | |
| doc = {}.merge(params[:additional_params]) | |
| params.each do |k,v| | |
| next if k == :name | |
| next if k == :additional_params | |
| doc[k.to_s] = v if v != nil | |
| end | |
| current_key = node[:monitored][:next] | |
| node[:monitored][:content][current_key][params[:name]] = doc | |
| end | |
| define :passive_monitored do | |
| doc = {} | |
| params.each do |k,v| | |
| next if k == :name | |
| doc[k.to_s] = v if v != nil | |
| end | |
| monitored params[:name] do | |
| passive true | |
| additional_params doc | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment