# Zabbix agent config for ppm

{%- set ns = namespace() -%}
{%- set ns.allchecks = [] -%}
{%- for app in otherapps -%}
{%- if "monitoring" in otherapps[app]["imports"] -%}
{%- for check in otherapps[app]["imports"]["monitoring"]["checks"] %}
{%- set ns.allchecks = ns.allchecks + [check | combine({'app':app})] -%}
{% endfor -%}{%- endif -%}{%- endfor %}

UserParameter=ppm.discover,/bin/echo '{{ ns.allchecks | tojson }}'
UserParameter=ppm.app[*],/bin/bash -c 'echo $2 | nc -U {{ statedir }}/$1.monitoring'