Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce flag to start/stop agent #94

Merged
merged 2 commits into from Mar 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions attributes/default.rb
Expand Up @@ -70,6 +70,9 @@
# Change port the agent is listening to
default['datadog']['agent_port'] = 17123

# Start agent or not
default['datadog']['agent_start'] = true

# Start a graphite listener on this port
# https://github.com/DataDog/dd-agent/wiki/Feeding-Datadog-with-Graphite
default['datadog']['graphite'] = false
Expand Down
21 changes: 16 additions & 5 deletions recipes/dd-agent.rb
Expand Up @@ -49,12 +49,17 @@
end
end

# Common configuration
service "datadog-agent" do
action :enable
supports :restart => true

if node['datadog']['agent_start'] == true
agent_action = :start
else
agent_action = :stop
end

log "using agent_action #{node['datadog']['agent_start']} #{agent_action}"



# Make sure the config directory exists
directory "/etc/dd-agent" do
owner "root"
Expand All @@ -77,5 +82,11 @@
:api_key => node['datadog']['api_key'],
:dd_url => node['datadog']['url']
)
notifies :restart, "service[datadog-agent]", :delayed
end

# Common configuration
service "datadog-agent" do
action [ :enable , agent_action ]
supports :restart => true , :status => true, :start => true, :stop => true
subscribes :restart, "template[/etc/dd-agent/datadog.conf]", :delayed unless node['datadog']['agent_start'] == false
end