Changeset 5bd565fe59f22420dba6fb903956a5fa6f8e3102

Show
Ignore:
Timestamp:
06/04/10 16:25:22 (4 years ago)
Author:
Mark Harrison <mark@omniti.com>
git-committer:
Mark Harrison <mark@omniti.com> 1275668722 +0000
git-parent:

[e8ef2ccfb09720067735cf322b3805842b653a77]

git-author:
Mark Harrison <mark@omniti.com> 1275668722 +0000
Message:

Wildcard module support in testmod (refs #12)

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • resources/testmod

    r117de54 r5bd565f  
    8989my $obj = $module->new($check_name, $kvs); 
    9090my $metrics; 
    91 eval { $metrics = $obj->handler(); }; 
     91if ($check_name ne "*") { 
     92    eval { $metrics = { $check_name => $obj->handler() }; }; 
     93} else { 
     94    eval { $metrics = $obj->wildcard_handler(); }; 
     95
    9296if ($@) { 
    9397    chomp $@; 
    94     $metrics = { "error" => ["$@", "s"] }; 
     98    $metrics = { $check_name => { "error" => ["$@", "s"] } }; 
    9599} 
    96100 
    97 print "$module $check_name\n\n"; 
    98 for my $k (sort keys %$metrics) { 
    99     my $v = $metrics->{$k}; 
    100     # Default type is auto 
    101     if (ref($v) ne "ARRAY") { 
    102         $v = [$v, "0"]; 
     101for my $cn (sort keys %$metrics) { 
     102    print "$module $cn\n\n"; 
     103    for my $k (sort keys %{$metrics->{$cn}}) { 
     104        my $v = $metrics->{$cn}->{$k}; 
     105        # Default type is auto 
     106        if (ref($v) ne "ARRAY") { 
     107            $v = [$v, "0"]; 
     108        } 
     109        printf "%15s = %s (%s)\n", $k , $v->[0], $v->[1]; 
    103110    } 
    104     printf "%15s = %s (%s)\n", $k , $v->[0], $v->[1]; 
    105111}