#! /usr/bin/perl use strict ; use warnings ; package Probe::Omreport ; use base 'Probe' ; # raid0_members int omreport ok_disks 0 sub ITEMS { [ { name => 'raid0_members' , kind => 'int' , args => [ qw (0 0) ] } ] ; } ; sub main { my $self = shift ; my $itms = shift ; # items to probe : [ item, ... ] my $clnt = shift ; # main::CLIENT for my $item ( sort { $a -> name cmp $b -> name } @$itms ) { my $args = $item -> args ; my ( $cntlr, $target ) = @$args ; if ( @$args < 2 ) { $item -> perr ( 'need 2 args' ) ; } else { my $path = $self -> path ; my $prog = "$path/omreport.pl" ; my @prog = ( $prog, @$args ) ; my ( $err, $xit, $sig, @lines ) = Probe::Util::run_prog ( @prog ) ; if ( $err ) { $item -> perr ( $err ) ; } else { my $name = $item -> name ; my $val = $lines [ 0 ] ; chomp $val ; OBB::TT ( " name %s val %s", $name, $val ) ; $item -> set_val ( $val ) ; } } } } 1 ;