Skip to content

Commit

Permalink
Merge pull request #9 from istresearch/dd_agent
Browse files Browse the repository at this point in the history
Add datadog role
  • Loading branch information
jasonrhaas committed Mar 31, 2016
2 parents 2132a2a + f3d02e5 commit c216142
Show file tree
Hide file tree
Showing 16 changed files with 136 additions and 15 deletions.
3 changes: 3 additions & 0 deletions cdr-es-cluster.inventory
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
[all:vars]
repository_host=repo.istresearch.com

[dd-agent-nodes:children]
servers

[servers]
#127.0.0.1 host_alias=localhost

Expand Down
3 changes: 3 additions & 0 deletions dig-es-cluster.inventory
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
[all:vars]
repository_host=repo.istresearch.com

[dd-agent-nodes:children]
servers

[servers]
#127.0.0.1 host_alias=localhost
# This group is
Expand Down
31 changes: 17 additions & 14 deletions group_vars/all/vault
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
$ANSIBLE_VAULT;1.1;AES256
38383233633833303633626534333435336339663534316534646262633039376435663531393332
6166383764356639396438323439623139333930386463640a313166346335643630326664336664
36363932616632366433303833666362636637316265386466633931626633313632646533346564
3765383731393231350a636539343866363130313136646564326461383032373238373035393031
33623935376139653763363735326130376663306636316262646362343065353639633664346263
66346230633439616464653535653063643733373566386463626366393631613534386630336430
66356332636238643438333332386261363364613761616233353533653335653836333565333736
33323961666564386433363961326330346230636162346566643336386666333436643232393333
30396334616238393037323865656437356336353263633762386533306238626661666637306463
35356238323834326439653037666632643139663739343661396666363561666530303139626433
62373461623035623065386438636234663766396431373333653865613533353632333536666531
36396162646139363031363837653336333733623365303965333361616239393662313536356539
35373636633930653030613463363965396261353066353462633039333338373138613630333432
3130613836636639316266323230383037643738353739626361
62373630323933386334356366386230663337343766336466316138636636373937383932336434
3131653734626235333637653932326632633633636334650a386437666535376432333935313564
39316433643734616666303538313437613534663432373764376334363839323633323364623539
6236663538383864660a393936386561313633303037366439616432623730643665336362653931
62616563353931323538323161316535656262643534366437376364633737366637653332623437
33363265613162363239343139326530626339623333613336386638333932643330313062306339
61653836373237383736303861323465613335313065313733616535316365633834333132393263
30326366636532306161383131613930323330333862313663613435396362393464393062313862
65613235303163386663346137326432346662373864333338666332623932306161656465356230
34323561643937616166653333643264663435303131333139623962343937366566643161626230
36373061643334643862346134396232353465646339326531333062363537653637396333363131
62336430613364386136643038303033303639316238613764646537646332323064646438663730
37383236343338396336333938366235363437653862363761396230333563333832616165643234
66656636323530373964376266633534653266653034343837396162303035633963313632666136
66313131613031373636363131343764623235633463376365306362383466363238386639663130
36643361626265633166303530616363623464623036316130373061306436663239346661383531
31303734653933373564383930336261653664306535653662386432626364393436
1 change: 1 addition & 0 deletions group_vars/dd-agent-nodes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
datadog_api_key: "{{ vault_datadog_api_key }}"
3 changes: 3 additions & 0 deletions ist-crawlers.inventory
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
[all:vars]
repository_host=repo.istresearch.com

[dd-agent-nodes:children]
servers

[servers]
#127.0.0.1 host_alias=localhost
# This group is
Expand Down
3 changes: 3 additions & 0 deletions ist-es-cluster.inventory
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
repository_host=repo.istresearch.com
elasticsearch_heap_size=16g

[dd-agent-nodes:children]
servers

[servers]
#127.0.0.1 host_alias=localhost
# This group is
Expand Down
5 changes: 5 additions & 0 deletions production.inventory
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
[all:vars]
repository_host=repo.istresearch.com

