Skip to content

Commit

Permalink
Use erubis syntax to cut down some of the whitespace in the generated…
Browse files Browse the repository at this point in the history
… template. Fixes #56
  • Loading branch information
miketheman committed Apr 22, 2013
1 parent f07815f commit 747622f
Showing 1 changed file with 45 additions and 43 deletions.
88 changes: 45 additions & 43 deletions templates/default/datadog.conf.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Generated by Chef, local modifications will be overwritten

[Main]

##
Expand All @@ -15,15 +17,15 @@ use_mount: <%= node['datadog']['use_mount'] ? "yes" : "no" %>
listen_port: <%= node['datadog']['agent_port'] %>
tags: <%= node['datadog']['tags'] %>

<% if !node['datadog']['dogstreams'].empty? %>
<% if !node['datadog']['dogstreams'].empty? -%>
dogstreams: <%= node['datadog']['dogstreams'].join(', ') %>
<% end %>
<% end -%>

<% if node['datadog']['graphite'] %>
<% if node['datadog']['graphite'] -%>
graphite_listen_port: <%= node['datadog']['graphite_port'] %>
<% end %>
<% end -%>

<% if node['datadog']['dogstatsd'] %>
<% if node['datadog']['dogstatsd'] -%>
# ========================================================================== #
# DogStatsd configuration #
# ========================================================================== #
Expand All @@ -36,51 +38,51 @@ dogstatsd_port : <%= node['datadog']['dogstatsd_port'] %>

## The dogstatsd flush period.
dogstatsd_interval : <%= node['datadog']['dogstatsd_interval'] %>
<% end %>
<% end -%>

##
# service defaults
##

<% if node['datadog']['apache']['status_url'] %>
<% if node['datadog']['apache']['status_url'] -%>
# apache
apache_status_url: <%= node['datadog']['apache']['status_url'] %>
<% end %>
<% end -%>

<% if node['datadog']['ganglia']['url'] %>
<% if node['datadog']['ganglia']['url'] -%>
# ganglia
ganglia_host: <%= node['datadog']['ganglia']['url'] %>
ganglia_port: <%= node['datadog']['ganglia']['port'] %>
<% end %>
<% end -%>

<% if node['datadog']['haproxy']['stats_url'] %>
<% if node['datadog']['haproxy']['stats_url'] -%>
# haproxy
haproxy_url: <%= node['datadog']['haproxy']['stats_url'] %>
<% if node['datadog']['haproxy']['stats_user'] && node['datadog']['haproxy']['stats_password'] %>
<% if node['datadog']['haproxy']['stats_user'] && node['datadog']['haproxy']['stats_password'] -%>
haproxy_user: <%= node['datadog']['haproxy']['stats_user'] %>
haproxy_password: <%= node['datadog']['haproxy']['stats_password'] %>
<% end %>
<% end %>
<% end -%>
<% end -%>

<% if node['datadog']['mysql']['server'] %>
<% if node['datadog']['mysql']['server'] -%>
# mysql
mysql_server: <%= node['datadog']['mysql']['server'] %>
mysql_user: <%= node['datadog']['mysql']['user'] %>
mysql_pass: <%= node['datadog']['mysql']['pass'] %>
<% end %>
<% end -%>

<% if node['datadog']['postgres']['server'] && node['datadog']['postgres']['password'] %>
<% if node['datadog']['postgres']['server'] && node['datadog']['postgres']['password'] -%>
# postgres
postgresql_server: <%= node['datadog']['postgres']['server'] %>
postgresql_port: <%= node['datadog']['postgres']['port'] %>
postgresql_user: <%= node['datadog']['postgres']['user'] %>
postgresql_pass: <%= node['datadog']['postgres']['password'] %>
<% end %>
<% end -%>

<% if node['datadog']['nginx']['status_url'] %>
<% if node['datadog']['nginx']['status_url'] -%>
# nginx
nginx_status_url: <%= node['datadog']['nginx']['status_url'] %>
<% end %>
<% end -%>

