I want to use Munin to show the wave of my data. I get the data from ttyACM0, it's an Arduino UNO. I use shell script. But I got a problem, I cannot ues 'cat /dev/ttyACM0' to get the data. Here is the problem, the programme stopped at 'cat /dev/ttyACM0',
+ . /usr/share/munin/plugins/plugin.sh
+ '[' '' = autoconf ']'
+ '[' '' = config ']'
++ cat /dev/ttyACM0
Sometimes there is another problem, it's that 'LINE = $(cat /dev/ttyACM0 | awk -F: '{print $2}')' command not found. Anyone has an idea? Thanks very much.
Here is a part of my code,
if [ "$1" = "config" ]; then
echo 'graph_title Temperature of board'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel temperature(°C)'
echo 'graph_category temperature'
echo 'graph_scale no'
echo 'graph_period second'
echo 'graph_info This graph shows the temperature of board'
LINE = $(cat /dev/ttyACM0 | awk -F: '{print $2}')
for i in 0 1 2 3 4; do
case $i in
1)
TYPE="Under PCB"
;;
2)
TYPE="HDD"
;;
3)
TYPE="PHY"
;;
4)
TYPE="CPU"
;;
5)
TYPE="Ambience"
;;
esac
name=$(clean_name $TYPE)
if ["$TYPE" != "NA"]; then
echo "temp_$name.label $TYPE";
fi
done
exit 0
fi
LINE = $(cat /dev/ttyACM0 | awk -F: '{print $2}')
for i in 0 1 2 3 4; do
case $i in
1)
TYPE="Under PCB"
VALUE=$(echo "$LINE" | awk '{print $1}')
;;
2)
TYPE="HDD"
VALUE=$(echo "$LINE" | awk '{print $2}')
;;
3)
TYPE="PHY"
VALUE=$(echo "$LINE" | awk '{print $3}')
;;
4)
TYPE="CPU"
VALUE=$(echo "$LINE" | awk '{print $4}')
;;
5)
TYPE="Ambience"
VALUE=$(echo "$LINE" | awk '{print $5}')
;;
esac
name=$(clean_name $TYPE)
if ["$TYPE" != "NA"]; then
echo "temp_$name.value $VALUE";
fi
done