zabbix_export: version: '5.4' date: '2021-11-21T21:41:30Z' groups: - uuid: 7df96b18c230490a9a0a9e2307226338 name: Templates templates: - uuid: c65949f52dff4172a6acec772455b400 template: ..Docker.OSLinux.ShortTermContainers name: ..Docker.OSLinux.ShortTermContainers description: | ## Description Monitor Docker Container Details ## Overview Template with LLD to discover Docker Containers via Docker socket ([Template.Docker.ContainerDetails](http://127.0.0.1/zabbix/templates.php?form=update&templateid=10264&groupid=1)) and Template [Template..Docker.OSLinux.ShortTermContainers](http://127.0.0.1/zabbix/templates.php?form=update&templateid=10265&groupid=1) with macros to forget short living containers after {$DISCOVERY\_TTL}. ## Author Martin Schroeter ## Overview Template with LLD to discover Docker Containers via Docker socket ([Template.Docker.ContainerDetails](http://127.0.0.1/zabbix/templates.php?form=update&templateid=10264&groupid=1)) and Template [Template..Docker.OSLinux.ShortTermContainers](http://127.0.0.1/zabbix/templates.php?form=update&templateid=10265&groupid=1) with macros to forget short living containers after {$DISCOVERY\_TTL}. ## Author Martin Schroeter templates: - name: .Docker.ContainerDetails groups: - name: Templates macros: - macro: '{$DISCOVERY_TTL}' value: 1d - macro: '{$DISCOVERY_UPDATE_INTERVAL}' value: 60s - macro: '{$ITEM_HISTORY_STORAGE_PERIOD}' value: 14d - macro: '{$ITEM_UPDATE_INTERVAL}' value: 300s - macro: '{$NETWORK_ITEM_UPDATE_INTERVAL}' value: 60s - uuid: 87cee87a12d44c38a29af0468e831065 template: .Docker.ContainerDetails name: .Docker.ContainerDetails description: | ## Description Monitor Docker Container Details ## Overview Template with LLD to discover Docker Containers via Docker socket ([Template.Docker.ContainerDetails](http://127.0.0.1/zabbix/templates.php?form=update&templateid=10264&groupid=1)) and Template [Template..Docker.OSLinux.ShortTermContainers](http://127.0.0.1/zabbix/templates.php?form=update&templateid=10265&groupid=1) with macros to forget short living containers after {$DISCOVERY\_TTL}. ## Author Martin Schroeter groups: - name: Templates discovery_rules: - uuid: 68e4f387e2a34d5980470f5919584d1b name: 'Docker Container Discovery (by Names)' key: 'system.run[echo "{ \"data\": `curl -s --unix-socket /var/run/docker.sock http:/containers/json| {$JQ_DOCKER_NAMES}` }"]' delay: '{$DISCOVERY_UPDATE_INTERVAL}' lifetime: '{$DISCOVERY_TTL}' item_prototypes: - uuid: 5fc8a9fa45e146b08e48aef6de964d6b name: 'Container: {#NAMES}' key: 'system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| jq .Created]' delay: 30s history: 30d trends: '0' value_type: TEXT request_method: POST tags: - tag: Application value: Docker - uuid: a95774ea09e24eef91cc047520877fa7 name: 'Container: {#NAMES} - Status' key: 'system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| jq .State.Status]' delay: 30s history: 30d trends: '0' value_type: TEXT request_method: POST tags: - tag: Application value: Docker - uuid: ac3518a0c5a84aabb9e96a4c951755b4 name: 'Container: {#NAMES} - Env.Branch' key: 'system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| {$JQ_DOCKER_ENV_BRANCH}]' delay: 30s history: 30d trends: '0' value_type: TEXT request_method: POST tags: - tag: Application value: Docker - uuid: 690df1a74d424b3dbc07c22f20d3f8ae name: 'Container: {#NAMES} - Mounts' key: 'system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| {$JQ_DOCKER_MOUNTS}]' delay: 30s history: 30d trends: '0' value_type: TEXT request_method: POST tags: - tag: Application value: Docker - uuid: 787d14a54091418681e204e6437da42e name: 'Container: {#NAMES} - Volumes' key: 'system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| {$JQ_DOCKER_VOLUMES}]' delay: 30s history: 30d trends: '0' value_type: TEXT request_method: POST tags: - tag: Application value: Docker request_method: POST macros: - macro: '{$JQ_DOCKER_ENV_BRANCH}' value: 'jq .Config.Env[0]' - macro: '{$JQ_DOCKER_MOUNTS}' value: 'jq .Mounts[].Destination' - macro: '{$JQ_DOCKER_NAMES}' value: 'jq ''[ .[].Names[0]|{ "{#NAMES}": .} ]''' - macro: '{$JQ_DOCKER_VOLUMES}' value: 'jq .Mounts[].Source'