mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
rrdtune code
This commit is contained in:
@@ -166,7 +166,7 @@ function rrdtool_graph($graph_file, $options) {
|
||||
function rrdtool($command, $filename, $options) {
|
||||
global $config, $debug, $rrd_pipes, $console_color;
|
||||
|
||||
if ($config['rrdcached'] && ($config['rrdtool_version'] >= 1.5 || $command != "create")) {
|
||||
if ($config['rrdcached'] && ($config['rrdtool_version'] >= 1.5 || ($command != "create" && $command != 'tune'))) {
|
||||
if (isset($config['rrdcached_dir']) && $config['rrdcached_dir'] !== false) {
|
||||
$filename = str_replace($config['rrd_dir'].'/', './'.$config['rrdcached_dir'].'/', $filename);
|
||||
$filename = str_replace($config['rrd_dir'], './'.$config['rrdcached_dir'].'/', $filename);
|
||||
@@ -294,3 +294,17 @@ function rrdtool_escape($string, $maxlength=null){
|
||||
return $result.' ';
|
||||
|
||||
}
|
||||
|
||||
function rrdtool_tune($type, $filename, $max) {
|
||||
if ($type === 'port') {
|
||||
if ($max < 10000000) {
|
||||
return false;
|
||||
}
|
||||
$max = $max / 8;
|
||||
$fields = array(
|
||||
'INOCTETS','OUTOCTETS','INERRORS','OUTERRORS','INUCASTPKTS','OUTUCASTPKTS','INNUCASTPKTS','OUTNUCASTPKTS','INDISCARDS','OUTDISCARDS','INUNKNOWNPROTOS','INBROADCASTPKTS','OUTBROADCASTPKTS','INMULTICASTPKTS','OUTMULTICASTPKTS'
|
||||
);
|
||||
$options = "--maxium " . implode(":$max --maximum ", $fields). ":$max";
|
||||
rrdtool('tune', $filename, $options);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user