Skip to content

Commit

Permalink
Fixes #200 - checking on an undefined snmpid, do not include those in…
Browse files Browse the repository at this point in the history
…to the mrtg conf
  • Loading branch information
barryo committed Feb 18, 2015
1 parent 1c78ee5 commit 3674006
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions application/controllers/StatisticsCliController.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,18 +480,21 @@ private function genMrtgConf_getPeeringPortsByInfrastructure( $ixp )

foreach( $switch->getPorts() as $port )
{
$snmpId = $port->ifnameToSNMPIdentifier();
$data[ $infra->getId() ]['maxbytes'] += $port->getIfHighSpeed() * 1000000 / 8; // Mbps * bps / to bytes
$data[ $infra->getId() ]['switches'][ $switch->getId() ]['maxbytes'] += $port->getIfHighSpeed() * 1000000 / 8;

foreach( IXP_Mrtg::$TRAFFIC_TYPES as $type => $vars )
if( $port->getIfName() )
{
$id = "{$vars['in']}#{$snmpId}&{$vars['out']}#{$snmpId}:{$switch->getSnmppasswd()}@{$switch->getHostname()}:::::2";

if( $port->getType() == \Entities\SwitchPort::TYPE_PEERING )
$data[ $infra->getId() ]['mrtgIds'][$type][] = $id;

$data[ $infra->getId() ]['switches'][ $switch->getId() ]['mrtgIds'][$type][] = $id;
$snmpId = $port->ifnameToSNMPIdentifier();
$data[ $infra->getId() ]['maxbytes'] += $port->getIfHighSpeed() * 1000000 / 8; // Mbps * bps / to bytes
$data[ $infra->getId() ]['switches'][ $switch->getId() ]['maxbytes'] += $port->getIfHighSpeed() * 1000000 / 8;

foreach( IXP_Mrtg::$TRAFFIC_TYPES as $type => $vars )
{
$id = "{$vars['in']}#{$snmpId}&{$vars['out']}#{$snmpId}:{$switch->getSnmppasswd()}@{$switch->getHostname()}:::::2";

if( $port->getType() == \Entities\SwitchPort::TYPE_PEERING )
$data[ $infra->getId() ]['mrtgIds'][$type][] = $id;

$data[ $infra->getId() ]['switches'][ $switch->getId() ]['mrtgIds'][$type][] = $id;
}
}
}
}
Expand Down

0 comments on commit 3674006

Please sign in to comment.