Hi Behrang, Comments inline...
> On 20-Nov-2017, at 10:19 AM, Behrang Saeedzadeh <[email protected]> wrote: > > Sensu is monitoring services like Nagios and the things it should monitor can > be configured with JSON check definition files. > > A JSON check definition file can have one or more check definitions. Here is > a simplified example: > > { > "checks": { > "cron": { > "command": "check-process.rb -p cron", > "interval": 60 > } > } > } > > Let's say I have defined the following template for generating check files: > > { > "checks": { > {% for check_def in item.check_defs %} > "{{ check_def.name }}": { > "command": "{{ check_def.command }}", > "interval": {{ check_def.check_interval }} > }{{ ',' if not loop.last else '' }} > {% endfor %} > } > } <snipped a lot> I am using Ansible to manage checks.json myself but am doing so with the Sensu module from http://docs.ansible.com/ansible/latest/sensu_check_module.html as below: name: Updating checks in - /etc/sensu/conf.d/{{sensu_check_filename|default(check_filename)}} sensu_check: #path: "{{ sensu_check_filename|default(check_filename) }}" path: /etc/sensu/conf.d/checks.json name: "{{ item.name }}" command: "{{ item.command }}" interval: "{{ item.interval|default(check_interval) }}" metric: "{{ item.metric | default('no') }}" handle: "{{ item.handle | default('yes') }}" occurrences: "{{ item.occurrences | default(check_occurrences) }}" timeout: "{{ item.timeout | default(check_timeout) }}" dependencies: "{{ item.dependencies | default(omit) }}" subscribers: "{{ item.subscribers|default(default_subscribers) }}" handlers: "{{ item.handlers | default(omit) }}" refresh: "{{ item.refresh | default(check_refresh) }}" state: "{{ item.state | default('present') }}" standalone: "{{ item.standalone | default('no') }}" ttl: "{{ item.ttl | default(900) }}" aggregate: "{{ item.aggregate | default('no') }}" subdue_begin: "{{ item.subdue_begin | default(omit) }}" subdue_end: "{{ item.subdue_end | default(omit) }}" source: "{{ item.source | default(omit) }}" low_flap_threshold: "{{ item.low_flap_threshold | default(omit) }}" high_flap_threshold: "{{ item.high_flap_threshold | default(omit) }}" notify: - restart_sensu_server - restart_sensu_client - restart_sensu_api with_items: "{{ _sensu_check_list|sort }}" Is there any particular reason why you chose to use a template? Regards. @shankerbalan -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/681B8BEF-9892-40B4-98D3-90BC780997DC%40shankerbalan.net. For more options, visit https://groups.google.com/d/optout.
