Changeset 3853

Show
Ignore:
Timestamp:
08/07/10 22:38:53 (2 years ago)
Author:
steve.schnepp
Message:

The timestamp isn't part of the multigraph protocol.
It's in spooldir since it enables a fast seeking

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/node/lib/Munin/Node/SpoolReader.pm

    r3838 r3853  
    8282    } 
    8383 
    84     # FIXME: shouldn't need to add the epoch line back in manually 
    85     local $/;  # slurp the rest of the file 
    86     return "timestamp $epoch\n" . <$fh>; 
     84    # The timestamp isn't part of the multigraph protocol,  
     85    # just part of spoolfetch, so we have to filter it out,  
     86    # and replace each value line with its current value 
     87    my $data = ""; 
     88    while(<$fh>) { 
     89        chomp; 
     90        if (m/^timestamp (\d+)/) { 
     91                # epoch is updated 
     92                $epoch = $1; 
     93                next; 
     94        } 
     95 
     96        if (m/^(\w+)\.value (?:N:)?([0-9.]+)$/) { 
     97                $_ = "$1.value $epoch:$2"; 
     98        } 
     99 
     100        $data .= $_ . "\n"; 
     101    } 
     102 
     103    return $data; 
    87104} 
    88105