1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

use printf and pass variable to awk

This commit is contained in:
Younes Ichiche 2021-11-28 09:16:55 +01:00 committed by Lars Kruse
parent 3790d20179
commit b43ec018dc

View file

@ -320,9 +320,9 @@ function get_memory_label {
get_mem_total
get_mem_free
while read -r line; do
echo "$line" | awk '/free-memory:/{
print "multigraph memory_graph_""'"$name"'";
print "graph_title memory " "'"$name"'";
echo "$line" | awk -v name=$name '/free-memory:/{
printf "multigraph memory_graph_%s\n", name;
printf "graph_title memory %s\n", name;
print "graph_vlabel MiB";
print "graph_category mikrotik";
print "graph_args -l 0";
@ -331,8 +331,8 @@ function get_memory_label {
print "free_memory.label free memory";
print "graph_info Total, Used & free RAM.";
gsub(/MiB/,"",$2);
print "used_memory.critical " $2*0.9;
print "used_memory.warning " $2*0.7 }'
printf "used_memory.critical %.0f\n", $2*0.9;
printf "used_memory.warning %.0f\n", $2*0.7 }'
done <<< "$data"
}
function get_memory_value {