8000 GitHub - blar/rrd: RRD (Round Robin Database) for PHP · GitHub
[go: up one dir, main page]

Skip to content
{"props":{"color_mode":"dark","logged_in":false,"marketing_page":false,"home_path":"/","login_path":"/login?return_to=https%3A%2F%2FGitHub.com%2Fblar%2Frrd","signup_path":"/signup?ref_cta=Sign+up\u0026ref_loc=header+logged+out\u0026ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E\u0026source=header-repo\u0026source_repo=blar%2Frrd","signup_enabled":true,"is_signup_controller":false,"show_search_and_nav":true,"hide_search":false,"private_mode_enabled":false,"should_use_dotcom_links":true,"auth_hydro_click":"{\"event_type\":\"authentication.click\",\"payload\":{\"location_in_page\":\"site header menu\",\"repository_id\":null,\"auth_type\":\"SIGN_UP\",\"originating_url\":\"https://GitHub.com/blar/rrd\",\"user_id\":null}}","auth_hydro_click_hmac":"6f2afc044b96a34f500eacfe05488ed54ccdd2049019ca95df11cbe5525e1f5c"}}
blarPublic

About

RRD (Round Robin Database) for PHP

Resources

Stars

4 stars

Watchers

2 watching

Forks

Repository files navigation

License Latest Stable Version Build Status Coverage Status Dependency Status Flattr

blar/rrd

Define a new RRD file

$timestamp = new DateTimeImmutable('2016-01-01 13:37:42');

$creator = new RRDCreator();
$creator->setFileName($rrd->getFileName());
$creator->setStart($timestamp);
$creator->setStep(60);

Add data source for downstream

$dataSource = new RrdDataSource();
$dataSource->setName('downstream');
$dataSource->setType(RrdDataSource::TYPE_COUNTER);
$creator->addDataSource($dataSource);

Add data source for upstream

$dataSource = new RrdDataSource();
$dataSource->setName('upstream');
$dataSource->setType(RrdDataSource::TYPE_COUNTER);
$creator->addDataSource($dataSource);

Add archive

$archive = new RrdArchive();
$archive->setConsolidation(RrdArchive::CONSOLIDATION_AVERAGE);
$archive->setSteps(60);
$archive->setRows(60 * 24);
$creator->addArchive($archive);

Save the new RRD file

$creator->save();

Push data

$rrd->update([
    'downstream' => 1024,
    'upstream' => 768
]);

Get last update

$rrd->getLastUpdate();

About

RRD (Round Robin Database) for PHP

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

0