Changeset 7c54048ca9a58d0809af322fa48bf5755ae76888

Show
Ignore:
Timestamp:
05/15/10 03:52:53 (5 years ago)
Author:
Jason Dixon <jdixon@omniti.com>
git-committer:
Jason Dixon <jdixon@omniti.com> 1273895573 +0000
git-parent:

[7ed1a17128d040f0c56bfcea6d722f036adf7478]

git-author:
Jason Dixon <jdixon@omniti.com> 1273895573 +0000
Message:

no-config support for Solaris, return metrics for all known disks

git-svn-id: https://labs.omniti.com/resmon/branches/resmon2@383 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/Core/Iostat.pm

    rfbae6f3 r7c54048  
    1717 
    1818 Core::Iostat { 
    19      sd0 : noop 
    20      sd1 : noop 
     19     local : noop 
    2120 } 
    2221 
    2322 Core::Iostat { 
    24      hda : iostat_path => /usr/sbin/iostat 
     23     local : iostat_path => /usr/sbin/iostat 
    2524 } 
    2625 
     
    3029total values reported by iostat.  The type and number of metrics returned 
    3130depend on the type returned by each platform's respective iostat command. 
     31Each metric returned is prefixed with the name of the associated disk. 
    3232 
    3333=head1 CONFIGURATION 
     
    3737=item check_name 
    3838 
    39 The name of the check refers to the disk to query status for. 
     39The check name is used for descriptive purposes only. 
     40It is not used for anything functional. 
    4041 
    4142=item iostat_path 
     
    127128    my $iostat_path = $config->{'iostat_path'} || 'iostat'; 
    128129    my $osname = $^O; 
     130    my %metrics; 
    129131 
    130132    if ($osname eq 'solaris') { 
    131         my $output = run_command("$iostat_path -xe $disk"); 
    132         my ($line) = grep(/$disk\s*/, split(/\n/, $output)); 
    133         if ($line =~ /$disk\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+).*/) { 
    134             return { 
    135                 'reads_sec' => [$1, 'i'], 
    136                 'writes_sec' => [$2, 'i'], 
    137                 'kb_read_sec' => [$3, 'i'], 
    138                 'kb_write_sec' => [$4, 'i'], 
    139                 'wait_txn' => [$5, 'i'], 
    140                 'actv_txn' => [$6, 'i'], 
    141                 'rspt_txn' => [$7, 'i'], 
    142                 'wait_pct' => [$8, 'i'], 
    143                 'busy_pct' => [$9, 'i'], 
    144                 'soft_errors' => [$10, 'i'], 
    145                 'hard_errors' => [$11, 'i'], 
    146                 'txport_errors' => [$12, 'i'], 
    147                 'total_errors' => [$13, 'i'] 
    148             }; 
     133        my $output = run_command("$iostat_path -xe"); 
     134        foreach (split(/\n/, $output)) { 
     135            next unless (/(\w+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+).*/); 
     136            $metrics{"${1}_reads_sec"} = [$2, 'n']; 
     137            $metrics{"${1}_writes_sec"} = [$3, 'n']; 
     138            $metrics{"${1}_kb_read_sec"} = [$4, 'n']; 
     139            $metrics{"${1}_kb_write_sec"} = [$5, 'n']; 
     140            $metrics{"${1}_wait_txn"} = [$6, 'n']; 
     141            $metrics{"${1}_actv_txn"} = [$7, 'n']; 
     142            $metrics{"${1}_rspt_txn"} = [$8, 'n']; 
     143            $metrics{"${1}_wait_pct"} = [$9, 'I']; 
     144            $metrics{"${1}_busy_pct"} = [$10, 'I']; 
     145            $metrics{"${1}_soft_errors"} = [$11, 'I']; 
     146            $metrics{"${1}_hard_errors"} = [$12, 'I']; 
     147            $metrics{"${1}_txport_errors"} = [$13, 'I']; 
     148            $metrics{"${1}_total_errors"} = [$14, 'I']; 
     149        } 
     150        if (keys %metrics) { 
     151            return \%metrics; 
    149152        } else { 
    150             die "Unable to find disk: $disk\n"; 
     153            die "No disks found\n"; 
    151154        } 
    152155    } elsif ($osname eq 'linux') {