Files

34 lines
1.0 KiB
PHP
Raw Permalink Normal View History

<?php
/**
2016-08-20 12:16:55 +01:00
* LibreNMS
*
2016-08-20 12:16:55 +01:00
* This file is part of LibreNMS.
*
2013-10-29 05:38:12 +10:00
* @copyright (C) 2006 - 2012 Adam Armstrong
*/
2020-09-21 14:54:51 +02:00
$init_modules = ['web', 'auth'];
require realpath(__DIR__ . '/..') . '/includes/init.php';
2015-07-13 20:10:26 +02:00
2019-06-23 00:29:12 -05:00
if (is_numeric($_GET['id']) && (\LibreNMS\Config::get('allow_unauth_graphs') || port_permitted($_GET['id']))) {
2020-09-21 14:54:51 +02:00
$port = cleanPort(get_port_by_id($_GET['id']));
2015-07-13 20:10:26 +02:00
$device = device_by_id_cache($port['device_id']);
2020-09-21 14:54:51 +02:00
$title = generate_device_link($device);
$title .= ' :: Port ' . generate_port_link($port);
$auth = true;
2020-09-21 14:54:51 +02:00
$in = snmp_get($device, 'ifHCInOctets.' . $port['ifIndex'], '-OUqnv', 'IF-MIB');
2019-04-11 23:26:42 -05:00
if (empty($in)) {
2020-09-21 14:54:51 +02:00
$in = snmp_get($device, 'ifInOctets.' . $port['ifIndex'], '-OUqnv', 'IF-MIB');
2019-04-11 23:26:42 -05:00
}
2015-07-13 20:10:26 +02:00
2020-09-21 14:54:51 +02:00
$out = snmp_get($device, 'ifHCOutOctets.' . $port['ifIndex'], '-OUqnv', 'IF-MIB');
2019-04-11 23:26:42 -05:00
if (empty($out)) {
2020-09-21 14:54:51 +02:00
$out = snmp_get($device, 'ifOutOctets.' . $port['ifIndex'], '-OUqnv', 'IF-MIB');
2019-04-11 23:26:42 -05:00
}
$time = microtime(true);
printf("%lf|%s|%s\n", $time, $in, $out);
2019-04-11 23:26:42 -05:00
}