The blog about containerisation, virtual machines and useful shell snippets and findings

Monitoring CoreOS + Docker in zabbix.

Here is simple systemd unit for coreos docker monitoring in zabbix.

Put this in /etc/systemd/system/zabbix-agent.service

[Unit]
Description=Zabbix agent
After=docker.service
Requires=docker.service

[Service]
ExecStartPre=-/usr/bin/docker kill zabbix-agent-xxl
ExecStartPre=-/usr/bin/docker rm zabbix-agent-xxl
ExecStart=/usr/bin/docker run  --name=zabbix-agent-xxl -p 10050:10050  -v /:/rootfs  -v /var/run:/var/run -e "ZA_Server=yourzabbix.server.com"  monitoringartist/zabbix-agent-xxl-limited:latest
ExecStop=/usr/bin/docker stop zabbix-agent-xxl

And launch with

systemctl enable zabbix-agent
systemctl start zabbix-agent

Inspect running container with

docker ps

, it should be running.

Please note, that every time zabbix container could not be started, it should be recreated.