1 heat_template_version: pike
4 Containerized Sensu client service
7 DockerSensuClientImage:
10 DockerSensuConfigImage:
11 description: The container image to use for the sensu config_volume
15 description: Mapping of service endpoint -> protocol. Typically set
16 via parameter_defaults in the resource registry.
20 description: Dictionary packing service data
24 description: Mapping of service_name -> network name. Typically set
25 via parameter_defaults in the resource registry. This
26 mapping overrides those in ServiceNetMapDefaults.
33 description: Role name on which the service is applied
37 description: Parameters specific to the role
39 SensuDockerCheckCommand:
43 for i in $(docker ps --format '{{.ID}}'); do
44 if result=$(docker inspect --format='{{.State.Health.Status}}' $i 2>/dev/null); then
45 if [ "$result" != 'healthy' ]; then
46 output="${output} ; $(docker inspect --format='{{.Name}}' $i) ($i): $(docker inspect --format='{{(index .State.Health.Log 0).Output}}' $i)";
50 if [ ! -z "${output}" ]; then
51 echo ${output:3} && exit 2;
53 SensuDockerCheckInterval:
55 description: The frequency in seconds the docker health check is executed.
57 SensuDockerCheckHandlers:
59 description: The Sensu event handler to use for events
60 created by the docker health check.
61 type: comma_delimited_list
62 SensuDockerCheckOccurrences:
64 description: The number of event occurrences before sensu-plugin-aware handler should take action.
66 SensuDockerCheckRefresh:
68 description: The number of seconds sensu-plugin-aware handlers should wait before taking second action.
74 type: ./containers-common.yaml
77 type: ../../puppet/services/monitoring/sensu-client.yaml
79 EndpointMap: {get_param: EndpointMap}
80 ServiceData: {get_param: ServiceData}
81 ServiceNetMap: {get_param: ServiceNetMap}
82 DefaultPasswords: {get_param: DefaultPasswords}
86 description: Role data for the Sensu client role.
88 service_name: {get_attr: [SensuClientBase, role_data, service_name]}
91 - get_attr: [SensuClientBase, role_data, config_settings]
95 command: {get_param: SensuDockerCheckCommand}
96 interval: {get_param: SensuDockerCheckInterval}
97 handlers: {get_param: SensuDockerCheckHandlers}
98 occurrences: {get_param: SensuDockerCheckOccurrences}
99 refresh: {get_param: SensuDockerCheckRefresh}
100 step_config: &step_config
101 get_attr: [SensuClientBase, role_data, step_config]
102 service_config_settings: {get_attr: [SensuClientBase, role_data, service_config_settings]}
103 # BEGIN DOCKER SETTINGS
106 puppet_tags: sensu_rabbitmq_config,sensu_client_config,sensu_check_config,sensu_check
107 step_config: *step_config
108 config_image: {get_param: DockerSensuConfigImage}
110 /var/lib/kolla/config_files/sensu-client.json:
111 command: /usr/bin/sensu-client -d /etc/sensu/conf.d/ -l /var/log/sensu/sensu-client.log
113 - source: "/var/lib/kolla/config_files/src/*"
116 preserve_properties: true
118 - path: /var/log/sensu
124 image: {get_param: DockerSensuClientImage}
127 # NOTE(mmagr) kolla image changes the user to 'sensu', we need it
128 # to be root have rw permission to docker.sock to run successfully
129 # "docker inspect" command
134 - {get_attr: [ContainersCommon, volumes]}
136 - /var/run/docker.sock:/var/run/docker.sock:rw
137 - /var/lib/kolla/config_files/sensu-client.json:/var/lib/kolla/config_files/config.json:ro
138 - /var/lib/config-data/puppet-generated/sensu/:/var/lib/kolla/config_files/src:ro
139 - /var/log/containers/sensu:/var/log/sensu:rw
141 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
143 - name: create persistent logs directory
145 path: /var/log/containers/sensu
148 - name: Stop and disable sensu-client service
150 service: name=sensu-client.service state=stopped enabled=no