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: Mapping of service_name -> network name. Typically set
21 via parameter_defaults in the resource registry. This
22 mapping overrides those in ServiceNetMapDefaults.
29 description: Role name on which the service is applied
33 description: Parameters specific to the role
35 SensuDockerCheckCommand:
38 for i in $(docker ps --format '{{.ID}}'); do
39 if result=$(docker inspect --format='{{.State.Health.Status}}' $i 2>/dev/null); then
40 if [ "$result" != 'healthy' ]; then
41 echo "$(docker inspect --format='{{.Name}}' $i) ($i): $(docker inspect --format='{{json .State}}' $i)" && exit 2;
45 SensuDockerCheckInterval:
47 description: The frequency in seconds the docker health check is executed.
49 SensuDockerCheckHandlers:
51 description: The Sensu event handler to use for events
52 created by the docker health check.
53 type: comma_delimited_list
54 SensuDockerCheckOccurrences:
56 description: The number of event occurrences before sensu-plugin-aware handler should take action.
58 SensuDockerCheckRefresh:
60 description: The number of seconds sensu-plugin-aware handlers should wait before taking second action.
66 type: ./containers-common.yaml
69 type: ../../puppet/services/monitoring/sensu-client.yaml
71 EndpointMap: {get_param: EndpointMap}
72 ServiceNetMap: {get_param: ServiceNetMap}
73 DefaultPasswords: {get_param: DefaultPasswords}
77 description: Role data for the Sensu client role.
79 service_name: {get_attr: [SensuClientBase, role_data, service_name]}
82 - get_attr: [SensuClientBase, role_data, config_settings]
86 command: {get_param: SensuDockerCheckCommand}
87 interval: {get_param: SensuDockerCheckInterval}
88 handlers: {get_param: SensuDockerCheckHandlers}
89 occurrences: {get_param: SensuDockerCheckOccurrences}
90 refresh: {get_param: SensuDockerCheckRefresh}
91 step_config: &step_config
92 get_attr: [SensuClientBase, role_data, step_config]
93 service_config_settings: {get_attr: [SensuClientBase, role_data, service_config_settings]}
94 # BEGIN DOCKER SETTINGS
97 puppet_tags: sensu_rabbitmq_config,sensu_client_config,sensu_check_config,sensu_check
98 step_config: *step_config
99 config_image: {get_param: DockerSensuConfigImage}
101 /var/lib/kolla/config_files/sensu-client.json:
102 command: /usr/bin/sensu-client -d /etc/sensu/conf.d/ -l /var/log/sensu/sensu-client.log
104 - source: "/var/lib/kolla/config_files/src/*"
107 preserve_properties: true
109 - path: /var/log/sensu
115 image: {get_param: DockerSensuClientImage}
118 # NOTE(mmagr) kolla image changes the user to 'sensu', we need it
119 # to be root have rw permission to docker.sock to run successfully
120 # "docker inspect" command
125 - {get_attr: [ContainersCommon, volumes]}
127 - /var/run/docker.sock:/var/run/docker.sock:rw
128 - /var/lib/kolla/config_files/sensu-client.json:/var/lib/kolla/config_files/config.json:ro
129 - /var/lib/config-data/puppet-generated/sensu/:/var/lib/kolla/config_files/src:ro
130 - /var/log/containers/sensu:/var/log/sensu:rw
132 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
134 - name: create persistent logs directory
136 path: /var/log/containers/sensu
139 - name: Stop and disable sensu-client service
141 service: name=sensu-client.service state=stopped enabled=no