mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41: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
|
||||
function get_name {
|
||||
while read -r line; do
|
||||
if echo "$line" | grep -q 'name:'; then
|
||||
name="$(echo "$line" | grep -E '\s+name:' | cut -f2 -d: | sed 's/^ *//g' | sed 's/[^A-Za-z0-9]/_/')"
|
||||
local fname
|
||||
IFS=$'\n'; for line in $data; do
|
||||
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
|
||||
done <<< "$data"
|
||||
done
|
||||
}
|
||||
function get_ros_version {
|
||||
while read -r line; do
|
||||
|
@ -353,15 +357,9 @@ function get_memory_value {
|
|||
printf "free_memory.value %.0f\n", $2
|
||||
}'
|
||||
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
|
||||
# total - free = used
|
||||
echo used_memory.value "$(echo $mem_total $mem_free | awk '{print ($1 - $2)}')"
|
||||
>>>>>>> fc66f426 (translated comments form german to englisch)
|
||||
printf "used_memory.value %.0f\n" "$(echo $mem_total $mem_free | awk '{print ($1 - $2)}')"
|
||||
}
|
||||
|
||||
function get_disk_label {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue