Zabbix not detecting free swap space in linux container (LXC)

lxczabbix

I have an LXC container that has 4GB of swap, most of which is free:

# swapon -s
Filename                                Type            Size    Used    Priority
none                                    virtual         4096000 97004   0

However, Zabbix (2.2.5, zabbix-agentd 2.2.7) reports total swap space (and hence free swap space) as zero, and thus reports a problem.

How can I configure Zabbix to recognize the available swap space? Alternatively: is there a newer version of zabbix-agent that does have this problem?

Best Answer

Use official Zabbix repo - I see Zabbix 3.2 for Wheezy there http://repo.zabbix.com/zabbix/3.2/debian/dists/wheezy/

IMHO deploying of Zabbix agent into container is not a good practice. In the theory you can have a thousands containers per host. I prefer to use metrics from the host level. In the theory use https://github.com/monitoringartist/zabbix-docker-monitoring and then you should to be able to obtain container cgroup swap metrics:

docker.mem[cid,total_swap] - total container swap size
docker.mem[cid,swap]       - current container swap usage

Cgroup memory doc: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/sec-memory.html