Skip to content

Commit 53333e4

Browse files
committed
Peering Matrix - increase lookback days and make configurable
1 parent 4dea3a7 commit 53333e4

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

app/Http/Controllers/PeeringMatrixController.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ private function getPeers( int $vlan, int $protocol = 6, bool $restrictActivePee
218218
return $apeers;
219219
}
220220

221+
// the number of days back we look is not a perfect science. generally, the bigger the interface / more
222+
// traffic, the less likely we'll find bgp sessions recently via sflow sampling.
223+
// 28 days seems good in practice but his can be changed in config/ixp.php
224+
$lookback_days = (int)config( 'ixp.peering-matrix.lookback_days' );
225+
if( !is_int( $lookback_days ) || $lookback_days < 1 ) {
226+
$lookback_days = 30;
227+
}
228+
221229
// we've added "bs.timestamp >= NOW() - INTERVAL 7 DAY" below as we don't
222230
// dump old date (yet) and the time to run the query is O(n) on number
223231
// of rows...
@@ -237,7 +245,7 @@ private function getPeers( int $vlan, int $protocol = 6, bool $restrictActivePee
237245
->leftJoin( 'cust AS cs', 'cs.id', 'vis.custid' )
238246
->leftJoin( 'cust AS cd', 'cd.id', 'vid.custid' )
239247
->leftJoin( 'vlan', 'vlan.id', 'srcip.vlanid' )
240-
->whereRaw( 'bs.last_seen >= NOW() - INTERVAL 7 DAY' )
248+
->whereRaw( 'bs.last_seen >= NOW() - INTERVAL ' . $lookback_days . ' DAY' )
241249
->where( 'bs.protocol', $protocol )
242250
->where( 'bs.packetcount', '>=', 1 )
243251
->where( 'vlan.id', $vlan )

config/ixp.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,16 @@
7676
],
7777

7878

79-
/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
80-
;; Minimum user auth level for the peering matrix
81-
;;
82-
;; See https://docs.ixpmanager.org/usage/users/#types-of-users
83-
;;
84-
;; */
8579
'peering-matrix' => [
80+
81+
// Minimum user auth level for the peering matrix
82+
// See https://docs.ixpmanager.org/usage/users/#types-of-users
8683
'min-auth' => env( 'PEERING_MATRIX_MIN_AUTH', \IXP\Models\User::AUTH_PUBLIC ),
84+
85+
// the number of days back we look is not a perfect science. generally, the bigger the interface / more
86+
// traffic, the less likely we'll find bgp sessions recently via sflow sampling.
87+
// 28 days seems good in practice but his can be changed in config/ixp.php
88+
'lookback_days' => env( 'PEERING_MATRIX_LOOKBACK_DAYS', 28 ),
8789
],
8890

8991

0 commit comments

Comments
 (0)