Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -1,12 +1,12 @@
<?php
/**
* Observium Network Management and Monitoring System
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage web
* @author Adam Armstrong <adama@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
@ -15,20 +15,20 @@ register_html_title("Customers");
$navbar['brand'] = "Customers";
$navbar['class'] = "navbar-narrow";
if (isset($vars['customer']) && $vars['customer'] == 'hide') {
if (get_var_false($vars['customer'], 'hide')) {
$navbar['options_right']['cust']['class'] = 'active';
$navbar['options_right']['cust']['url'] = generate_url($vars, array('customer' => NULL));
$navbar['options_right']['cust']['url'] = generate_url($vars, ['customer' => NULL]);
} else {
$navbar['options_right']['cust']['url'] = generate_url($vars, array('customer' => 'hide'));
$navbar['options_right']['cust']['url'] = generate_url($vars, ['customer' => 'hide']);
}
$navbar['options_right']['cust']['text'] = 'Customer Graphs';
$navbar['options_right']['cust']['icon'] = $config['icon']['graphs'];
if (isset($vars['aggregate']) && $vars['aggregate'] == 'show') {
if (get_var_true($vars['aggregate'], 'show')) {
$navbar['options_right']['aggregate']['class'] = 'active';
$navbar['options_right']['aggregate']['url'] = generate_url($vars, array('aggregate' => NULL));
$navbar['options_right']['aggregate']['url'] = generate_url($vars, ['aggregate' => NULL]);
} else {
$navbar['options_right']['aggregate']['url'] = generate_url($vars, array('aggregate' => 'show'));
$navbar['options_right']['aggregate']['url'] = generate_url($vars, ['aggregate' => 'show']);
}
$navbar['options_right']['aggregate']['text'] = 'Aggregate';
$navbar['options_right']['aggregate']['icon'] = $config['icon']['graphs'];
@ -37,28 +37,20 @@ $navbar['options_right']['aggregate']['icon'] = $config['icon']['graphs'];
print_navbar($navbar);
unset($navbar);
$where = generate_where_clause("`port_descr_type` = 'cust'", $cache['where']['ports_permitted']);
/// Generate customer aggregate graph
if (get_var_true($vars['aggregate'], 'show')) {
if (isset($vars['aggregate']) && $vars['aggregate'] == 'show') {
$port_list = implode(',', dbFetchColumn('SELECT `port_id` FROM `ports` ' . $where));
$where = "WHERE `port_descr_type` = 'cust'";
$where .= generate_query_permitted(array('port'));
$ports = dbFetchRows('SELECT `port_id` FROM `ports` ' . $where);
$port_list = array();
foreach ($ports as $port) {
$port_list[] = $port['port_id'];
}
$port_list = implode(',', $port_list);
echo generate_box_open(array('title' => 'Total Customer Traffic'));
echo generate_box_open(['title' => 'Total Customer Traffic']);
if ($port_list) {
$graph_array['type'] = 'multi-port_bits_separate';
$graph_array['to'] = $config['time']['now'];
$graph_array['type'] = 'multi-port_bits_separate';
$graph_array['to'] = get_time();
$graph_array['legend'] = 'no';
$graph_array['id'] = $port_list;
$graph_array['id'] = $port_list;
print_graph_row($graph_array);
@ -85,22 +77,21 @@ echo generate_box_open();
<?php
$customers = [];
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `port_descr_type` = 'cust' ORDER BY `port_descr_descr`") as $customer) {
$customers[$customer['port_descr_descr']][] = $customer;
foreach (dbFetchRows("SELECT * FROM `ports` $where ORDER BY `port_descr_descr`") as $customer) {
$customers[$customer['port_descr_descr']][] = $customer;
}
foreach($customers as $customer => $ports) {
foreach ($customers as $customer => $ports) {
$customer_name = $customer; // Set text name to use on first port.
$customer_name = $customer; // Set text name to use on first port.
foreach ($ports as $port) {
$device = device_by_id_cache($port['device_id']);
unset($class);
$ifclass = port_html_class($port['ifOperStatus'], $port['ifAdminStatus'], $port['encrypted']);
//$ifclass = port_html_class($port['ifOperStatus'], $port['ifAdminStatus'], $port['encrypted']);
if ($device['os'] == "ios") {
if ($port['ifTrunk']) {
@ -114,24 +105,24 @@ foreach($customers as $customer => $ports) {
echo('
<tr>
<td style="width: 250px;"><span style="font-weight: bold;" class="interface">' . $customer_name . '</span></td>
<td style="width: 250px;"><span style="font-weight: bold;" class="interface">' . escape_html($customer_name) . '</span></td>
<td style="width: 150px;">' . generate_device_link($device) . '</td>
<td style="width: 100px;">' . generate_port_link_short($port) . '</td>
<td style="width: 100px;">' . $port['port_descr_speed'] . '</td>
<td style="width: 100px;">' . $port['port_descr_circuit'] . '</td>
<td>' . $port['port_descr_notes'] . '</td>
<td>' . escape_html($port['port_descr_notes']) . '</td>
</tr>
');
unset($customer_name);
}
if ($config['int_customers_graphs'] && !(isset($vars['customer']) && $vars['customer'] == "hide")) {
if ($config['ports']['descr_groups']['cust']['graphs'] && !get_var_false($vars['customer'], 'hide')) {
echo('<tr><td colspan="7">');
$graph_array['type'] = "customer_bits";
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = '"' . $port['port_descr_descr'] . '"'; // use double quotes for prevent split var by commas
$graph_array['to'] = get_time();
$graph_array['id'] = '"' . escape_html($port['port_descr_descr']) . '"'; // use double quotes for prevent split var by commas
print_graph_row($graph_array);