mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 16:04:35 +02:00
First cut at working poller for MIBs
This commit is contained in:
@@ -346,4 +346,28 @@ function poll_mib_def($device, $mib_name_table, $mib_subdir, $mib_oids, $mib_gra
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Please use this instead of creating & updating RRD files manually.
|
||||
* @param device Device object - only 'hostname' is used at present
|
||||
* @param name Array of name objects - filename will be constructed using this with a "-" delimiter
|
||||
* @param def Array of data definitions
|
||||
* @param val Array of value definitions
|
||||
*
|
||||
*/
|
||||
function rrd_create_update($device, $name, $def, $val, $step = 300)
|
||||
{
|
||||
global $config;
|
||||
$rrd = implode("/", array($config['rrd_dir'], $device['hostname'], safename(implode("-", $name)).".rrd"));
|
||||
d_echo("RRD file: $rrd");
|
||||
|
||||
if (!is_file($rrd)) {
|
||||
// add the --step and the rra definitions to the array
|
||||
$newdef = "--step $step ".implode(' ', $def).$config['rrd_rra'];
|
||||
d_echo("Creating RRD $rrd: $newdef");
|
||||
rrdtool_create($rrd, $newdef);
|
||||
}
|
||||
|
||||
rrdtool_update($rrd, $val);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user