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 desired host. By default, it will only show the status for containers that are running. To include all containers modify the constant in the script at the top of the file and change it 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.conf file (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