mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Plugin lxc: omit output of "max" if the network interface speed is unknown
The "U" value is not defined for the "max" field.
This commit is contained in:
parent
914d1c5f25
commit
da8a74fdcb
1 changed files with 7 additions and 6 deletions
|
@ -267,25 +267,26 @@ EOF
|
|||
if [ -z "$device" ]; then
|
||||
continue
|
||||
fi
|
||||
bps="U"
|
||||
if [ -r "/sys/class/net/$device/speed" ]; then
|
||||
megabit_per_second=$(cat "/sys/class/net/$device/speed")
|
||||
bps=$((megabit_per_second * 1000 * 1000))
|
||||
fi
|
||||
cat <<EOF
|
||||
$(clean_fieldname "net__${n}_down").label $n
|
||||
$(clean_fieldname "net__${n}_down").type DERIVE
|
||||
$(clean_fieldname "net__${n}_down").graph no
|
||||
$(clean_fieldname "net__${n}_down").cdef $(clean_fieldname "net__${n}_down"),8,*
|
||||
$(clean_fieldname "net__${n}_down").min 0
|
||||
$(clean_fieldname "net__${n}_down").max $bps
|
||||
$(clean_fieldname "net__${n}_up").label $n
|
||||
$(clean_fieldname "net__${n}_up").type DERIVE
|
||||
$(clean_fieldname "net__${n}_up").negative $(clean_fieldname "net__${n}_down")
|
||||
$(clean_fieldname "net__${n}_up").cdef $(clean_fieldname "net__${n}_up"),8,*
|
||||
$(clean_fieldname "net__${n}_up").min 0
|
||||
EOF
|
||||
if [ -r "/sys/class/net/$device/speed" ]; then
|
||||
megabit_per_second=$(cat "/sys/class/net/$device/speed")
|
||||
bps=$((megabit_per_second * 1000 * 1000))
|
||||
cat <<EOF
|
||||
$(clean_fieldname "net__${n}_down").max $bps
|
||||
$(clean_fieldname "net__${n}_up").max $bps
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue