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

get the correct name from the routerboard and replace all special characters with _

This commit is contained in:
Younes Ichiche 2021-11-28 19:08:44 +01:00 committed by Lars Kruse
parent 3dd16cc568
commit 74b7eb2a46

View file

@ -67,7 +67,7 @@ printf '( exit %q )' "$ret" >&2;
function get_name {
while read -r line; do
if echo "$line" | grep -q 'name:'; then
name=$(echo "$line" | grep name: | awk '{ print $2 }')
name="$(echo "$line" | grep -E '\s+name:' | cut -f2 -d: | sed 's/^ *//g' | sed 's/[^A-Za-z0-9]/_/')"
fi
done <<< "$data"
}