diff --git a/recipes/ntp.rb b/recipes/ntp.rb new file mode 100644 index 00000000..f52f8921 --- /dev/null +++ b/recipes/ntp.rb @@ -0,0 +1,17 @@ +include_recipe 'datadog::dd-agent' + +# Build a data structure with configuration. +# @see https://github.com/DataDog/dd-agent/blob/master/conf.d/ntp.yaml.example +# @example +# node.override['datadog']['ntp']['instances'] = [ +# { +# 'offset_threshold' => '600', +# 'host' => 'pool.ntp.org', +# 'port' => 'ntp', +# 'version' => '3', +# 'timeout' => '5' +# } +# ] +datadog_monitor 'ntp' do + instances node['datadog']['ntp']['instances'] +end diff --git a/templates/default/ntp.yaml.erb b/templates/default/ntp.yaml.erb new file mode 100644 index 00000000..af4872f1 --- /dev/null +++ b/templates/default/ntp.yaml.erb @@ -0,0 +1,5 @@ +<%# Sanitize the compiled Mash to standard Array/Hash objects by way of JSON -%> +<%= JSON.parse(({ 'instances' => @instances }).to_json).to_yaml %> + +init_config: +# Nothing to configure here