[dd-agent-nodes:children]
internap
aws
other

#
# Memex infrastructure and software topology
#
Expand Down
3 changes: 3 additions & 0 deletions pulse-internap.inventory
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
[all:vars]
repository_host=repo.istresearch.com

[dd-agent-nodes:children]
internap

[internap:children]
zookeeper-nodes
kafka-nodes
Expand Down
6 changes: 5 additions & 1 deletion replacements.inventory
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
[all:vars]
repository_host=repo.istresearch.com

[dd-agent-nodes:children]
internap
aws
other

#
# Memex infrastructure and software topology
#
Expand Down Expand Up @@ -226,7 +231,6 @@ ist-crawler06.istresearch.com
traptor-follow-nodes
traptor-track-nodes


[other]
in-namenode01.nj.istresearch.com
memexdev.istresearch.com
Expand Down
5 changes: 5 additions & 0 deletions roles/dd-agent/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---

ddagent_install_dir: /usr/bin
ddagent_conf_path: /etc/dd-agent/datadog.conf
additional_checksd_dir: /etc/dd-agent/checks-enabled/
5 changes: 5 additions & 0 deletions roles/dd-agent/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: restart dd-agent
supervisorctl:
name=dd-agent
state=restarted
2 changes: 2 additions & 0 deletions roles/dd-agent/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dependencies:
- { role: supervisord, when: "supervisord_has_run is not defined"}
55 changes: 55 additions & 0 deletions roles/dd-agent/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
# file: roles/dd-agent/tasks/main.yml
# dd-agent install: https://app.datadoghq.com/account/settings#agent/ubuntu

- name: Install dependencies for dd-agent
apt:
name: apt-transport-https
state: present
update_cache: yes

- name: Add dd-agent repository to source list
apt_repository:
repo: 'deb http://apt.datadoghq.com/ stable main'
state: present

- name: Import dd-agent apt key
apt_key:
keyserver: keyserver.ubuntu.com
id: C7A7DA52

- name: Install dd-agent
apt:
name: datadog-agent
state: present
update_cache: yes

# dd-agent was previously just run as a service before being run under
# supervisor.
- name: Stop service based dd-agent
service:
name: datadog-agent
state: stopped
enabled: no

- name: Copy dd-agent supervisord config
template:
src=dd-agent-supervisord.conf.j2
dest="{{ supervisord_programs_dir }}/dd-agent-supervisord.conf"
mode=0644
notify:
- reread supervisord
- restart dd-agent

- name: Create additional_checksd directory
file:
path: "{{ additional_checksd_dir }}"
state: directory

- name: Copy dd-agent datadog config
template:
src=datadog.conf.j2
dest="{{ ddagent_conf_path }}"
mode=0644
notify:
- restart dd-agent
12 changes: 12 additions & 0 deletions roles/dd-agent/templates/datadog.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
##########################
# Managed by Ansible
##########################

[Main]

dd_url: https://app.datadoghq.com
api_key: {{ datadog_api_key }}
use_mount: no

# Additional directory to look for Datadog checks
additional_checksd: {{ additional_checksd_dir }}
7 changes: 7 additions & 0 deletions roles/dd-agent/templates/dd-agent-supervisord.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[program:dd-agent]
command={{ ddagent_install_dir }}/dd-agent foreground
autostart=true
autorestart=true
redirect_stderr=true
startsecs=5
stopsignal=KILL
7 changes: 7 additions & 0 deletions site-infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,13 @@
tags:
- site-tangelo

# ---------------------------------- DataDog --------------------------------

- hosts: dd-agent-nodes
roles: [ dd-agent ]
tags:
- site-dd-agent

# -------------------------------- Traptor -----------------------------------
# TODO also test traptor-track-nodes and traptor-location-nodes

Expand Down

0 comments on commit c216142

Please sign in to comment.