Skip to content

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

  1. Install pip module
pip3 install python-dateutil
  1. 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
  1. Make the script executable.
chmod +x /etc/snmp/docker-stats.py
  1. Edit your snmpd.conf file, usually /etc/snmp/snmpd.conf, and add:
extend docker /etc/snmp/docker-stats.py
  1. If your run Debian, you need to add the Debian-snmp user to the docker group
usermod -a -G docker Debian-snmp
  1. Restart snmpd on your host.
systemctl restart snmpd