fix: lint

This commit is contained in:
Danil Kovtonyuk 2022-01-19 22:11:00 +10:00
parent b103033103
commit 31d697701e
No known key found for this signature in database
GPG Key ID: E72A919BF08C3746
4 changed files with 279 additions and 379 deletions

View File

@ -1,6 +1,7 @@
# Installing the Zabbix server # Installing the Zabbix server
Change default passwords, ports and set listen IP (ports `8080/tcp` and `10051/tcp` will be open on all interfaces, use a firewall or specify the address of the required interface), then run: Change default passwords, ports and set listen IP (ports `8080/tcp` and `10051/tcp` will be open on all interfaces, use a firewall or specify the address of the required interface), then run:
```bash ```bash
wget https://github.com/tornadocash/tornado-relayer/raw/master/monitoring/zabbix.tar.gz wget https://github.com/tornadocash/tornado-relayer/raw/master/monitoring/zabbix.tar.gz
mkdir $HOME/monitoring/ mkdir $HOME/monitoring/
@ -12,18 +13,21 @@ docker-compose up -d
# Installing the Zabbix agent # Installing the Zabbix agent
Download package from repository [https://repo.zabbix.com/zabbix/5.2/ubuntu/pool/main/z/zabbix/](https://repo.zabbix.com/zabbix/5.2/ubuntu/pool/main/z/zabbix/) and run: Download package from repository [https://repo.zabbix.com/zabbix/5.2/ubuntu/pool/main/z/zabbix/](https://repo.zabbix.com/zabbix/5.2/ubuntu/pool/main/z/zabbix/) and run:
```bash ```bash
sudo dpkg -i zabbix-agent_5.2.*.deb sudo dpkg -i zabbix-agent_5.2.*.deb
sudo usermod -aG docker zabbix sudo usermod -aG docker zabbix
``` ```
Change default values in `/etc/zabbix/zabbix_agent2.conf`: Change default values in `/etc/zabbix/zabbix_agent2.conf`:
* `Hostname` the same as in the zabbix-server web interface; - `Hostname` the same as in the zabbix-server web interface;
* `Server` and `ServerActive` set zabbix server IP or DNS name; - `Server` and `ServerActive` set zabbix server IP or DNS name;
* `ListenIP` to local network IP available from zabbix server or set firewall rules to restrict access to port `10050`; - `ListenIP` to local network IP available from zabbix server or set firewall rules to restrict access to port `10050`;
* uncomment `Plugins.Docker.Endpoint=unix:///var/run/docker.sock`. - uncomment `Plugins.Docker.Endpoint=unix:///var/run/docker.sock`.
Then run: Then run:
```bash ```bash
sudo systemctl enable zabbix-agent2.service sudo systemctl enable zabbix-agent2.service
sudo systemctl restart zabbix-agent2.service sudo systemctl restart zabbix-agent2.service
@ -36,14 +40,16 @@ Log into your Zabbix server (defaul login and passord: `Admin` - `zabbix`) and c
# Import templates # Import templates
Import templates using the WebUI: Import templates using the WebUI:
* [Docker-template.yaml](/monitoring/templates/Docker-template.yaml);
* [Tornado-relayer-template.yaml](/monitoring/templates/Tornado-relayer-template.yaml). - [Docker-template.yaml](/monitoring/templates/Docker-template.yaml);
- [Tornado-relayer-template.yaml](/monitoring/templates/Tornado-relayer-template.yaml).
Link templates with added host. It is also recommended to link `Linux CPU by Zabbix agent`, `Linux filesystems by Zabbix agent` and `Linux memory by Zabbix agent` templates to the host. Link templates with added host. It is also recommended to link `Linux CPU by Zabbix agent`, `Linux filesystems by Zabbix agent` and `Linux memory by Zabbix agent` templates to the host.
# Alerts # Alerts
In WebUI - Administration -> Media types -> Telegram: In WebUI - Administration -> Media types -> Telegram:
``` ```
https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/telegram https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/telegram

View File

@ -2,179 +2,179 @@
version: '3.5' version: '3.5'
services: services:
zabbix-server: zabbix-server:
image: zabbix/zabbix-server-pgsql:alpine-5.2-latest image: zabbix/zabbix-server-pgsql:alpine-5.2-latest
restart: always restart: always
ports: ports:
- "10051:10051" - '10051:10051'
volumes: volumes:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro - ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro - ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw - ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export:rw
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro - ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro - ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro - ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs:ro
- ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro - ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:ro
ulimits: ulimits:
nproc: 65535 nproc: 65535
nofile: nofile:
soft: 20000 soft: 20000
hard: 40000 hard: 40000
deploy: deploy:
resources: resources:
limits: limits:
cpus: '0.70' cpus: '0.70'
memory: 1G memory: 1G
reservations: reservations:
cpus: '0.5' cpus: '0.5'
memory: 512M memory: 512M
env_file: env_file:
- .env_db_pgsql - .env_db_pgsql
- .env_srv - .env_srv
secrets: secrets:
- POSTGRES_USER - POSTGRES_USER
- POSTGRES_PASSWORD - POSTGRES_PASSWORD
depends_on: depends_on:
- postgres-server - postgres-server
networks: networks:
zbx_net_backend: zbx_net_backend:
aliases: aliases:
- zabbix-server
- zabbix-server-pgsql
- zabbix-server-alpine-pgsql
- zabbix-server-pgsql-alpine
zbx_net_frontend:
stop_grace_period: 30s
sysctls:
- net.ipv4.ip_local_port_range=1024 65000
- net.ipv4.conf.all.accept_redirects=0
- net.ipv4.conf.all.secure_redirects=0
- net.ipv4.conf.all.send_redirects=0
labels:
com.zabbix.description: 'Zabbix server with PostgreSQL database support'
com.zabbix.company: 'Zabbix LLC'
com.zabbix.component: 'zabbix-server'
com.zabbix.dbtype: 'pgsql'
com.zabbix.os: 'alpine'
zabbix-web:
image: zabbix/zabbix-web-nginx-pgsql:alpine-5.2-latest
restart: always
ports:
- '8080:8080'
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro
deploy:
resources:
limits:
cpus: '0.70'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
env_file:
- .env_db_pgsql
- .env_web
secrets:
- POSTGRES_USER
- POSTGRES_PASSWORD
depends_on:
- postgres-server
- zabbix-server - zabbix-server
- zabbix-server-pgsql healthcheck:
- zabbix-server-alpine-pgsql test: ['CMD', 'curl', '-f', 'http://localhost:8080/']
- zabbix-server-pgsql-alpine interval: 10s
zbx_net_frontend: timeout: 5s
stop_grace_period: 30s retries: 3
sysctls: networks:
- net.ipv4.ip_local_port_range=1024 65000 zbx_net_backend:
- net.ipv4.conf.all.accept_redirects=0 aliases:
- net.ipv4.conf.all.secure_redirects=0 - zabbix-web-nginx-pgsql
- net.ipv4.conf.all.send_redirects=0 - zabbix-web-nginx-alpine-pgsql
labels: - zabbix-web-nginx-pgsql-alpine
com.zabbix.description: "Zabbix server with PostgreSQL database support" zbx_net_frontend:
com.zabbix.company: "Zabbix LLC" stop_grace_period: 10s
com.zabbix.component: "zabbix-server" sysctls:
com.zabbix.dbtype: "pgsql" - net.core.somaxconn=65535
com.zabbix.os: "alpine" labels:
com.zabbix.description: 'Zabbix frontend on Nginx web-server with PostgreSQL database support'
com.zabbix.company: 'Zabbix LLC'
com.zabbix.component: 'zabbix-frontend'
com.zabbix.webserver: 'nginx'
com.zabbix.dbtype: 'pgsql'
com.zabbix.os: 'alpine'
zabbix-web: zabbix-agent:
image: zabbix/zabbix-web-nginx-pgsql:alpine-5.2-latest image: zabbix/zabbix-agent2:alpine-5.2-latest
restart: always restart: always
ports: volumes:
- "8080:8080" - /etc/localtime:/etc/localtime:ro
volumes: - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock
- /etc/timezone:/etc/timezone:ro env_file:
- ./zbx_env/etc/ssl/nginx:/etc/ssl/nginx:ro - .env_agent
- ./zbx_env/usr/share/zabbix/modules/:/usr/share/zabbix/modules/:ro privileged: true
deploy: user: root
resources: pid: 'host'
limits: networks:
cpus: '0.70' zbx_net_backend:
memory: 512M aliases:
reservations: - zabbix-agent
cpus: '0.5' - zabbix-agent-passive
memory: 256M - zabbix-agent-alpine
env_file: stop_grace_period: 5s
- .env_db_pgsql
- .env_web
secrets:
- POSTGRES_USER
- POSTGRES_PASSWORD
depends_on:
- postgres-server
- zabbix-server
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 10s
timeout: 5s
retries: 3
networks:
zbx_net_backend:
aliases:
- zabbix-web-nginx-pgsql
- zabbix-web-nginx-alpine-pgsql
- zabbix-web-nginx-pgsql-alpine
zbx_net_frontend:
stop_grace_period: 10s
sysctls:
- net.core.somaxconn=65535
labels:
com.zabbix.description: "Zabbix frontend on Nginx web-server with PostgreSQL database support"
com.zabbix.company: "Zabbix LLC"
com.zabbix.component: "zabbix-frontend"
com.zabbix.webserver: "nginx"
com.zabbix.dbtype: "pgsql"
com.zabbix.os: "alpine"
zabbix-agent: postgres-server:
image: zabbix/zabbix-agent2:alpine-5.2-latest image: postgres:alpine
restart: always restart: always
volumes: volumes:
- /etc/localtime:/etc/localtime:ro - ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw
- /etc/timezone:/etc/timezone:ro env_file:
- /var/run/docker.sock:/var/run/docker.sock - .env_db_pgsql
env_file: secrets:
- .env_agent - POSTGRES_USER
privileged: true - POSTGRES_PASSWORD
user: root stop_grace_period: 1m
pid: "host" networks:
networks: zbx_net_backend:
zbx_net_backend: aliases:
aliases: - postgres-server
- zabbix-agent - pgsql-server
- zabbix-agent-passive - pgsql-database
- zabbix-agent-alpine
stop_grace_period: 5s
postgres-server: portainer:
image: postgres:alpine image: portainer/portainer:latest
restart: always restart: always
volumes: ports:
- ./zbx_env/var/lib/postgresql/data:/var/lib/postgresql/data:rw - '9000:9000'
env_file: volumes:
- .env_db_pgsql - /var/run/docker.sock:/var/run/docker.sock
secrets: - portainer-data:/data
- POSTGRES_USER
- POSTGRES_PASSWORD
stop_grace_period: 1m
networks:
zbx_net_backend:
aliases:
- postgres-server
- pgsql-server
- pgsql-database
portainer:
image: portainer/portainer:latest
restart: always
ports:
- "9000:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer-data:/data
networks: networks:
zbx_net_frontend: zbx_net_frontend:
driver: bridge driver: bridge
driver_opts: driver_opts:
com.docker.network.enable_ipv6: "false" com.docker.network.enable_ipv6: 'false'
ipam: ipam:
driver: default driver: default
config: config:
- subnet: 172.16.238.0/24 - subnet: 172.16.238.0/24
zbx_net_backend: zbx_net_backend:
driver: bridge driver: bridge
driver_opts: driver_opts:
com.docker.network.enable_ipv6: "false" com.docker.network.enable_ipv6: 'false'
internal: true internal: true
ipam: ipam:
driver: default driver: default
config: config:
- subnet: 172.16.239.0/24 - subnet: 172.16.239.0/24
secrets: secrets:
POSTGRES_USER: POSTGRES_USER:

View File

@ -2,11 +2,9 @@ zabbix_export:
version: '5.2' version: '5.2'
date: '2021-11-29T12:29:17Z' date: '2021-11-29T12:29:17Z'
groups: groups:
- - name: Docker
name: Docker
templates: templates:
- - template: Docker
template: Docker
name: Docker name: Docker
description: | description: |
Get Docker engine metrics from plugin for the New Zabbix Agent (zabbix-agent2). Get Docker engine metrics from plugin for the New Zabbix Agent (zabbix-agent2).
@ -15,117 +13,94 @@ zabbix_export:
Template tooling version used: 0.38 Template tooling version used: 0.38
groups: groups:
- - name: Docker
name: Docker
applications: applications:
- - name: Docker
name: Docker - name: 'Zabbix raw items'
-
name: 'Zabbix raw items'
items: items:
- - name: 'Docker: Get containers'
name: 'Docker: Get containers'
key: docker.containers key: docker.containers
history: '0' history: '0'
trends: '0' trends: '0'
value_type: TEXT value_type: TEXT
applications: applications:
- - name: 'Zabbix raw items'
name: 'Zabbix raw items' - name: 'Docker: Containers paused'
-
name: 'Docker: Containers paused'
type: DEPENDENT type: DEPENDENT
key: docker.containers.paused key: docker.containers.paused
delay: '0' delay: '0'
history: 7d history: 7d
description: 'Total number of containers paused on this host' description: 'Total number of containers paused on this host'
applications: applications:
- - name: Docker
name: Docker
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.ContainersPaused - $.ContainersPaused
master_item: master_item:
key: docker.info key: docker.info
- - name: 'Docker: Containers running'
name: 'Docker: Containers running'
type: DEPENDENT type: DEPENDENT
key: docker.containers.running key: docker.containers.running
delay: '0' delay: '0'
history: 7d history: 7d
description: 'Total number of containers running on this host' description: 'Total number of containers running on this host'
applications: applications:
- - name: Docker
name: Docker
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.ContainersRunning - $.ContainersRunning
master_item: master_item:
key: docker.info key: docker.info
- - name: 'Docker: Containers stopped'
name: 'Docker: Containers stopped'
type: DEPENDENT type: DEPENDENT
key: docker.containers.stopped key: docker.containers.stopped
delay: '0' delay: '0'
history: 7d history: 7d
description: 'Total number of containers stopped on this host' description: 'Total number of containers stopped on this host'
applications: applications:
- - name: Docker
name: Docker
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.ContainersStopped - $.ContainersStopped
master_item: master_item:
key: docker.info key: docker.info
triggers: triggers:
- - expression: '{avg(5m)}>=1'
expression: '{avg(5m)}>=1'
name: 'Docker: containers is stopped' name: 'Docker: containers is stopped'
priority: HIGH priority: HIGH
- - name: 'Docker: Containers total'
name: 'Docker: Containers total'
type: DEPENDENT type: DEPENDENT
key: docker.containers.total key: docker.containers.total
delay: '0' delay: '0'
history: 7d history: 7d
description: 'Total number of containers on this host' description: 'Total number of containers on this host'
applications: applications:
- - name: Docker
name: Docker
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.Containers - $.Containers
master_item: master_item:
key: docker.info key: docker.info
- - name: 'Docker: Get images'
name: 'Docker: Get images'
key: docker.images key: docker.images
history: '0' history: '0'
trends: '0' trends: '0'
status: DISABLED status: DISABLED
value_type: TEXT value_type: TEXT
applications: applications:
- - name: 'Zabbix raw items'
name: 'Zabbix raw items' - name: 'Docker: Get info'
-
name: 'Docker: Get info'
key: docker.info key: docker.info
history: '0' history: '0'
trends: '0' trends: '0'
value_type: TEXT value_type: TEXT
applications: applications:
- - name: 'Zabbix raw items'
name: 'Zabbix raw items' - name: 'Docker: Memory total'
-
name: 'Docker: Memory total'
type: DEPENDENT type: DEPENDENT
key: docker.mem.total key: docker.mem.total
delay: '0' delay: '0'
@ -133,49 +108,40 @@ zabbix_export:
status: DISABLED status: DISABLED
units: B units: B
applications: applications:
- - name: Docker
name: Docker
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.MemTotal - $.MemTotal
master_item: master_item:
key: docker.info key: docker.info
- - name: 'Docker: Ping'
name: 'Docker: Ping'
key: docker.ping key: docker.ping
history: 7h history: 7h
applications: applications:
- - name: Docker
name: Docker
valuemap: valuemap:
name: 'Service state' name: 'Service state'
preprocessing: preprocessing:
- - type: DISCARD_UNCHANGED_HEARTBEAT
type: DISCARD_UNCHANGED_HEARTBEAT
parameters: parameters:
- 10m - 10m
triggers: triggers:
- - expression: '{last()}=0'
expression: '{last()}=0'
name: 'Docker: Service is down' name: 'Docker: Service is down'
priority: AVERAGE priority: AVERAGE
manual_close: 'YES' manual_close: 'YES'
discovery_rules: discovery_rules:
- - name: 'Containers discovery'
name: 'Containers discovery'
key: 'docker.containers.discovery[true]' key: 'docker.containers.discovery[true]'
delay: 15m delay: 15m
filter: filter:
evaltype: AND evaltype: AND
conditions: conditions:
- - macro: '{#NAME}'
macro: '{#NAME}'
value: '{$DOCKER.LLD.FILTER.CONTAINER.MATCHES}' value: '{$DOCKER.LLD.FILTER.CONTAINER.MATCHES}'
formulaid: A formulaid: A
- - macro: '{#NAME}'
macro: '{#NAME}'
value: '{$DOCKER.LLD.FILTER.CONTAINER.NOT_MATCHES}' value: '{$DOCKER.LLD.FILTER.CONTAINER.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX operator: NOT_MATCHES_REGEX
formulaid: B formulaid: B
@ -186,8 +152,7 @@ zabbix_export:
true - Returns all containers true - Returns all containers
false - Returns only running containers false - Returns only running containers
item_prototypes: item_prototypes:
- - name: 'Container {#NAME}: Finished at'
name: 'Container {#NAME}: Finished at'
type: DEPENDENT type: DEPENDENT
key: 'docker.container_info.finished["{#NAME}"]' key: 'docker.container_info.finished["{#NAME}"]'
delay: '0' delay: '0'
@ -195,43 +160,35 @@ zabbix_export:
value_type: FLOAT value_type: FLOAT
units: unixtime units: unixtime
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.State.FinishedAt - $.State.FinishedAt
- - type: DISCARD_UNCHANGED_HEARTBEAT
type: DISCARD_UNCHANGED_HEARTBEAT
parameters: parameters:
- 1d - 1d
master_item: master_item:
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
- - name: 'Container {#NAME}: Restart count'
name: 'Container {#NAME}: Restart count'
type: DEPENDENT type: DEPENDENT
key: 'docker.container_info.restart_count["{#NAME}"]' key: 'docker.container_info.restart_count["{#NAME}"]'
delay: '0' delay: '0'
history: 7d history: 7d
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.RestartCount - $.RestartCount
master_item: master_item:
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
trigger_prototypes: trigger_prototypes:
- - expression: '{last()}>5'
expression: '{last()}>5'
name: 'Container {#NAME}: restarting constantly' name: 'Container {#NAME}: restarting constantly'
opdata: '{ITEM.VALUE}' opdata: '{ITEM.VALUE}'
priority: HIGH priority: HIGH
- - name: 'Container {#NAME}: Started at'
name: 'Container {#NAME}: Started at'
type: DEPENDENT type: DEPENDENT
key: 'docker.container_info.started["{#NAME}"]' key: 'docker.container_info.started["{#NAME}"]'
delay: '0' delay: '0'
@ -239,21 +196,17 @@ zabbix_export:
value_type: FLOAT value_type: FLOAT
units: unixtime units: unixtime
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.State.StartedAt - $.State.StartedAt
- - type: DISCARD_UNCHANGED_HEARTBEAT
type: DISCARD_UNCHANGED_HEARTBEAT
parameters: parameters:
- 1d - 1d
master_item: master_item:
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
- - name: 'Container {#NAME}: Error'
name: 'Container {#NAME}: Error'
type: DEPENDENT type: DEPENDENT
key: 'docker.container_info.state.error["{#NAME}"]' key: 'docker.container_info.state.error["{#NAME}"]'
delay: '0' delay: '0'
@ -261,114 +214,93 @@ zabbix_export:
trends: '0' trends: '0'
value_type: CHAR value_type: CHAR
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.State.Error - $.State.Error
- - type: DISCARD_UNCHANGED_HEARTBEAT
type: DISCARD_UNCHANGED_HEARTBEAT
parameters: parameters:
- 1d - 1d
master_item: master_item:
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
trigger_prototypes: trigger_prototypes:
- - expression: '{diff()}=1 and {strlen()}>0'
expression: '{diff()}=1 and {strlen()}>0'
name: 'Container {#NAME}: An error has occurred in the container' name: 'Container {#NAME}: An error has occurred in the container'
priority: WARNING priority: WARNING
description: 'Container {#NAME} has an error. Ack to close.' description: 'Container {#NAME} has an error. Ack to close.'
manual_close: 'YES' manual_close: 'YES'
- - name: 'Container {#NAME}: Exit code'
name: 'Container {#NAME}: Exit code'
type: DEPENDENT type: DEPENDENT
key: 'docker.container_info.state.exitcode["{#NAME}"]' key: 'docker.container_info.state.exitcode["{#NAME}"]'
delay: '0' delay: '0'
history: 7d history: 7d
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.State.ExitCode - $.State.ExitCode
- - type: DISCARD_UNCHANGED_HEARTBEAT
type: DISCARD_UNCHANGED_HEARTBEAT
parameters: parameters:
- 1d - 1d
master_item: master_item:
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
- - name: 'Container {#NAME}: Paused'
name: 'Container {#NAME}: Paused'
type: DEPENDENT type: DEPENDENT
key: 'docker.container_info.state.paused["{#NAME}"]' key: 'docker.container_info.state.paused["{#NAME}"]'
delay: '0' delay: '0'
history: 7d history: 7d
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
valuemap: valuemap:
name: 'Docker flag' name: 'Docker flag'
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.State.Paused - $.State.Paused
- - type: BOOL_TO_DECIMAL
type: BOOL_TO_DECIMAL
parameters: parameters:
- '' - ''
master_item: master_item:
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
- - name: 'Container {#NAME}: Restarting'
name: 'Container {#NAME}: Restarting'
type: DEPENDENT type: DEPENDENT
key: 'docker.container_info.state.restarting["{#NAME}"]' key: 'docker.container_info.state.restarting["{#NAME}"]'
delay: '0' delay: '0'
history: 7d history: 7d
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
valuemap: valuemap:
name: 'Docker flag' name: 'Docker flag'
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.State.Restarting - $.State.Restarting
- - type: BOOL_TO_DECIMAL
type: BOOL_TO_DECIMAL
parameters: parameters:
- '' - ''
master_item: master_item:
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
- - name: 'Container {#NAME}: Running'
name: 'Container {#NAME}: Running'
type: DEPENDENT type: DEPENDENT
key: 'docker.container_info.state.running["{#NAME}"]' key: 'docker.container_info.state.running["{#NAME}"]'
delay: '0' delay: '0'
history: 7d history: 7d
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
valuemap: valuemap:
name: 'Docker flag' name: 'Docker flag'
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.State.Running - $.State.Running
- - type: BOOL_TO_DECIMAL
type: BOOL_TO_DECIMAL
parameters: parameters:
- '' - ''
master_item: master_item:
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
- - name: 'Container {#NAME}: Status'
name: 'Container {#NAME}: Status'
type: DEPENDENT type: DEPENDENT
key: 'docker.container_info.state.status["{#NAME}"]' key: 'docker.container_info.state.status["{#NAME}"]'
delay: '0' delay: '0'
@ -376,109 +308,86 @@ zabbix_export:
trends: '0' trends: '0'
value_type: CHAR value_type: CHAR
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.State.Status - $.State.Status
- - type: DISCARD_UNCHANGED_HEARTBEAT
type: DISCARD_UNCHANGED_HEARTBEAT
parameters: parameters:
- 1h - 1h
master_item: master_item:
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
- - name: 'Container {#NAME}: Get info'
name: 'Container {#NAME}: Get info'
key: 'docker.container_info["{#NAME}"]' key: 'docker.container_info["{#NAME}"]'
history: '0' history: '0'
trends: '0' trends: '0'
value_type: CHAR value_type: CHAR
description: 'Return low-level information about a container' description: 'Return low-level information about a container'
application_prototypes: application_prototypes:
- - name: 'Docker: Container {#NAME}'
name: 'Docker: Container {#NAME}'
trigger_prototypes: trigger_prototypes:
- - expression: '{Docker:docker.container_info.state.exitcode["{#NAME}"].last()}>0 and {Docker:docker.container_info.state.running["{#NAME}"].last()}=0'
expression: '{Docker:docker.container_info.state.exitcode["{#NAME}"].last()}>0 and {Docker:docker.container_info.state.running["{#NAME}"].last()}=0'
name: 'Container {#NAME}: Container has been stopped with error code' name: 'Container {#NAME}: Container has been stopped with error code'
opdata: 'Exit code: {ITEM.LASTVALUE1}' opdata: 'Exit code: {ITEM.LASTVALUE1}'
priority: AVERAGE priority: AVERAGE
manual_close: 'YES' manual_close: 'YES'
macros: macros:
- - macro: '{$DOCKER.LLD.FILTER.CONTAINER.MATCHES}'
macro: '{$DOCKER.LLD.FILTER.CONTAINER.MATCHES}'
value: '.*' value: '.*'
description: 'Filter of discoverable containers' description: 'Filter of discoverable containers'
- - macro: '{$DOCKER.LLD.FILTER.CONTAINER.NOT_MATCHES}'
macro: '{$DOCKER.LLD.FILTER.CONTAINER.NOT_MATCHES}'
value: CHANGE_IF_NEEDED value: CHANGE_IF_NEEDED
description: 'Filter to exclude discovered containers' description: 'Filter to exclude discovered containers'
- - macro: '{$DOCKER.LLD.FILTER.IMAGE.MATCHES}'
macro: '{$DOCKER.LLD.FILTER.IMAGE.MATCHES}'
value: '.*' value: '.*'
description: 'Filter of discoverable images' description: 'Filter of discoverable images'
- - macro: '{$DOCKER.LLD.FILTER.IMAGE.NOT_MATCHES}'
macro: '{$DOCKER.LLD.FILTER.IMAGE.NOT_MATCHES}'
value: CHANGE_IF_NEEDED value: CHANGE_IF_NEEDED
description: 'Filter to exclude discovered images' description: 'Filter to exclude discovered images'
graphs: graphs:
- - name: 'Docker: Containers'
name: 'Docker: Containers'
graph_items: graph_items:
- - drawtype: GRADIENT_LINE
drawtype: GRADIENT_LINE
color: 1A7C11 color: 1A7C11
item: item:
host: Docker host: Docker
key: docker.containers.running key: docker.containers.running
- - sortorder: '1'
sortorder: '1'
drawtype: BOLD_LINE drawtype: BOLD_LINE
color: 2774A4 color: 2774A4
item: item:
host: Docker host: Docker
key: docker.containers.paused key: docker.containers.paused
- - sortorder: '2'
sortorder: '2'
drawtype: BOLD_LINE drawtype: BOLD_LINE
color: F63100 color: F63100
item: item:
host: Docker host: Docker
key: docker.containers.stopped key: docker.containers.stopped
- - sortorder: '3'
sortorder: '3'
drawtype: BOLD_LINE drawtype: BOLD_LINE
color: A54F10 color: A54F10
item: item:
host: Docker host: Docker
key: docker.containers.total key: docker.containers.total
- - name: 'Docker: Memory total'
name: 'Docker: Memory total'
graph_items: graph_items:
- - drawtype: BOLD_LINE
drawtype: BOLD_LINE
color: 1A7C11 color: 1A7C11
item: item:
host: Docker host: Docker
key: docker.mem.total key: docker.mem.total
value_maps: value_maps:
- - name: 'Docker flag'
name: 'Docker flag'
mappings: mappings:
- - value: '0'
value: '0'
newvalue: 'False' newvalue: 'False'
- - value: '1'
value: '1'
newvalue: 'True' newvalue: 'True'
- - name: 'Service state'
name: 'Service state'
mappings: mappings:
- - value: '0'
value: '0'
newvalue: Down newvalue: Down
- - value: '1'
value: '1'
newvalue: Up newvalue: Up

View File

@ -2,84 +2,69 @@ zabbix_export:
version: '5.2' version: '5.2'
date: '2021-12-01T13:26:59Z' date: '2021-12-01T13:26:59Z'
groups: groups:
- - name: Templates/Applications
name: Templates/Applications
templates: templates:
- - template: Tornado-relayer
template: Tornado-relayer
name: Tornado-relayer name: Tornado-relayer
groups: groups:
- - name: Templates/Applications
name: Templates/Applications
items: items:
- - name: 'tornado-relayer: health.error'
name: 'tornado-relayer: health.error'
type: DEPENDENT type: DEPENDENT
key: tornado-relayer.health.error key: tornado-relayer.health.error
delay: '0' delay: '0'
trends: '0' trends: '0'
value_type: TEXT value_type: TEXT
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.health.error - $.health.error
master_item: master_item:
key: 'web.page.get[{$URL}]' key: 'web.page.get[{$URL}]'
triggers: triggers:
- - expression: '{last()}<>""'
expression: '{last()}<>""'
name: 'tornado-relayer: health error' name: 'tornado-relayer: health error'
priority: AVERAGE priority: AVERAGE
- - name: 'tornado-relayer: health.status'
name: 'tornado-relayer: health.status'
type: DEPENDENT type: DEPENDENT
key: tornado-relayer.health.status key: tornado-relayer.health.status
delay: '0' delay: '0'
trends: '0' trends: '0'
value_type: TEXT value_type: TEXT
preprocessing: preprocessing:
- - type: JSONPATH
type: JSONPATH
parameters: parameters:
- $.health.status - $.health.status
master_item: master_item:
key: 'web.page.get[{$URL}]' key: 'web.page.get[{$URL}]'
triggers: triggers:
- - expression: '{last(#3)}<>"true"'
expression: '{last(#3)}<>"true"'
name: 'tornado-relayer: health status <> true' name: 'tornado-relayer: health status <> true'
priority: HIGH priority: HIGH
- - name: 'tornado-relayer: data'
name: 'tornado-relayer: data'
type: ZABBIX_ACTIVE type: ZABBIX_ACTIVE
key: 'web.page.get[{$URL}]' key: 'web.page.get[{$URL}]'
history: '0' history: '0'
trends: '0' trends: '0'
value_type: TEXT value_type: TEXT
preprocessing: preprocessing:
- - type: REGEX
type: REGEX
parameters: parameters:
- '\n\s?\n([\s\S]*)' - '\n\s?\n([\s\S]*)'
- \1 - \1
httptests: httptests:
- - name: 'tornado-relayer: status page'
name: 'tornado-relayer: status page'
agent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/80.0.3987.87 Chrome/80.0.3987.87 Safari/537.36' agent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/80.0.3987.87 Chrome/80.0.3987.87 Safari/537.36'
steps: steps:
- - name: 'status page'
name: 'status page'
url: '{$URL}' url: '{$URL}'
follow_redirects: 'NO' follow_redirects: 'NO'
required: status required: status
status_codes: '200' status_codes: '200'
triggers: triggers:
- - expression: '{Tornado-relayer:web.test.fail[tornado-relayer: status page].last()}>0'
expression: '{Tornado-relayer:web.test.fail[tornado-relayer: status page].last()}>0'
name: 'tornado-relayer: status page failed' name: 'tornado-relayer: status page failed'
priority: AVERAGE priority: AVERAGE
- - expression: '{Tornado-relayer:web.test.rspcode[tornado-relayer: status page,status page].last(#3)}<>200'
expression: '{Tornado-relayer:web.test.rspcode[tornado-relayer: status page,status page].last(#3)}<>200'
name: 'tornado-relayer: status page rspcode <>200' name: 'tornado-relayer: status page rspcode <>200'
priority: HIGH priority: HIGH