This repository is no longer being actively maintained. We encourage you to not use this code. If you rely on this code you might want to fork the repository to keep your systems from breaking, if we remove this repository in the future.
The Leaseweb\RRD package provides functionality to work with [RRD](http://oss.oetiker.ch/rrdtool/ rrdtool) files. At the moment, It provides a Fetcher class to access data from rrd files in a easier way.
- PHP 5.3+
- php-rrdtool extension
In order to work with the library, you need to have the PHP extension enabled. In Ubuntu you can type:
sudo apt-get install php5-rrd
Add Leaseweb\RRD in your composer.json:
{
"require": {
"leaseweb/rrd": "*",
...
}
}
<?php
require 'vendor/autoload.php';
$rrdFetcher = new \RRD\Fetcher("database.rrd");
$data = $rrdFetcher->end('now')
->start('end-1h')
->fetch(\RRD\Fetcher::CF_AVERAGE)
<?php
require 'vendor/autoload.php';
$rrdFetcher = new \RRD\Fetcher("database.rrd");
$data = $rrdFetcher->fetchFromArgs('AVERAGE', 300, '-1d', 'start+4h');
<?php
require 'vendor/autoload.php';
$rrdFetcher = new \RRD\Fetcher("database.rrd");
$data = $rrdFetcher->end('now')
->start('end-1h')
->percentile('network_in', 95)
phpunit