neuer versuch

This commit is contained in:
Michael Grote 2021-09-21 19:18:24 +02:00
parent 1a7b32255d
commit 3e9b727f28

View file

@ -265,27 +265,25 @@ function get_memory_value {
gsub(/MiB/,"",$2);
print "total_memory.value " $2
}'
mem_total=$(echo $line | awk '/total-memory:/{ gsub(/MiB/,"",$2); print "total_memory.value " $2 }')
done <<< "$data"
while read -r line; do
echo $line | awk '/free-memory:/{
gsub(/MiB/,"",$2);
print "free_memory.value " $2
}'
mem_free=$(echo $line | awk '/free-memory:/{ gsub(/MiB/,"",$2); print "free_memory.value " $2 }')
done <<< "$data"
# berechne used-memory
# gesamt + frei = benutzt
echo USEEEEEEEEEEED: $mem_used
while read -r line; do
mem_total=$(echo $line | awk '/total-memory:/{ gsub(/MiB/,"",$2); print $2 }')
mem_free=$(echo $line | awk '/free-memory:/{ gsub(/MiB/,"",$2); print $2 }')
done <<< "$data"
echo FREEEEEEEEEEEE: $mem_free
echo TOTAAAAAAAAAAAAL: $mem_total
mem_used=$(awk '{ print("'"$mem_total"'" - "'"$mem_free"'") }')
echo USEEEEEEEEEEED: $mem_used
while read -r line; do
echo $line | awk '/total-memory:/{
print "used_memory.value " "'"$mem_used"'"
}'
done <<< "$data"
echo used_memory.value $mem_used
# prufe noch ob war gesetzt
}
# rufe funktionen auf, reihenfolge ist wichtig