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

Fix mikrotik_system - temp + voltage (#1307)

* Fix awk search-term for ROS7*

Value could be named "temperature" or "cpu-temperature". Tested with 
RB5009, hex, CRS309, CRS305.

Search value without :.
Check different values in different ROS-Versions.
Tested with RB5009, hex, CRS309, CRS305.
This commit is contained in:
Michael Grote 2022-04-24 20:15:57 +02:00 committed by GitHub
parent eba742cea2
commit 9c17efc39b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,7 +127,7 @@ function get_voltage_label {
# if found # if found
# print line # print line
# external/bash-variables with "'"<var>"'" # external/bash-variables with "'"<var>"'"
echo "$line" | awk '/voltage:/{ echo "$line" | awk '/voltage/{
print "multigraph voltage_graph_""'"$name"'"; print "multigraph voltage_graph_""'"$name"'";
print "graph_title voltage " "'"$name"'"; print "graph_title voltage " "'"$name"'";
print "graph_vlabel volt"; print "graph_vlabel volt";
@ -139,21 +139,29 @@ function get_voltage_label {
done <<< "$data" # der variable data done <<< "$data" # der variable data
} }
function get_voltage_value { function get_voltage_value {
get_ros_version
while read -r line; do while read -r line; do
# like the label functions # like the label functions
# print title if dirtyconfig is not set # print title if dirtyconfig is not set
# because the call does not come in "config" # because the call does not come in "config"
if [ "$MUNIN_CAP_DIRTYCONFIG" = "0" ] || [ -z "$MUNIN_CAP_DIRTYCONFIG" ]; then if [ "$MUNIN_CAP_DIRTYCONFIG" = "0" ] || [ -z "$MUNIN_CAP_DIRTYCONFIG" ]; then
echo "$line" | awk '/voltage:/{ echo "$line" | awk '/voltage/{
print "multigraph voltage_graph_""'"$name"'"; print "multigraph voltage_graph_""'"$name"'";
}' }'
fi fi
# remove with gsub the char % in argument $2 if [ "$ros_version" == "6" ]; then
# print $2 # remove with gsub the char % in argument $2
echo "$line" | awk '/voltage:/{ # print $2
gsub(/V/,"",$2); echo "$line" | awk '/voltage/{
print "voltage.value " $2 gsub(/V/,"",$2);
}' print "voltage.value " $2
}'
fi
if [ "$ros_version" == "7" ]; then
echo "$line" | awk '/voltage/{
print "voltage.value " $3
}'
fi
done <<< "$data" done <<< "$data"
} }
@ -267,7 +275,7 @@ function get_temperature_value {
}' }'
fi fi
if [ "$ros_version" == "7" ]; then if [ "$ros_version" == "7" ]; then
echo "$line" | awk '/cpu-temperature/{ echo "$line" | awk '/temperature/{
print "temperature.value " $3 print "temperature.value " $3
}' }'
fi fi