Archive:Zabbix

From The Munich Maker Lab's Wiki
Revision as of 08:38, 22 November 2016 by Siedi (talk | contribs) (Created page with "Zabbix is used to monitor our infrastructure of external and internal servers, websites and things. == Installation == We are using the docker images from [https://hub.docke...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Zabbix is used to monitor our infrastructure of external and internal servers, websites and things.

Installation

We are using the docker images from monitoringartist.

For a persistent database we are using a separate docker volume.

docker volume create --name zabbix-db-storage

The storage is available on the host in

sudo ls -al /var/lib/docker/volumes/zabbix-db-storage/_data

We are using a dedicated bridge network (in opposite to the default one). Docker provides an internal DNS for custom bridge networks which makes it easier to use hostnames between the docker containers.

docker network create --driver bridge zabbix_nw

Now let's start the database instance:

docker run \
    -d \
    --name zabbix-db \
    -v /tmp:/backups \
    -v /etc/localtime:/etc/localtime:ro \
    -v zabbix-db-storage:/var/lib/mysql \
    --network=zabbix_nw \
    --env="MARIADB_USER=zabbix" \
    --env="MARIADB_PASS=test123" \
    --env="DB_innodb_buffer_pool_size=512M" \
    monitoringartist/zabbix-db-mariadb

And finally we can start Zabbix itself:

docker run \
    -d \
    --name zabbix \
    -p 8080:80 \
    -p 10051:10051 \
    -v /etc/localtime:/etc/localtime:ro \
    -v /srv/zabbix-scripts/alertscripts/:/usr/local/share/zabbix/alertscripts/ \
    -v /srv/zabbix-scripts/externalscripts/:/usr/local/share/zabbix/externalscripts/ \
    --env="VIRTUAL_HOST=zabbix.intern.munichmakerlab.de,zefix.intern.munichmakerlab.de" \
    --env="ZS_Timeout=10" \
    --env="ZS_DBHost=zabbix-db" \
    --env="ZS_DBUser=zabbix" \
    --env="ZS_DBPassword=test123" \
    --env="XXL_zapix=true" \
    --env="XXL_grapher=true" \
    --env="XXL_apiuser=Admin" \
    --env="XXL_apipass=zabbix" \
    --env="PHP_date_timezone=Europe/Berlin" \
    monitoringartist/zabbix-xxl:latest

Important: We have to attach this docker container to both networks (the default and the custom one). The reason we are running it in both is, that the nginx-proxy (we are using it as there are couple of web-services running on the docker host) can access the default one only).

/usr/bin/docker network connect zabbix_nw zabbix

Docker commands

Access the zabbix container to inspect files:

docker exec -ti zabbix /bin/bash

See who os connected to a network:

docker network inspect zabbix_nw