munin的插件总是超时

我想用munin在Linux中做一个ttyACM0的graphics,但是munin不能创buildgraphics。 我在“munin-node.log”中find了一些信息。 它显示“服务”温度超时“。 所以我在/munin/plugin-conf.d/munin-node timeout改为60或120,但是不起作用。 这也是超时。

这是我的代码的一部分:

  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 

从Munin的angular度来看,你的插件代码看起来是正确的。

基于这段代码,我怀疑无论写给ttyACM0还是没有写完,或者在写任何东西之前都需要进行轮询。 如果从/ dev / ttyACM0中没有任何东西要读取,头部调用将阻塞(等待),直到有更多的数据可用。

如果这是一个商业温度传感器,我会检查是否有一个支持的命令行工具,并用它来写入munin插件。