2010-02-24 14:11:51 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$storage_cache = array();
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
foreach (dbFetchRows('SELECT * FROM storage WHERE device_id = ?', array($device['device_id'])) as $storage) {
|
2016-07-07 01:33:43 -05:00
|
|
|
$descr = $storage['storage_descr'];
|
|
|
|
$mib = $storage['storage_mib'];
|
2015-07-13 20:10:26 +02:00
|
|
|
|
2016-07-07 01:33:43 -05:00
|
|
|
echo 'Storage '. $descr .': ';
|
2015-07-13 20:10:26 +02:00
|
|
|
|
2016-07-07 01:33:43 -05:00
|
|
|
$rrd_name = array('storage', $mib, $descr);
|
|
|
|
$rrd_def = array(
|
|
|
|
'DS:used:GAUGE:600:0:U',
|
|
|
|
'DS:free:GAUGE:600:0:U'
|
|
|
|
);
|
2015-07-13 20:10:26 +02:00
|
|
|
|
2016-07-07 01:33:43 -05:00
|
|
|
$file = $config['install_dir'].'/includes/polling/storage/'. $mib .'.inc.php';
|
2015-07-13 20:10:26 +02:00
|
|
|
if (is_file($file)) {
|
|
|
|
include $file;
|
|
|
|
}
|
|
|
|
|
2015-08-20 15:02:40 +02:00
|
|
|
d_echo($storage);
|
2015-07-13 20:10:26 +02:00
|
|
|
|
|
|
|
if ($storage['size']) {
|
|
|
|
$percent = round(($storage['used'] / $storage['size'] * 100));
|
2016-08-28 12:32:58 -05:00
|
|
|
} else {
|
2015-07-13 20:10:26 +02:00
|
|
|
$percent = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $percent.'% ';
|
|
|
|
|
2015-08-18 16:26:55 +00:00
|
|
|
$fields = array(
|
|
|
|
'used' => $storage['used'],
|
|
|
|
'free' => $storage['free'],
|
|
|
|
);
|
|
|
|
|
2016-07-07 01:33:43 -05:00
|
|
|
$tags = compact('mib', 'descr', 'rrd_name', 'rrd_def');
|
|
|
|
data_update($device, 'storage', $tags, $fields);
|
2015-08-19 20:58:02 +00:00
|
|
|
|
2016-01-07 12:41:02 +00:00
|
|
|
$update = dbUpdate(array('storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage', '`storage_id` = ?', array($storage['storage_id']));
|
2015-07-13 20:10:26 +02:00
|
|
|
|
|
|
|
echo "\n";
|
|
|
|
}//end foreach
|
2010-02-24 14:11:51 +00:00
|
|
|
|
2010-03-14 14:38:30 +00:00
|
|
|
unset($storage);
|