commit version 22.12.12447
This commit is contained in:
@ -6,57 +6,50 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$graph_type = "storage_usage";
|
||||
|
||||
$sql = "SELECT * FROM `storage`";
|
||||
//$sql .= " LEFT JOIN `storage-state` USING(`storage_id`)";
|
||||
$sql .= " WHERE `device_id` = ?";
|
||||
$sql .= " WHERE `device_id` = ? AND `storage_ignore` = ? AND `storage_deleted` = ?";
|
||||
|
||||
$drives = dbFetchRows($sql, array($device['device_id']));
|
||||
$drives = dbFetchRows($sql, [ $device['device_id'], 0, 0 ]);
|
||||
|
||||
if (count($drives))
|
||||
{
|
||||
$drives = array_sort_by($drives, 'storage_descr', SORT_ASC, SORT_STRING);
|
||||
if (!safe_empty($drives)) {
|
||||
$drives = array_sort_by($drives, 'storage_mib', SORT_ASC, SORT_STRING,
|
||||
'storage_descr', SORT_ASC, SORT_STRING);
|
||||
|
||||
$box_args = array('title' => 'Storage',
|
||||
'url' => generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'health', 'metric' => 'storage')),
|
||||
'icon' => $config['icon']['storage'],
|
||||
);
|
||||
$box_args = [
|
||||
'title' => 'Storage',
|
||||
'url' => generate_url([ 'page' => 'device', 'device' => $device['device_id'], 'tab' => 'health', 'metric' => 'storage' ]),
|
||||
'icon' => $config['icon']['storage'],
|
||||
];
|
||||
echo generate_box_open($box_args);
|
||||
|
||||
echo('<table class="table table-condensed table-striped">');
|
||||
|
||||
foreach ($drives as $drive)
|
||||
{
|
||||
foreach ($drives as $drive) {
|
||||
$skipdrive = FALSE;
|
||||
|
||||
if ($device["os"] === "junos")
|
||||
{
|
||||
foreach ($config['ignore_junos_os_drives'] as $jdrive)
|
||||
{
|
||||
if (preg_match($jdrive, $drive["storage_descr"]))
|
||||
{
|
||||
if ($device["os"] === "junos") {
|
||||
foreach ($config['ignore_junos_os_drives'] as $jdrive) {
|
||||
if (preg_match($jdrive, $drive["storage_descr"])) {
|
||||
$skipdrive = TRUE;
|
||||
}
|
||||
}
|
||||
//$drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]);
|
||||
}
|
||||
|
||||
if ($device['os'] === "freebsd")
|
||||
{
|
||||
foreach ($config['ignore_bsd_os_drives'] as $jdrive)
|
||||
{
|
||||
if (preg_match($jdrive, $drive["storage_descr"]))
|
||||
{
|
||||
if ($device['os'] === "freebsd") {
|
||||
foreach ($config['ignore_bsd_os_drives'] as $jdrive) {
|
||||
if (preg_match($jdrive, $drive["storage_descr"])) {
|
||||
$skipdrive = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($drive['storage_ignore']) { $skipdrive = TRUE; }
|
||||
//if ($drive['storage_ignore']) { $skipdrive = TRUE; }
|
||||
|
||||
if ($skipdrive) { continue; }
|
||||
|
||||
@ -69,13 +62,13 @@ if (count($drives))
|
||||
$used = formatStorage($drive['storage_used']);
|
||||
$background = get_percentage_colours($percent);
|
||||
|
||||
$graph_array = array();
|
||||
$graph_array = [];
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "210";
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['to'] = get_time();
|
||||
$graph_array['id'] = $drive['storage_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
$graph_array['from'] = $config['time']['day'];
|
||||
$graph_array['from'] = get_time('day');
|
||||
$graph_array['legend'] = "no";
|
||||
|
||||
$link_array = $graph_array;
|
||||
@ -85,7 +78,9 @@ if (count($drives))
|
||||
|
||||
$overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $drive['storage_descr']);
|
||||
|
||||
$graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00';
|
||||
$graph_array['width'] = 80;
|
||||
$graph_array['height'] = 20;
|
||||
$graph_array['bg'] = 'ffffff00';
|
||||
// $graph_array['style'][] = 'margin-top: -6px';
|
||||
|
||||
$minigraph = generate_graph_tag($graph_array);
|
||||
|
Reference in New Issue
Block a user