Check that $fields has value

This commit is contained in:
laf
2015-12-08 15:17:53 +00:00
parent e75fc4b8b1
commit 48fab36592

View File

@ -300,6 +300,7 @@ function rrdtool_escape($string, $maxlength=null){
} }
function rrdtool_tune($type, $filename, $max) { function rrdtool_tune($type, $filename, $max) {
$fields = array();
if ($type === 'port') { if ($type === 'port') {
if ($max < 10000000) { if ($max < 10000000) {
return false; return false;
@ -309,6 +310,8 @@ function rrdtool_tune($type, $filename, $max) {
'INOCTETS','OUTOCTETS','INERRORS','OUTERRORS','INUCASTPKTS','OUTUCASTPKTS','INNUCASTPKTS','OUTNUCASTPKTS','INDISCARDS','OUTDISCARDS','INUNKNOWNPROTOS','INBROADCASTPKTS','OUTBROADCASTPKTS','INMULTICASTPKTS','OUTMULTICASTPKTS' 'INOCTETS','OUTOCTETS','INERRORS','OUTERRORS','INUCASTPKTS','OUTUCASTPKTS','INNUCASTPKTS','OUTNUCASTPKTS','INDISCARDS','OUTDISCARDS','INUNKNOWNPROTOS','INBROADCASTPKTS','OUTBROADCASTPKTS','INMULTICASTPKTS','OUTMULTICASTPKTS'
); );
} }
$options = "--maximum " . implode(":$max --maximum ", $fields). ":$max"; if (count($fields) > 0) {
rrdtool('tune', $filename, $options); $options = "--maximum " . implode(":$max --maximum ", $fields). ":$max";
rrdtool('tune', $filename, $options);
}
} }