private array $dataSources
private array $lastTick = array (
'data' =>
array (
),
'archive' =>
array (
),
)
private array $dataSourceTypes = array (
'GAUGE' => 0,
'COUNTER' => 0,
'ABSOLUTE' => 0,
'GAUGEZ' => 0,
)
private array $archiveCFs = array (
'AVERAGE' => 0,
'MIN' => 0,
'MAX' => 0,
'LAST' => 0,
'COUNT' => 0,
)
public __construct(string $file): void
Parameter | Type | Description |
---|
$file | string | |
public __destruct(): void
addDataSource('speed', 'COUNTER', 0, 600, 'Speed Counter');.
public addDataSource(string $dsname, string $type, ?int $min, ?int $max, ?string $description): void
Parameter | Type | Description |
---|
$dsname | string | //The name of the data source |
$type | string | //Data source types are: GAUGE, COUNTER, ABSOLUTE |
$min | int | //Minimum allowed value |
$max | int | //Maximum allowed value |
$description | string | //String describing the data source |
addArchive('day_average', 'AVERAGE', 60, 24);.
public addArchive(string $archiveID, string $cf, ?int $ticks, ?int $rows, ?string $description): void
Parameter | Type | Description |
---|
$archiveID | string | Name of the archive |
$cf | string | Consolidation function and can be: AVERAGE, MIN, MAX or LAST |
$ticks | int | Number of ticks to consolidate into a row |
$rows | int | Number of rows to store in the archive |
$description | string | A string describing the archive |
Get a tick value.
public getTick(?int $time): int
Parameter | Type | Description |
---|
$time | int | Defaults to the current time if not specified |
public create(int $tickSec = 1): bool
Parameter | Type | Description |
---|
$tickSec | int | |
public setValue(string $dsname, float $value): bool
Parameter | Type | Description |
---|
$dsname | string | |
$value | float | |
The update function stores a consolidated data point in the archive for each data source based on the settings
supplied when defining the archive.
- A primary data point is a single value stored for each 'tick'.
- A consolidated data point is a value calculated based on 1 or more primary data points using the consolidation function specified when defining the archive.
How this works is as follows:
- Step 1: Load all the available data points ready to be processed
- Step 2: Make sure there are data points for all ticks from lastTick to currentTick
- Step 3: Check if there are enough primary data points to create a consolidated data point.
- Step 4: If so, apply the consolidation function
- Step 5: Update the starting point in the archive definition
- Step 6: Store the consolidated data point value in the archive.
public hasDataSource(string $name): bool
Parameter | Type | Description |
---|
$name | string | |
public getDataSources(): void
public getArchives(): void
public graph(string $dsname, string $archiveID = 'default', false $): void
Parameter | Type | Description |
---|
$dsname | string | |
$archiveID | string | |
$ | false | |
Retrieve the raw primary data points stored in a data source.
public data(string $dsname, false $): void
Parameter | Type | Description |
---|
$dsname | string | the name of the data source |
$ | false | |
Calculate the length of a row within an archive.
private getCDPLength(): int
Calculate the start position in the file of a data source.
private getDataSourceOffset(NULL $dsname): int
Parameter | Type | Description |
---|
$dsname | NULL | The name of the data source. If omitted, returns the position of the byte after all data sources |
Calculate the start position in the file of an archive.
private getArchiveOffset(string $archiveID = 'default'): int
Parameter | Type | Description |
---|
$archiveID | string | The name of the archive |
Load data sources and archives from an existing RRD database file.
private restoreOptions(): bool
private writeDataSource(array $ds): bool
Parameter | Type | Description |
---|
$ds | array | |
private writeArchive(array $archive): bool
Parameter | Type | Description |
---|
$archive | array | |
private writeCDP(int $tick, array $values, bool $doWrite = true): string
Parameter | Type | Description |
---|
$tick | int | |
$values | array | |
$doWrite | bool | |
private consolidate(int $cf, array $dataPoints, ?int $dsType): float
Parameter | Type | Description |
---|
$cf | int | |
$dataPoints | array | |
$dsType | int | |
Generated by Hazaar API Doc Generator