Docker Stats
Docker Stats
It gathers metrics about the docker containers, including: - cpu percentage - memory usage - container size - uptime - Totals per status
This script requires python3 and the pip module python-dateutil
SNMP Extend
- Install pip module
pip3 install python-dateutil
- Copy the shell script to the host. By default, the script shows only the running containers. For all containers, change the constant at the top of the script to
ONLY_RUNNING_CONTAINERS = False.
wget https://github.com/librenms/librenms-agent/raw/master/snmp/docker-stats.py -O /etc/snmp/docker-stats.py
- Make the script executable.
chmod +x /etc/snmp/docker-stats.py
- Edit your
snmpd.conffile, usually/etc/snmp/snmpd.conf, and add:
extend docker /etc/snmp/docker-stats.py
- If your run Debian, you need to add the Debian-snmp user to the docker group
usermod -a -G docker Debian-snmp
- Restart snmpd on your host.
systemctl restart snmpd