Changeset cbdafc7828c365598882711905b828493f504a59

Show
Ignore:
Timestamp:
04/25/11 19:41:47 (3 years ago)
Author:
Mark Harrison <mark@mivok.net>
git-committer:
Mark Harrison <mark@mivok.net> 1303760507 -0400
git-parent:

[dae50c14b6528ce350c00784c59bcb59f1ab61e3]

git-author:
Mark Harrison <mark@mivok.net> 1303760507 -0400
Message:

Deal with multiple checks in resmon output

An example of this is the resmon main page. By default this check will look
at http://hostname:81/modulename/checkname which will output a single check.
However, this change lets you specify a custom URL which returns metrics for
multiple modules and it will find the correct one.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • resources/check_resmon_metric

    rdae50c1 rcbdafc7  
    326326    #print Dumper($ref->{ResmonResult}); 
    327327 
     328    my $idx; 
     329    for ($idx=0; $idx < $#{$ref->{ResmonResult}}; $idx++) { 
     330        last if ($ref->{ResmonResult}->[$idx]->{module} eq $module && 
     331            $ref->{ResmonResult}->[$idx]->{service} eq $check); 
     332    } 
     333 
    328334    # If we have stale information, then go critical 
    329     my $last_update = time() - $ref->{ResmonResult}->[0]->{last_update}->[0]; 
     335    my $last_update = time() - $ref->{ResmonResult}->[$idx]->{last_update}->[0]; 
    330336    die "Stale metrics. Last updated $last_update seconds ago" 
    331337        if($age && $age < $last_update); 
    332338 
    333339    # Get the metrics 
    334     my $metricval = $ref->{ResmonResult}->[0]->{metric}->{$metric}; 
     340    my $metricval = $ref->{ResmonResult}->[$idx]->{metric}->{$metric}; 
    335341 
    336342    # Detect absence of a metric