mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
convert get_name to a fallback function where board-name is first selected and if the name is set, then tat one will be used + trimming
This commit is contained in:
parent
38649d3179
commit
79706f9da7
1 changed files with 9 additions and 11 deletions
|
@ -65,11 +65,15 @@ printf '( exit %q )' "$ret" >&2;
|
||||||
|
|
||||||
# functions
|
# functions
|
||||||
function get_name {
|
function get_name {
|
||||||
while read -r line; do
|
local fname
|
||||||
if echo "$line" | grep -q 'name:'; then
|
IFS=$'\n'; for line in $data; do
|
||||||
name="$(echo "$line" | grep -E '\s+name:' | cut -f2 -d: | sed 's/^ *//g' | sed 's/[^A-Za-z0-9]/_/')"
|
if echo "$line" | grep -qE '(board-)?name:'; then
|
||||||
|
fname="$(echo "$line" | cut -d: -f2 | xargs | sed 's/[\s\n\r]*$//g' | sed 's/[^A-Za-z0-9]/_/g')"
|
||||||
|
if [ -n "$fname" ]; then
|
||||||
|
name="$fname"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done <<< "$data"
|
done
|
||||||
}
|
}
|
||||||
function get_ros_version {
|
function get_ros_version {
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
|
@ -353,15 +357,9 @@ function get_memory_value {
|
||||||
printf "free_memory.value %.0f\n", $2
|
printf "free_memory.value %.0f\n", $2
|
||||||
}'
|
}'
|
||||||
done <<< "$data"
|
done <<< "$data"
|
||||||
<<<<<<< HEAD
|
|
||||||
# berechne used-memory
|
|
||||||
# gesamt + frei = benutzt
|
|
||||||
printf "used_memory.value %.0f\n" "$(echo $mem_total $mem_free | awk '{print ($1 - $2)}')"
|
|
||||||
=======
|
|
||||||
# calculate used-memory
|
# calculate used-memory
|
||||||
# total - free = used
|
# total - free = used
|
||||||
echo used_memory.value "$(echo $mem_total $mem_free | awk '{print ($1 - $2)}')"
|
printf "used_memory.value %.0f\n" "$(echo $mem_total $mem_free | awk '{print ($1 - $2)}')"
|
||||||
>>>>>>> fc66f426 (translated comments form german to englisch)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_disk_label {
|
function get_disk_label {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue