mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
Merge pull request #1715 from laf/rrdoptions
Updated rrdtool_update() to use new array format
This commit is contained in:
@@ -234,20 +234,23 @@ function rrdtool_create($filename, $options) {
|
||||
function rrdtool_update($filename, $options) {
|
||||
$values = array();
|
||||
// Do some sanitisation on the data if passed as an array.
|
||||
|
||||
if (is_array($options)) {
|
||||
$values[] = 'N';
|
||||
foreach ($options as $value) {
|
||||
if (!is_numeric($value)) {
|
||||
$value = U;
|
||||
foreach ($options as $k => $v) {
|
||||
if (!is_numeric($v)) {
|
||||
$v = U;
|
||||
}
|
||||
|
||||
$values[] = $value;
|
||||
$values[] = $v;
|
||||
}
|
||||
|
||||
$options = implode(':', $values);
|
||||
return rrdtool('update', $filename, $options);
|
||||
}
|
||||
else {
|
||||
return 'Bad options passed to rrdtool_update';
|
||||
}
|
||||
|
||||
return rrdtool('update', $filename, $options);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user