<% if node['datadog']['rabbitmq']['status_url'] %>
# rabbitmq
Expand All @@ -89,68 +91,68 @@ rabbitmq_user: <%= node['datadog']['rabbitmq']['user'] %>
rabbitmq_pass: <%= node['datadog']['rabbitmq']['pass'] %>
<% end %>

<% if node['datadog']['mongodb']['server'] %>
<% if node['datadog']['mongodb']['server'] -%>
# mongodb
mongodb_server: <%= node['datadog']['mongodb']['server'] %>
<% end %>
<% end -%>

<% if node['datadog']['couchdb']['server'] %>
<% if node['datadog']['couchdb']['server'] -%>
# couchdb
couchdb_server: <%= node['datadog']['couchdb']['server'] %>
<% end %>
<% end -%>

<% if node['datadog']['jenkins']['home_dir'] %>
<% if node['datadog']['jenkins']['home_dir'] -%>
# jenkins
hudson_home: <%= node['datadog']['jenkins']['home_dir'] %>
<% end %>
<% end -%>

<% if node['datadog']['nagios']['log_dir'] %>
<% if node['datadog']['nagios']['log_dir'] -%>
# nagios
nagios_log: <%= node['datadog']['nagios']['log_dir'] %>/nagios.log
nagios_perf_cfg: <%= node['datadog']['nagios']['conf_dir'] %>/nagios.cfg
<% end %>
<% end -%>

<% if node['datadog']['cassandra']['host'] %>
<% if node['datadog']['cassandra']['host'] -%>
# cassandra
cassandra_host: <%= node['datadog']['cassandra']['host'] %>
cassandra_port: <%= node['datadog']['cassandra']['port'] %>
cassandra_nodetool: <%= node['datadog']['cassandra']['nodetool'] %>
<% end %>
<% end -%>

<% if node['datadog']['jvm_jmx']['server'] %>
<% if node['datadog']['jvm_jmx']['server'] -%>
# java jmx
jvm_jmx_server: <%= node['datadog']['jvm_jmx']['server'] %>
jvm_jmx_user: <%= node['datadog']['jvm_jmx']['user'] %>
jvm_jmx_pass: <%= node['datadog']['jvm_jmx']['pass'] %>
jvm_jmx_name: <%= node['datadog']['jvm_jmx']['name'] %>
<% end %>
<% end -%>

<% if node['datadog']['tomcat_jmx']['server'] %>
<% if node['datadog']['tomcat_jmx']['server'] -%>
# tomcat jmx
tomcat_jmx_server: <%= node['datadog']['tomcat_jmx']['server'] %>
tomcat_jmx_user: <%= node['datadog']['tomcat_jmx']['user'] %>
tomcat_jmx_pass: <%= node['datadog']['tomcat_jmx']['pass'] %>
<% end %>
<% end -%>

<% if node['datadog']['varnish'] %>
<% if node['datadog']['varnish'] -%>
# Varnish, from http://community.opscode.com/cookbooks/varnish
varnishstat: <%= %x{which varnishstat}.strip %>
<% end %>
<% end -%>

<% if node['datadog']['memcached'] %>
<% if node['datadog']['memcached'] -%>
# memcached, from http://community.opscode.com/cookbooks/memcached
<% if node['datadog']['memcached']['listen'] == "0.0.0.0" %>
<% if node['datadog']['memcached']['listen'] == "0.0.0.0" -%>
memcache_server: localhost
<% else %>
<% else -%>
memcache_server: <%= node['datadog']['memcached']['listen'] %>
<% end %>
<% end -%>
memcache_port: <%= node['datadog']['memcached']['port'] %>
<% end %>
<% end -%>

<% if node['datadog']['redis'] %>
<% if node['datadog']['redis'] -%>
# redis, from http://community.opscode.com/cookbooks/redis
redis_urls: <%= node['datadog']['redis']['server']['addr']%>:<%= node['datadog']['redis']['server']['port'] %>
<% end %>
<% end -%>

# ========================================================================== #
# Logging
Expand Down

0 comments on commit 747622f

Please sign in to comment.