Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Read RRDtool files without rrd extension as ext-rrd does not support reading rrd files generated on different arch

License

Notifications You must be signed in to change notification settings

aldas/rrd-php-reader

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pure PHP RRDtool file reader

Build Status codecov

Because on windows php ext-rrd can not read rrd files created on unix and vice versa. See oetiker/rrdtool-1.x#759

This library supports reading:

  • rrds created on 64bit linux from 64bit Windows
  • rrds created on 64bit Windows from 64bit Linux

Only meant to export/dump data out of rrd file.

This library is based on javascriptRRD

Example

Convert RRD to CSV: rrd_to_csv.php

$reader = RrdReader::createFromPath('path/to/my_rrd.rrd');

$fp = fopen('output.csv', 'wb');
$reader->outputAsCsv($fp, [
    'ds' => 'value'
]);
fclose($fp);

Filter rrd: read_rrd.php

$reader = RrdReader::createFromPath('path/to/my_rrd.rrd');

$traversable = $reader->getAll([
    'ds' => 'value',
    'row_filter_callback' => function (int $timestamp, float $value, RrdDs $ds, RraInfo $rra) {
        return $value < 8;
    }
]);

/** @var RrdRowValue $value */
foreach ($traversable as $value) {
    echo $value . PHP_EOL;
}

Output would be:

timestamp=1521054891, value=6.000000, cf=AVERAGE, ds=value, step=1
timestamp=1521054892, value=7.000000, cf=AVERAGE, ds=value, step=1
timestamp=1521054891, value=6.000000, cf=MAX, ds=value, step=1
timestamp=1521054892, value=7.000000, cf=MAX, ds=value, step=1

About

Read RRDtool files without rrd extension as ext-rrd does not support reading rrd files generated on different arch

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.