Files
librenms-librenms/includes/polling/applications/drbd.inc.php
Neil Lathwood fad5aca1b7 feature: Allow customisation of rrd step/heartbeat when creating new rrd files (#5947)
* feature: Allow customisation of rrd step/heartbeat when creating new rrd files

* revert defaults

* added docs + webui config option

* Move RrdDefinition to an Object to make them easier to create and remove the possibility of typos.

* Fix style/lint issues and missing use statements

* 3 more missing use statements

* updated doc + moved schema file
2017-02-23 22:45:50 +00:00

48 lines
1.3 KiB
PHP

<?php
use LibreNMS\RRD\RrdDefinition;
$name = 'drbd';
$app_instance = $app['app_instance'];
$app_id = $app['app_id'];
foreach (explode('|', $agent_data['app'][$name][$app_instance]) as $part) {
list($stat, $val) = explode('=', $part);
if (!empty($stat)) {
$drbd[$stat] = $val;
}
}
$rrd_name = array('app', $name, $app_instance);
$rrd_def = RrdDefinition::make()
->addDataset('ns', 'DERIVE', 0, 125000000000)
->addDataset('nr', 'DERIVE', 0, 125000000000)
->addDataset('dw', 'DERIVE', 0, 125000000000)
->addDataset('dr', 'DERIVE', 0, 125000000000)
->addDataset('al', 'DERIVE', 0, 125000000000)
->addDataset('bm', 'DERIVE', 0, 125000000000)
->addDataset('lo', 'GAUGE', 0, 125000000000)
->addDataset('pe', 'GAUGE', 0, 125000000000)
->addDataset('ua', 'GAUGE', 0, 125000000000)
->addDataset('ap', 'GAUGE', 0, 125000000000)
->addDataset('oos', 'GAUGE', 0, 125000000000);
$fields = array(
'ns' => $drbd['ns'],
'nr' => $drbd['nr'],
'dw' => $drbd['dw'],
'dr' => $drbd['dr'],
'al' => $drbd['al'],
'bm' => $drbd['bm'],
'lo' => $drbd['lo'],
'pe' => $drbd['pe'],
'ua' => $drbd['ua'],
'ap' => $drbd['ap'],
'oos' => $drbd['oos'],
);
$tags = array('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
unset($drbd);