2010-02-24 21:44:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
2015-07-10 13:36:21 +02:00
|
|
|
$scale_min = '0';
|
|
|
|
|
$scale_max = '100';
|
2010-02-24 21:44:32 +00:00
|
|
|
|
2019-04-11 23:26:42 -05:00
|
|
|
require 'includes/html/graphs/common.inc.php';
|
2010-02-24 21:44:32 +00:00
|
|
|
|
2020-09-21 15:40:17 +02:00
|
|
|
$iter = '1';
|
2019-09-26 04:51:07 +02:00
|
|
|
$rrd_options .= " COMMENT:' Size Used % Used\\l'";
|
2011-03-17 13:35:25 +00:00
|
|
|
|
2021-01-13 07:23:47 -06:00
|
|
|
$storages = dbFetchRows('SELECT * FROM storage where device_id = ?', [$device['device_id']]);
|
|
|
|
|
|
|
|
|
|
if (empty($storages)) {
|
|
|
|
|
graph_text_and_exit('No Storage');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($storages as $storage) {
|
2015-07-10 13:36:21 +02:00
|
|
|
// FIXME generic colour function
|
|
|
|
|
if ($iter == '1') {
|
|
|
|
|
$colour = 'CC0000';
|
2016-08-18 20:28:22 -05:00
|
|
|
} elseif ($iter == '2') {
|
2015-07-10 13:36:21 +02:00
|
|
|
$colour = '008C00';
|
2016-08-18 20:28:22 -05:00
|
|
|
} elseif ($iter == '3') {
|
2015-07-10 13:36:21 +02:00
|
|
|
$colour = '4096EE';
|
2016-08-18 20:28:22 -05:00
|
|
|
} elseif ($iter == '4') {
|
2015-07-10 13:36:21 +02:00
|
|
|
$colour = '73880A';
|
2016-08-18 20:28:22 -05:00
|
|
|
} elseif ($iter == '5') {
|
2015-07-10 13:36:21 +02:00
|
|
|
$colour = 'D01F3C';
|
2016-08-18 20:28:22 -05:00
|
|
|
} elseif ($iter == '6') {
|
2015-07-10 13:36:21 +02:00
|
|
|
$colour = '36393D';
|
2016-08-18 20:28:22 -05:00
|
|
|
} elseif ($iter == '7') {
|
2015-07-10 13:36:21 +02:00
|
|
|
$colour = 'FF0084';
|
2020-09-21 15:40:17 +02:00
|
|
|
$iter = '0';
|
2015-07-10 13:36:21 +02:00
|
|
|
}
|
2011-03-17 13:35:25 +00:00
|
|
|
|
2021-03-28 17:25:30 -05:00
|
|
|
$descr = \LibreNMS\Data\Store\Rrd::fixedSafeDescr($storage['storage_descr'], 16);
|
|
|
|
|
$rrd = Rrd::name($device['hostname'], ['storage', $storage['storage_mib'], $storage['storage_descr']]);
|
2018-07-13 17:08:00 -05:00
|
|
|
$rrd_options .= " DEF:{$storage['storage_id']}used=$rrd:used:AVERAGE";
|
|
|
|
|
$rrd_options .= " DEF:{$storage['storage_id']}free=$rrd:free:AVERAGE";
|
|
|
|
|
$rrd_options .= " CDEF:{$storage['storage_id']}size={$storage['storage_id']}used,{$storage['storage_id']}free,+";
|
|
|
|
|
$rrd_options .= " CDEF:{$storage['storage_id']}perc={$storage['storage_id']}used,{$storage['storage_id']}size,/,100,*";
|
2020-09-21 15:40:17 +02:00
|
|
|
$rrd_options .= " LINE1.25:{$storage['storage_id']}perc#" . $colour . ":'$descr'";
|
2018-07-13 17:08:00 -05:00
|
|
|
$rrd_options .= " GPRINT:{$storage['storage_id']}size:LAST:%6.2lf%sB";
|
|
|
|
|
$rrd_options .= " GPRINT:{$storage['storage_id']}used:LAST:%6.2lf%sB";
|
2021-05-13 13:13:10 -05:00
|
|
|
$rrd_options .= " GPRINT:{$storage['storage_id']}perc:LAST:%5.2lf%%\\l";
|
2015-07-10 13:36:21 +02:00
|
|
|
$iter++;
|
|
|
|
|
}//end foreach
|