2009-09-07 11:07:59 +00:00
|
|
|
<?php
|
2007-04-04 10:15:07 +00:00
|
|
|
|
2019-06-23 00:29:12 -05:00
|
|
|
// Graphs are printed in the order they exist in \LibreNMS\Config::get('graph_types')
|
2011-09-18 13:11:04 +00:00
|
|
|
$link_array = [
|
2024-01-05 05:39:12 +01:00
|
|
|
'page' => 'device',
|
2011-09-18 13:11:04 +00:00
|
|
|
'device' => $device['device_id'],
|
2024-01-05 05:39:12 +01:00
|
|
|
'tab' => 'graphs',
|
2015-07-13 20:10:26 +02:00
|
|
|
];
|
2010-07-31 00:54:51 +00:00
|
|
|
|
2011-09-18 13:11:04 +00:00
|
|
|
$bg = '#ffffff';
|
|
|
|
|
|
2010-07-18 03:56:19 +00:00
|
|
|
echo '<div style="clear: both;">';
|
2010-01-08 00:01:26 +00:00
|
|
|
|
2011-09-18 18:22:07 +00:00
|
|
|
print_optionbar_start();
|
2010-01-08 00:01:26 +00:00
|
|
|
|
2011-04-30 22:20:11 +00:00
|
|
|
echo "<span style='font-weight: bold;'>Graphs</span> » ";
|
|
|
|
|
|
2022-08-30 12:55:37 -05:00
|
|
|
$graph_enable = [];
|
2012-04-26 11:57:52 +00:00
|
|
|
foreach (dbFetchRows('SELECT * FROM device_graphs WHERE device_id = ? ORDER BY graph', [$device['device_id']]) as $graph) {
|
2019-06-23 00:29:12 -05:00
|
|
|
$section = \LibreNMS\Config::get("graph_types.device.{$graph['graph']}.section");
|
2015-06-10 20:04:38 +10:00
|
|
|
if ($section != '') {
|
|
|
|
|
$graph_enable[$section][$graph['graph']] = $graph['graph'];
|
|
|
|
|
}
|
2010-07-31 00:54:51 +00:00
|
|
|
}
|
|
|
|
|
|
2015-06-13 15:21:58 +10:00
|
|
|
$sep = '';
|
2012-05-02 22:02:30 +00:00
|
|
|
foreach ($graph_enable as $section => $nothing) {
|
2011-09-18 18:22:07 +00:00
|
|
|
if (isset($graph_enable) && is_array($graph_enable[$section])) {
|
|
|
|
|
$type = strtolower($section);
|
2022-08-30 12:55:37 -05:00
|
|
|
if (empty($vars['group'])) {
|
2011-09-18 18:22:07 +00:00
|
|
|
$vars['group'] = $type;
|
|
|
|
|
}
|
2015-07-13 20:10:26 +02:00
|
|
|
|
2010-07-31 00:54:51 +00:00
|
|
|
echo $sep;
|
2011-09-18 18:22:07 +00:00
|
|
|
if ($vars['group'] == $type) {
|
2011-04-09 14:45:29 +00:00
|
|
|
echo '<span class="pagemenu-selected">';
|
2010-07-31 00:54:51 +00:00
|
|
|
}
|
2015-07-13 20:10:26 +02:00
|
|
|
|
2019-12-19 01:17:21 +01:00
|
|
|
if ($type == 'customoid') {
|
|
|
|
|
echo generate_link(ucwords('Custom OID'), $link_array, ['group' => $type]);
|
|
|
|
|
} else {
|
|
|
|
|
echo generate_link(ucwords($type), $link_array, ['group' => $type]);
|
|
|
|
|
}
|
2011-09-20 09:55:11 +00:00
|
|
|
if ($vars['group'] == $type) {
|
|
|
|
|
echo '</span>';
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-31 00:54:51 +00:00
|
|
|
$sep = ' | ';
|
2011-04-09 14:45:29 +00:00
|
|
|
}
|
2007-04-04 10:15:07 +00:00
|
|
|
}
|
2015-07-13 20:10:26 +02:00
|
|
|
|
2010-07-18 03:56:19 +00:00
|
|
|
unset($sep);
|
2015-06-13 15:21:58 +10:00
|
|
|
|
2010-07-18 03:56:19 +00:00
|
|
|
print_optionbar_end();
|
|
|
|
|
|
2022-08-30 12:55:37 -05:00
|
|
|
$group = $vars['group'] ?? array_key_first($graph_enable);
|
|
|
|
|
$graph_enable = $graph_enable[$group] ?? [];
|
2020-06-22 22:57:30 +02:00
|
|
|
|
2023-03-13 22:32:22 +01:00
|
|
|
if (($group != 'customoid') && is_file("includes/html/pages/device/graphs/$group.inc.php")) {
|
2020-06-22 22:57:30 +02:00
|
|
|
include "includes/html/pages/device/graphs/$group.inc.php";
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($graph_enable as $graph => $entry) {
|
|
|
|
|
$graph_array = [];
|
|
|
|
|
if ($graph_enable[$graph]) {
|
|
|
|
|
if ($graph == 'customoid') {
|
|
|
|
|
foreach (dbFetchRows('SELECT * FROM `customoids` WHERE `device_id` = ? ORDER BY `customoid_descr`', [$device['device_id']]) as $graph_entry) {
|
|
|
|
|
$graph_title = \LibreNMS\Config::get("graph_types.device.$graph.descr") . ': ' . $graph_entry['customoid_descr'];
|
|
|
|
|
$graph_array['type'] = 'customoid_' . $graph_entry['customoid_descr'];
|
|
|
|
|
if (! empty($graph_entry['customoid_unit'])) {
|
|
|
|
|
$graph_array['unit'] = $graph_entry['customoid_unit'];
|
|
|
|
|
} else {
|
|
|
|
|
$graph_array['unit'] = 'value';
|
|
|
|
|
}
|
|
|
|
|
include 'includes/html/print-device-graph.php';
|
2019-12-19 01:17:21 +01:00
|
|
|
}
|
2020-06-22 22:57:30 +02:00
|
|
|
} else {
|
|
|
|
|
$graph_title = \LibreNMS\Config::get("graph_types.device.$graph.descr");
|
|
|
|
|
$graph_array['type'] = 'device_' . $graph;
|
2019-12-19 01:17:21 +01:00
|
|
|
include 'includes/html/print-device-graph.php';
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-10-18 14:27:21 +00:00
|
|
|
$pagetitle[] = 'Graphs';
|