1

I want to use munin to make a graph of ttyACM0 in Linux, but munin can not create the graph. I found some information in "munin-node.log". it shows that "Service 'temperature' timed out". So I changed timeout to 60 or 120 in /munin/plugin-conf.d/munin-node, but it does not work. It's also timed out.

Here is 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_info This graph shows the temperature of board'

    for i in 1 2 3 4 5; 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

            for i in 1 2 3 4 5; do
                    case $i in
                            1)
                            TYPE="Under PCB"
                            VALUE=$(head -1 /dev/ttyACM0 | awk '{print $1}')
                            ;;
                            2)
                            TYPE="HDD"
                            VALUE=$(head -1 /dev/ttyACM0 | awk '{print $2}')
                            ;;
                            3)
                            TYPE="PHY"
                            VALUE=$(head -1 /dev/ttyACM0 | awk '{print $3}')
                            ;;
                            4)
                            TYPE="CPU"
                            VALUE=$(head -1 /dev/ttyACM0 | awk '{print $4}')
                            ;;
                            5)
                            TYPE="Ambience"
                            VALUE=$(head -1 /dev/ttyACM0 | awk '{print $5}')
                            ;;
                    esac

                    name=$(clean_name $TYPE)
                    if [ "$TYPE" != "NA" ]; then
                            echo "temp_$name.value $VALUE"
                    fi
Starfish
  • 2,735
  • 25
  • 28
haoX
  • 11
  • 1

1 Answers1

0

From a Munin perspective your plugin code looks correct.

Based on this code, I'd suspect that whatever is writing to ttyACM0 hasn't done so, or needs to be polled before writing anything. If there is nothing to read from /dev/ttyACM0, the head calls will block (wait) until more data is available.

If this is a commercial temperature sensor, I'd check if there is a supported command line tool for it, and use that when writing the munin plugin.

lkarsten
  • 131
  • 3