Skip to content

Commit fb2b3b1

Browse files
author
Cristian Juve
committed
Add supervisord integration config files
1 parent 902e099 commit fb2b3b1

2 files changed

Lines changed: 139 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Class: datadog_agent::integrations::supervisord
2+
#
3+
# This class will install the necessary configuration for the supervisord integration
4+
#
5+
# Parameters:
6+
# servername
7+
# socket
8+
# Optional. The socket on which supervisor listen for HTTP/XML-RPC requests.
9+
# hostname
10+
# Optional. The host where supervisord server is running.
11+
# port
12+
# Optional. The port number.
13+
# username
14+
# password
15+
# If your service uses basic authentication, you can optionally
16+
# specify a username and password that will be used in the check.
17+
# proc_names
18+
# Optional. The process to monitor within this supervisord instance.
19+
# If not specified, the check will monitor all processes.
20+
# server_check
21+
# Optional. Service check for connections to supervisord server.
22+
#
23+
#
24+
# Sample Usage:
25+
#
26+
# class { 'datadog_agent::integrations::supervisord':
27+
# instances => [
28+
# {
29+
# servername => 'server0',
30+
# socket => 'unix:///var/run//supervisor.sock',
31+
# },
32+
# {
33+
# servername => 'server1',
34+
# hostname => 'localhost',
35+
# port => '9001',
36+
# proc_names => ['java', 'apache2'],
37+
# },
38+
# ],
39+
# }
40+
#
41+
#
42+
#
43+
44+
class datadog_agent::integrations::supervisord (
45+
$instances = [],
46+
) inherits datadog_agent::params {
47+
include datadog_agent
48+
49+
file { "${datadog_agent::params::conf_dir}/supervisord.yaml":
50+
ensure => file,
51+
owner => $datadog_agent::params::dd_user,
52+
group => $datadog_agent::params::dd_group,
53+
mode => '0600',
54+
content => template('datadog_agent/agent-conf.d/supervisord.yaml.erb'),
55+
require => Package[$datadog_agent::params::package_name],
56+
notify => Service[$datadog_agent::params::service_name]
57+
}
58+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#
2+
# There are two ways to get started with the supervisord check.
3+
#
4+
# You can configure inet_http_server in /etc/supervisord.conf. Below is an
5+
# example inet_http_server configuration:
6+
#
7+
# [inet_http_server]
8+
# port:localhost:9001
9+
# username:user # optional
10+
# password:pass # optional
11+
#
12+
# OR, you can use supervisorctl socket to communicate with supervisor.
13+
# If supervisor is running as root, make sure chmod property is set
14+
# to a permission accessible to non-root users. See the example below:
15+
#
16+
# [supervisorctl]
17+
# serverurl=unix:///var/run//supervisor.sock
18+
#
19+
# [unix_http_server]
20+
# file=/var/run/supervisor.sock
21+
# chmod=777
22+
#
23+
# Reload supervisor, specify the inet or unix socket server information
24+
# in this yaml file along with an optional list of the processes you want
25+
# to monitor per instance, and you're good to go!
26+
#
27+
# See http://supervisord.org/configuration.html for more information on
28+
# configuring supervisord sockets and inet http servers.
29+
#
30+
31+
# - name: server0 # Required. An arbitrary name to identify the supervisord server
32+
# host: localhost # Optional. Defaults to localhost. The host where supervisord server is running
33+
# port: 9001 # Optional. Defaults to 9001. The port number.
34+
# user: user # Optional. Required only if a username is configured.
35+
# pass: pass # Optional. Required only if a password is configured.
36+
# proc_regex: # Optional. Regex pattern[s] matching the names of processes to monitor
37+
# - 'myprocess-\d\d$'
38+
# proc_names: # Optional. The process to monitor within this supervisord instance.
39+
# - apache2 # If not specified, the check will monitor all processes.
40+
# - webapp
41+
# - java
42+
# - name: server1
43+
# host: localhost
44+
# port: 9002
45+
# - name: server2
46+
# socket: unix:///var/run//supervisor.sock
47+
# host: http://127.0.0.1 # Optional. Defaults to http://127.0.0.1
48+
49+
50+
init_config:
51+
52+
instances:
53+
<%- (Array(@instances)).each do |instance| -%>
54+
- name: <%= instance['servername'] %>
55+
<% if instance['socket'] -%>
56+
socket: <%= instance['socket'] %>
57+
<% end -%>
58+
<% if instance['hostname'] -%>
59+
host: <%= instance['hostname'] %>
60+
<% end -%>
61+
<% if instance['port'] -%>
62+
port: <%= instance['port'] %>
63+
<% end -%>
64+
<% if instance['username'] -%>
65+
user: <%= instance['username'] %>
66+
<% end -%>
67+
<% if instance['password'] -%>
68+
pass: <%= instance['password'] %>
69+
<% end -%>
70+
<% if instance['proc_names'] and ! instance['proc_names'].empty? -%>
71+
proc_names:
72+
<%- Array(instance['proc_names']).each do |proc_name| -%>
73+
<%- if proc_name != '' -%>
74+
- <%= proc_name %>
75+
<%- end -%>
76+
<%- end -%>
77+
<% end -%>
78+
<% if instance['server_check'] -%>
79+
server_check: <%= instance['server_check'] %>
80+
<% end -%>
81+
<% end -%>

0 commit comments

Comments
 (0)