This commit is contained in:
Michael Grote 2021-09-21 18:53:34 +02:00
parent cc9d48d5bf
commit 30ce95e62b

View file

@ -35,7 +35,21 @@ c=0 # zähler; wird für verschiedene Schleifen benötigt
function get_name {
while read -r line; do
if echo $line | grep 'name:' > /dev/null; then
name=$(echo $line grep name: | awk '{ print $2 }')
name=$(echo $line | grep name: | awk '{ print $2 }')
fi
done <<< "$data"
}
function get_memory_free {
while read -r line; do
if echo $line | grep 'free-memory:' > /dev/null; then
name=$(echo $line | grep free-memory: | awk '{ gsub(/MiB/,"",$2); print $2 }' )
fi
done <<< "$data"
}
function get_memory_total {
while read -r line; do
if echo $line | grep 'total-memory:' > /dev/null; then
name=$(echo $line | grep total-memory: | awk '{ gsub(/MiB/,"",$2); print $2 }' )
fi
done <<< "$data"
}
@ -260,22 +274,15 @@ function get_memory_value {
if [ "$MUNIN_CAP_DIRTYCONFIG" = "0" ]; then
echo multigraph memory_$name
fi
while read -r line; do
mem_free=$(echo $line | awk '/free-memory:/{ gsub(/MiB/,"",$2); print $2 }')
done <<< "$data"
while read -r line; do
mem_total=$(echo $line | awk '/total-memory:/{ gsub(/MiB/,"",$2); print $2 }')
done <<< "$data"
while read -r line; do
# berechne used-memory
# gesamt + frei = benutzt
echo FREEEEEEEEEEEE: $mem_free
echo TOTAAAAAAAAAAAAL: $mem_total
mem_used=$(awk '{ print("'"mem_total"'" - "'"mem_free"'") }')
echo USEEEEEEEEEEED: $mem_used
echo $line | awk '/total-memory:/{
print "used_memory.value " "'"$mem_used"'"
}'
# berechne used-memory
# gesamt + frei = benutzt
echo FREEEEEEEEEEEE: $mem_free
echo TOTAAAAAAAAAAAAL: $mem_total
mem_used=$(awk '{ print("'"mem_total"'" - "'"mem_free"'") }')
echo USEEEEEEEEEEED: $mem_used
echo $line | awk '/total-memory:/{
print "used_memory.value " "'"$mem_used"'"
}'
done <<< "$data"
while read -r line; do
echo $line | awk '/total-memory:/{