memory eingebaut

This commit is contained in:
Michael Grote 2021-09-21 18:17:47 +02:00
parent fbc1aa7139
commit 50654e3006

View file

@ -242,6 +242,36 @@ function get_cpuvalue {
done
}
function get_memory_label {
while read -r line; do
echo $line | awk '/free-memory:/{
print "multigraph memory_graph_""'"$name"'";
print "graph_title memory " "'"$name"'";
print "graph_vlabel MiB";
print "graph_category mikrotik";
print "graph_args -l 0";
print "total_memory.label cpu temperature";
print "free_memory.label cpu temperature";
}'
done <<< "$data"
}
function get_memory_value {
if [ "$MUNIN_CAP_DIRTYCONFIG" = "0" ]; then
echo multigraph memory_$name
fi
while read -r line; do
echo $line | awk '/free-memory:/{
gsub(/MiB/,"",$2);
print "free_memory.value " $2
}'
done <<< "$data"
while read -r line; do
echo $line | awk '/total-memory:/{
gsub(/MiB/,"",$2);
print "total_memory.value " $2
}'
done <<< "$data"
}
# rufe funktionen auf, reihenfolge ist wichtig
check_sshpass
@ -283,6 +313,10 @@ if [ "$1" = "config" ]; then
if [ "$MUNIN_CAP_DIRTYCONFIG" = "1" ]; then
get_cpuvalue
fi
get_memory_label
if [ "$MUNIN_CAP_DIRTYCONFIG" = "1" ]; then
get_memory_value
fi
exit 0
fi
# wird nie aufgerufen wenn dirtyconfig gesetzt ist
@ -294,6 +328,7 @@ get_write_sect_since_reboot_value
get_temperature_value
get_cpuvalue
get_memory_value
exit 0