templates/agent-conf.d/supervisord.yaml.erb (78 lines of code) (raw):
### MANAGED BY PUPPET
#
# There are two ways to get started with the supervisord check.
#
# You can configure inet_http_server in /etc/supervisord.conf. Below is an
# example inet_http_server configuration:
#
# [inet_http_server]
# port:localhost:9001
# username:user # optional
# password:pass # optional
#
# OR, you can use supervisorctl socket to communicate with supervisor.
# If supervisor is running as root, make sure chmod property is set
# to a permission accessible to non-root users. See the example below:
#
# [supervisorctl]
# serverurl=unix:///var/run//supervisor.sock
#
# [unix_http_server]
# file=/var/run/supervisor.sock
# chmod=777
#
# Reload supervisor, specify the inet or unix socket server information
# in this yaml file along with an optional list of the processes you want
# to monitor per instance, and you're good to go!
#
# See http://supervisord.org/configuration.html for more information on
# configuring supervisord sockets and inet http servers.
#
# - name: server0 # Required. An arbitrary name to identify the supervisord server
# host: localhost # Optional. Defaults to localhost. The host where supervisord server is running
# port: 9001 # Optional. Defaults to 9001. The port number.
# user: user # Optional. Required only if a username is configured.
# pass: pass # Optional. Required only if a password is configured.
# proc_regex: # Optional. Regex pattern[s] matching the names of processes to monitor
# - 'myprocess-\d\d$'
# proc_names: # Optional. The process to monitor within this supervisord instance.
# - apache2 # If not specified, the check will monitor all processes.
# - webapp
# - java
# - name: server1
# host: localhost
# port: 9002
# - name: server2
# socket: unix:///var/run//supervisor.sock
# host: http://127.0.0.1 # Optional. Defaults to http://127.0.0.1
init_config:
instances:
<%- (Array(@instances)).each do |instance| -%>
- name: <%= instance['servername'] %>
<% if instance['socket'] -%>
socket: <%= instance['socket'] %>
<% end -%>
<% if instance['hostname'] -%>
host: <%= instance['hostname'] %>
<% end -%>
<% if instance['port'] -%>
port: <%= instance['port'] %>
<% end -%>
<% if instance['username'] -%>
user: <%= instance['username'] %>
<% end -%>
<% if instance['password'] -%>
pass: <%= instance['password'] %>
<% end -%>
<% if instance['proc_names'] and ! instance['proc_names'].empty? -%>
proc_names:
<%- Array(instance['proc_names']).each do |proc_name| -%>
<%- if proc_name != '' -%>
- <%= proc_name %>
<%- end -%>
<%- end -%>
<% end -%>
<% if instance['server_check'] -%>
server_check: <%= instance['server_check'] %>
<% end -%>
<% end -%>