mt_system: ros7: cpu-temp (#2)
Co-authored-by: Michael Grote <michael.grote@posteo.de> Reviewed-on: #2 Co-authored-by: mg <mg@noreply.git.mgrote.net> Co-committed-by: mg <mg@noreply.git.mgrote.net>
This commit is contained in:
parent
d9c8a28716
commit
5b4fff96c7
1 changed files with 77 additions and 30 deletions
|
@ -34,6 +34,17 @@ function get_name {
|
||||||
fi
|
fi
|
||||||
done <<< "$data"
|
done <<< "$data"
|
||||||
}
|
}
|
||||||
|
function get_ros_version {
|
||||||
|
while read -r line; do
|
||||||
|
if echo "$line" | grep 'version:' > /dev/null; then
|
||||||
|
if echo "$line" | grep version: | grep "7." > /dev/null; then
|
||||||
|
ros_version="7"
|
||||||
|
else
|
||||||
|
ros_version="6"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done <<< "$data"
|
||||||
|
}
|
||||||
function get_cpu_count {
|
function get_cpu_count {
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if echo "$line" | grep 'cpu-count' > /dev/null; then
|
if echo "$line" | grep 'cpu-count' > /dev/null; then
|
||||||
|
@ -204,16 +215,24 @@ function get_temperature_label {
|
||||||
done <<< "$data"
|
done <<< "$data"
|
||||||
}
|
}
|
||||||
function get_temperature_value {
|
function get_temperature_value {
|
||||||
|
get_ros_version
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [ "$MUNIN_CAP_DIRTYCONFIG" = "0" ] || [ -z "$MUNIN_CAP_DIRTYCONFIG" ]; then
|
if [ "$MUNIN_CAP_DIRTYCONFIG" = "0" ] || [ -z "$MUNIN_CAP_DIRTYCONFIG" ]; then
|
||||||
echo "$line" | awk '/temperature:/{
|
echo "$line" | awk '/temperature:/{
|
||||||
print "multigraph temperature_graph_""'"$name"'";
|
print "multigraph temperature_graph_""'"$name"'";
|
||||||
}'
|
}'
|
||||||
fi
|
fi
|
||||||
echo "$line" | awk '/temperature:/{
|
if [ "$ros_version" == "6" ]; then
|
||||||
gsub(/C/,"",$2);
|
echo "$line" | awk '/temperature:/{
|
||||||
print "temperature.value " $2
|
gsub(/C/,"",$2);
|
||||||
}'
|
print "temperature.value " $2
|
||||||
|
}'
|
||||||
|
fi
|
||||||
|
if [ "$ros_version" == "7" ]; then
|
||||||
|
echo "$line" | awk '/cpu-temperature/{
|
||||||
|
print "temperature.value " $3
|
||||||
|
}'
|
||||||
|
fi
|
||||||
done <<< "$data"
|
done <<< "$data"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,30 +421,58 @@ get_memory_value
|
||||||
get_disk_value
|
get_disk_value
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
# Beispieloutput:
|
# Beispieloutput ROS 6.4*
|
||||||
# voltage: 24.5V
|
# voltage: 24.5V
|
||||||
# temperature: 46C
|
# cpu-temperature: 31C
|
||||||
# uptime: 1w6d17h12m25s
|
# uptime: 4w3d21h28m58s
|
||||||
# version: 6.48.4 (stable)
|
# version: 6.48.4 (stable)
|
||||||
# build-time: Aug/18/2021 06:43:27
|
# build-time: Aug/18/2021 06:43:27
|
||||||
# factory-software: 6.46.3
|
# factory-software: 6.44.6
|
||||||
# free-memory: 209.9MiB
|
# free-memory: 475.8MiB
|
||||||
# total-memory: 256.0MiB
|
# total-memory: 512.0MiB
|
||||||
# cpu: MIPS 1004Kc V2.15
|
# cpu: ARMv7
|
||||||
# cpu-count: 4
|
# cpu-count: 2
|
||||||
# cpu-frequency: 880MHz
|
# cpu-frequency: 800MHz
|
||||||
# cpu-load: 0%
|
# cpu-load: 9%
|
||||||
# free-hdd-space: 4760.0KiB
|
# free-hdd-space: 2124.0KiB
|
||||||
# total-hdd-space: 16.3MiB
|
# total-hdd-space: 15.9MiB
|
||||||
# write-sect-since-reboot: 46412
|
# write-sect-since-reboot: 339810
|
||||||
# write-sect-total: 62012
|
# write-sect-total: 350544
|
||||||
# bad-blocks: 0%
|
# bad-blocks: 0%
|
||||||
# architecture-name: mmips
|
# architecture-name: arm
|
||||||
# board-name: hEX
|
# board-name: CRS309-1G-8S+
|
||||||
# platform: MikroTik
|
# platform: MikroTik
|
||||||
# # CPU LOAD IRQ DISK
|
# # CPU LOAD IRQ DISK
|
||||||
# 0 cpu0 0% 0% 0%
|
# 0 cpu0 0% 0% 0%
|
||||||
# 1 cpu1 1% 1% 0%
|
# 1 cpu1 19% 0% 0%
|
||||||
# 2 cpu2 0% 0% 0%
|
# name: crs309
|
||||||
# 3 cpu3 1% 0% 0%
|
|
||||||
# name: hEX
|
# Beispieloutput ROS 7*
|
||||||
|
# Columns: NAME, VALUE, TYPE
|
||||||
|
# # NAME VA T
|
||||||
|
# 0 cpu-temperature 44 C
|
||||||
|
# uptime: 3d1h30m
|
||||||
|
# version: 7.0.5 (stable)
|
||||||
|
# build-time: Aug/06/2021 11:33:39
|
||||||
|
# factory-software: 7.0.4
|
||||||
|
# free-memory: 818.8MiB
|
||||||
|
# total-memory: 1024.0MiB
|
||||||
|
# cpu-count: 4
|
||||||
|
# cpu-frequency: 1400MHz
|
||||||
|
# cpu-load: 0%
|
||||||
|
# free-hdd-space: 993.8MiB
|
||||||
|
# total-hdd-space: 1025.0MiB
|
||||||
|
# write-sect-since-reboot: 4802
|
||||||
|
# write-sect-total: 4802
|
||||||
|
# bad-blocks: 0%
|
||||||
|
# architecture-name: arm64
|
||||||
|
# board-name: RB5009UG+S+
|
||||||
|
# platform: MikroTik
|
||||||
|
# Columns: CPU, LOAD, IRQ, DISK
|
||||||
|
# # CPU LO IR DI
|
||||||
|
# 0 cpu0 0% 0% 0%
|
||||||
|
# 1 cpu1 0% 0% 0%
|
||||||
|
# 2 cpu2 0% 0% 0%
|
||||||
|
# 3 cpu3 0% 0% 0%
|
||||||
|
# name: rb5009
|
||||||
|
#
|
||||||
|
|
Loading…
Reference in a new issue