| # |
| # MANAGED BY PUPPET |
| # |
| |
| # instances: |
| # - name: (mandatory) STRING , It will be used to uniquely identify your metrics as they will be tagged with this name |
| # search_string: (mandatory) LIST OF STRINGS If one of the element in the list matches, |
| # return the counter of all the processes that contain the string |
| # exact_match: (optional) True/False, default to True, if you want to look for an arbitrary |
| # string, use exact_match: False |
| # cpu_check_interval: (optional) CPU percent check interval: 0.1 - 1.0 sec. More time - more precise |
| # |
| # Examples: |
| # |
| |
| # - name: All |
| # search_string: ['All'] |
| |
| <% |
| require 'yaml' |
| |
| if RUBY_VERSION < "1.9" |
| # Hack to avoid ruby 1.8 always reordering the hashes and |
| # changing this template resource at every run |
| # See https://github.com/DataDog/puppet-datadog-agent/issues/43 |
| # Taken from http://www.dzone.com/snippets/generating-yaml-hashes-sorted |
| class Hash |
| # Replacing the to_yaml function so it'll serialize hashes sorted (by their keys) |
| # |
| # Original function is in /usr/lib/ruby/1.8/yaml/rubytypes.rb |
| def to_yaml( opts = {} ) |
| YAML::quick_emit( object_id, opts ) do |out| |
| out.map( taguri, to_yaml_style ) do |map| |
| sort.each do |k, v| # <-- here's my addition (the 'sort') |
| map.add( k, v ) |
| end |
| end |
| end |
| end |
| end |
| end |
| %> |
| |
| <%= {'init_config'=>nil, 'instances'=>@processes}.to_yaml %> |