From 9c3855beb816dec163b3ac9901ec4152ea740e5b Mon Sep 17 00:00:00 2001 From: Younes Ichiche Date: Sun, 28 Nov 2021 15:46:12 +0100 Subject: [PATCH] adapt awk with variable + fix memory and disk multigraph name to align --- plugins/router/mikrotik_system | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/router/mikrotik_system b/plugins/router/mikrotik_system index 766170ec..b715a7d4 100755 --- a/plugins/router/mikrotik_system +++ b/plugins/router/mikrotik_system @@ -339,7 +339,7 @@ function get_memory_value { get_mem_total get_mem_free if [ "$MUNIN_CAP_DIRTYCONFIG" = "0" ] || [ -z "$MUNIN_CAP_DIRTYCONFIG" ]; then - echo multigraph memory_"$name" + echo multigraph memory_graph_"$name" fi while read -r line; do echo "$line" | awk '/total-memory:/{ @@ -360,9 +360,9 @@ function get_memory_value { function get_disk_label { while read -r line; do - echo "$line" | awk '/free-hdd-space:/{ - print "multigraph disk_graph_""'"$name"'"; - print "graph_title disk " "'"$name"'"; + echo "$line" | awk -v name=$name '/free-hdd-space:/{ + printf "multigraph disk_graph_%s\n", name; + printf "graph_title disk %s\n", name; print "graph_vlabel Bytes"; print "graph_category mikrotik"; print "graph_args -l 0"; @@ -373,7 +373,7 @@ function get_disk_label { } function get_disk_value { if [ "$MUNIN_CAP_DIRTYCONFIG" = "0" ] || [ -z "$MUNIN_CAP_DIRTYCONFIG" ]; then - echo multigraph disk_"$name" + echo multigraph disk_graph_"$name" fi while read -r line; do echo "$line" | grep KiB | awk '/free-hdd-space:/ {