munin-plugins/docker_storage
2021-09-16 19:58:09 +02:00

73 lines
2.1 KiB
Bash

#!/bin/bash
#%# family=auto
#%# capabilities=autoconf
# Michael Grote
# michael.grote ät posteo.de
# Outputs the count of docker images, containers and volumes.
# Outputs the size of docker images, containers and volumes.
# needs to be run as user: root AND group: root
# [proxmox_count]
# user root
# group root
# Pfade zu binaries
wdocker=$(which docker)
# werte
count_images=$($wdocker system df | sed 1d | grep -i images | awk '{print $2}')
count_container=$($wdocker system df | sed 1d | grep -i containers | awk '{print $2}')
count_active_container=$($wdocker system df | sed 1d | grep -i containers | awk '{print $3}')
count_volumes=$($wdocker system df | sed 1d | grep -i volumes | awk '{print $3}') # wg leerzeichen in zeile
size_images=$($wdocker system df | sed 1d | grep -i images | awk '{print $4}')
size_container=$($wdocker system df | sed 1d | grep -i containers | awk '{print $4}')
size_volumes=$($wdocker system df | sed 1d | grep -i volumes | awk '{print $4}')
# anzahl active containers
# wenn parameter = ...
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
# setze label
# setze optionen
echo 'multigraph docker_count'
echo 'graph_title docker count'
echo 'graph_vlabel Count'
echo 'graph_category virtualization'
echo 'graph_args -l 0'
echo count_images.label images
echo count_container.label container
echo count_active_container.label active containers
echo count_volumes.label volumes
echo 'multigraph docker_size'
echo 'graph_title docker size'
echo 'graph_vlabel Size'
echo 'graph_category virtualization'
echo 'graph_args -l 0'
echo size_images.label size images
echo size_container.label size container
echo size_volumes.label size volumes
exit 0
fi
echo 'multigraph docker_count'
echo count_images.value $count_images
echo count_container.value $count_container
echo count_active_container.value $count_active_container
echo count_volumes.value $count_volumes
echo 'multigraph docker_size'
echo size_images.value $size_images
echo size_container.value $size_container
echo size_volumes.value $size_volumes
exit 0