munin plugin
FTDI ってそのまま Solarisに繋がる? - ganta-zeroの日記で書いた温度計http://strawberry-linux.com/catalog/items?code=12323の出力を無理やりっぽく munin pluginにしてみた。
参考にさせていただいたのは、このあたりhttp://www.seeds-std.co.jp/seedsblog/671.html
とりあえず、こんな感じ。
$ cat /opt/munin/lib/plugins/gettemp.pl #!/usr/bin/perl # # if($ARGV[0]){ &print_config if ($ARGV[0] eq "config"); } else { &main; } exit; sub print_config{ print "graph_args -r --lower-limit 0","\n"; print "graph_title templeture","\n"; print "graph_category temp","\n"; print "graph_info templeture","\n"; print "graph_vlabel temp","\n"; print "temp.label temp","\n"; return; } sub main{ open (IN, '/dev/term/0'); my $count; $count = 0; my @ondo; my @shitsudo; my $sum; $sum = 0; for ( $count = 0; $count < 10; $count++){ my $line =; chomp($line); if( length $line != 0){ my @d; @d = split(/,/, $line); # print $d[0], $d[1], "\n"; my @o; @o = split(/#/, $d[0]); $sum = $sum + $o[1]; my @s; @s = split(/\$/, $d[1]); push @ondo, [@o]; push @shitsudo, [@s]; } } close(IN); my $ave; $ave = $sum / $count * 2; print "temp.value $ave\n"; return; } 1;