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:
42 for i in $(docker ps --format '{{.ID}}'); do
43 if result=$(docker inspect --format='{{.State.Health.Status}}' $i 2>/dev/null); then
44 if [ "$result" != 'healthy' ]; then
45 echo "$(docker inspect --format='{{.Name}}' $i) ($i): $(docker inspect --format='{{json .State}}' $i)" && exit 2;
49 SensuDockerCheckInterval:
51 description: The frequency in seconds the docker health check is executed.
53 SensuDockerCheckHandlers:
55 description: The Sensu event handler to use for events
56 created by the docker health check.
57 type: comma_delimited_list
58 SensuDockerCheckOccurrences:
60 description: The number of event occurrences before sensu-plugin-aware handler should take action.
62 SensuDockerCheckRefresh:
64 description: The number of seconds sensu-plugin-aware handlers should wait before taking second action.
70 type: ./containers-common.yaml
73 type: ../../puppet/services/monitoring/sensu-client.yaml
75 EndpointMap: {get_param: EndpointMap}
76 ServiceData: {get_param: ServiceData}
77 ServiceNetMap: {get_param: ServiceNetMap}
78 DefaultPasswords: {get_param: DefaultPasswords}
82 description: Role data for the Sensu client role.
84 service_name: {get_attr: [SensuClientBase, role_data, service_name]}
87 - get_attr: [SensuClientBase, role_data, config_settings]
91 command: {get_param: SensuDockerCheckCommand}
92 interval: {get_param: SensuDockerCheckInterval}
93 handlers: {get_param: SensuDockerCheckHandlers}
94 occurrences: {get_param: SensuDockerCheckOccurrences}
95 refresh: {get_param: SensuDockerCheckRefresh}
96 step_config: &step_config
97 get_attr: [SensuClientBase, role_data, step_config]
98 service_config_settings: {get_attr: [SensuClientBase, role_data, service_config_settings]}
99 # BEGIN DOCKER SETTINGS
102 puppet_tags: sensu_rabbitmq_config,sensu_client_config,sensu_check_config,sensu_check
103 step_config: *step_config
104 config_image: {get_param: DockerSensuConfigImage}
106 /var/lib/kolla/config_files/sensu-client.json:
107 command: /usr/bin/sensu-client -d /etc/sensu/conf.d/ -l /var/log/sensu/sensu-client.log
109 - source: "/var/lib/kolla/config_files/src/*"
112 preserve_properties: true
114 - path: /var/log/sensu
120 image: {get_param: DockerSensuClientImage}
123 # NOTE(mmagr) kolla image changes the user to 'sensu', we need it
124 # to be root have rw permission to docker.sock to run successfully
125 # "docker inspect" command
130 - {get_attr: [ContainersCommon, volumes]}
132 - /var/run/docker.sock:/var/run/docker.sock:rw
133 - /var/lib/kolla/config_files/sensu-client.json:/var/lib/kolla/config_files/config.json:ro
134 - /var/lib/config-data/puppet-generated/sensu/:/var/lib/kolla/config_files/src:ro
135 - /var/log/containers/sensu:/var/log/sensu:rw
137 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
139 - name: create persistent logs directory
141 path: /var/log/containers/sensu
144 - name: Stop and disable sensu-client service
146 service: name=sensu-client.service state=stopped enabled=no