Hi Paul,

Today Paul Jochum wrote:

> Hi Tobias:
>
>     Sorry, I don't know why you are having these strang io-patterns, but I 
> was wondering if you could share how you
> record and display this info?

I created a little plugin for collectd to interface with iostat. I
guess having one for vfsstat and arcstat along the same lines would
give a better picture as to what users actually experience but this
one gives some impression as to what happens deep down.

#!/usr/bin/perl
my $filter = $ARGV[0] || '.+';

my $pid = open my $iostat, "-|", 
"/usr/bin/iostat","-Tu","-xnr",int($ENV{COLLECTD_INTERVAL}) or die "launching 
iostat: $!";

$SIG{PIPE} = 'ignore';
$SIG{CHLD} = 'ignore';
$SIG{TERM} = sub {
   kill 9,$pid;
   exit 1;
};

my %data;
my @cols;
my $round = 0;
while (<$iostat>){
    chomp;
    my @input = split /,/;
    if ($#input == 0 and $input[0] =~ /^\d+$/){
        publish() if $round++ > 1;
        %data = ();
        next;
    }
    if ($input[-1] eq 'device'){
        @cols = @input;
        pop @cols;
        next;
    }
    if ($#input == $#cols+1){
        my $dev = pop @input;
        my %row;
        @row{@cols} = @input;
        $data{$dev} = \%row;
    };
}

sub publish {
    $|=0;
    my $time = time();
    for my $dev (sort keys %data){
        next unless $dev =~ /^${filter}$/;
        my $d = $data{$dev};
        my $prefix = "PUTVAL 
$ENV{COLLECTD_HOSTNAME}/sol_iostat-$dev/sol_iostat_";
        print $prefix."op $time:$d->{'r/s'}:$d->{'w/s'}\n";
        print $prefix."byte 
$time:".($d->{'kr/s'}*1024).":".($d->{'kw/s'}*1024)."\n";
        print $prefix."busypct $time:$d->{'%w'}:$d->{'%b'}\n";
        print $prefix."wait $time:$d->{wait}\n";
        print $prefix."actv $time:$d->{actv}\n";
        print $prefix."wsvc_t $time:".($d->{wsvc_t}/1000)."\n";
        print $prefix."asvc_t $time:".($d->{asvc_t}/1000)."\n";
    }
}

---------
adding these new types to the types.db

sol_iostat_op       read:GAUGE:0:U, write:GAUGE:0:U
sol_iostat_byte     read:GAUGE:0:U, write:GAUGE:0:U
sol_iostat_busypct  queue:GAUGE:0:100, disk:GAUGE:0:100
sol_iostat_wait     count:GAUGE:0:U
sol_iostat_actv     count:GAUGE:0:U
sol_iostat_wsvc_t   second:GAUGE:0:U
sol_iostat_asvc_t   second:GAUGE:0:U

cheers
tobi

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch t...@oetiker.ch ++41 62 775 9902 / sb: -9900
_______________________________________________
OmniOS-discuss mailing list
OmniOS-discuss@lists.omniti.com
http://lists.omniti.com/mailman/listinfo/omnios-discuss

Reply via email to