Changeset db0d94e2c95fb4b8565a345193809127b3f2f2b0

Show
Ignore:
Timestamp:
04/24/10 18:27:46 (4 years ago)
Author:
Jason Dixon <jdixon@omniti.com>
git-committer:
Jason Dixon <jdixon@omniti.com> 1272133666 +0000
git-parent:

[6def6ce6e555df7891fb0d270dd5d69f6d43636e]

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

be consistent with path vars, use the built-in error handling now that we have it

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

Files:

Legend:

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

    r93a3227 rdb0d94e  
    1717 
    1818 Core::Cpu { 
    19     local : path_to_vmstat => /usr/bin/vmstat 
     19    local : vmstat_path => /usr/bin/vmstat 
    2020 } 
    2121 
     
    3232Arbitrary name of the check. 
    3333 
    34 =item path_to_vmstat 
     34=item vmstat_path 
    3535 
    3636Optional path to the vmstat executable. 
    3737 
    38 =item path_to_tail 
     38=item tail_path 
    3939 
    4040Optional path to the tail executable. 
     
    5252=item idle (time) 
    5353 
    54 =item error_msg 
    55  
    5654=back 
    5755 
     
    6159    my $self = shift; 
    6260    my $config = $self->{'config'}; 
    63     my $path_to_vmstat = $config->{'path_to_vmstat'} || 'vmstat'; 
    64     my $path_to_tail = $config->{'path_to_tail'} || 'tail'; 
    65     my $output = run_command("$path_to_vmstat 1 2 | $path_to_tail -1"); 
     61    my $vmstat_path = $config->{'vmstat_path'} || 'vmstat'; 
     62    my $tail_path = $config->{'tail_path'} || 'tail'; 
     63    my $output = run_command("$vmstat_path 1 2 | $tail_path -1"); 
    6664    my $osname = $^O; 
    6765    my %metrics; 
     
    8078        @values = (split($output))[16..18]; 
    8179    } else { 
    82         return { 'error_msg' => 'unknown operating system' }
     80        die "Unknown platform: $osname"
    8381    } 
    8482