Commit version 24.12.13800
This commit is contained in:
@ -6,32 +6,42 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
include_once("../includes/observium.inc.php");
|
||||
|
||||
include_once("../includes/sql-config.inc.php");
|
||||
if (!$config['web_iframe'] && is_iframe()) {
|
||||
print_error_permission("Not allowed to run in a iframe!");
|
||||
die();
|
||||
}
|
||||
|
||||
include($config['html_dir'] . "/includes/functions.inc.php");
|
||||
include($config['html_dir'] . "/includes/authenticate.inc.php");
|
||||
|
||||
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted($_GET['id']))) {
|
||||
$port = get_port_by_id($_GET['id']);
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
//$title = generate_device_link($device);
|
||||
//$title .= " :: Port ".generate_port_link($port);
|
||||
$auth = TRUE;
|
||||
$port = get_port_by_id($_GET['id']);
|
||||
$device = device_by_id_cache($port['device_id']);
|
||||
//$title = generate_device_link($device);
|
||||
//$title .= " :: Port ".generate_port_link($port);
|
||||
$auth = TRUE;
|
||||
|
||||
$time = time();
|
||||
$HC = ($port['port_64bit'] ? 'HC' : '');
|
||||
if ($device['os'] === 'netapp' && is_device_mib($device, "NETAPP-MIB")) {
|
||||
$oid_in_octets = 'if64InOctets';
|
||||
$oid_out_octets = 'if64OutOctets';
|
||||
$mib = "NETAPP-MIB";
|
||||
} else {
|
||||
$oid_in_octets = $port['port_64bit'] ? 'ifHCInOctets' : 'ifInOctets';
|
||||
$oid_out_octets = $port['port_64bit'] ? 'ifHCOutOctets' : 'ifOutOctets';
|
||||
$mib = "IF-MIB";
|
||||
}
|
||||
|
||||
$data = snmp_get_multi_oid($device, "if{$HC}InOctets.".$port['ifIndex']." if{$HC}OutOctets.".$port['ifIndex'], [], "IF-MIB");
|
||||
$data = snmp_get_multi_oid($device, [ $oid_in_octets . '.' . $port['ifIndex'], $oid_out_octets . '.' . $port['ifIndex'] ], [], $mib);
|
||||
|
||||
printf("%lf|%s|%s\n", $time, $data[$port['ifIndex']]["if{$HC}InOctets"], $data[$port['ifIndex']]["if{$HC}OutOctets"]);
|
||||
printf("%lf|%s|%s\n", snmp_endtime(), $data[$port['ifIndex']][$oid_in_octets], $data[$port['ifIndex']][$oid_out_octets]);
|
||||
} else {
|
||||
echo("unauthenticated");
|
||||
exit;
|
||||
// not authenticated
|
||||
die("Unauthenticated");
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
Reference in New Issue
Block a user