@@ -384,17 +384,22 @@ public function memberDrilldown( StatisticsRequest $r, string $type, int $typeid
384384 }
385385
386386 /**
387+ * Show latency graphs
388+ *
387389 * @param Request $r
388390 * @param int $vliid
389391 * @return $this|RedirectResponse
390392 * @throws \IXP\Exceptions\Services\Grapher\ParameterException
393+ * @throws \Illuminate\Auth\Access\AuthorizationException
391394 */
392- public function smokeping ( Request $ r , int $ vliid ){
395+ public function latency ( Request $ r , int $ vliid ){
393396 /** @var VlanInterfaceEntity $vli */
394397 if ( !( $ vli = D2EM ::getRepository ( VlanInterfaceEntity::class )->find ( $ vliid ) ) ){
395- abort ( 404 , 'Unknown vlan interface ' );
398+ abort ( 404 , 'Unknown VLAN interface ' );
396399 }
397400
401+ $ graph = App::make ('IXP\Services\Grapher ' )->latency ( $ vli );
402+ $ graph ->authorise ();
398403
399404 $ listProtocols = Graph::PROTOCOLS_REAL ;
400405
@@ -403,43 +408,37 @@ public function smokeping( Request $r, int $vliid ){
403408 $ enabled = 'get ' . ucfirst ( $ p ) . 'enabled ' ;
404409 $ canping = 'get ' . ucfirst ( $ p ) . 'canping ' ;
405410
406- if ( !$ vli ->$ enabled () || !$ vli ->$ canping () )
411+ if ( !$ vli ->$ enabled () || !$ vli ->$ canping () ) {
407412 unset( $ listProtocols [ $ p ] );
408- }
409-
410-
411- if ( count ( $ listProtocols ) ) {
412- $ proto = $ r ->input ( 'protocol ' );
413-
414- if ( !in_array ( $ proto , array_keys ( $ listProtocols ) ) ){
415- $ proto = array_keys ( $ listProtocols )[0 ];
416413 }
414+ }
417415
418- $ ipfn = 'get ' . $ listProtocols [ $ proto ] . 'Address ' ;
419- $ ip = $ vli ->$ ipfn ()->getAddress ();
420416
421- } else {
417+ if ( ! count ( $ listProtocols ) ) {
422418 AlertContainer::push (
423- "This customer does not have pinging enabled for any IP address(es) on the requested interface " ,
419+ "Protocol or ping not enabled on the requested interface " ,
424420 Alert::WARNING
425421 );
426422 return redirect ()->to ( route ( "statistics@member " ), [ "id " => $ vli ->getVirtualInterface ()->getCustomer ()->getId () ] );
427423 }
428424
429- $ graph = App::make ('IXP\Services\Grapher ' )->smokeping ( $ vli );
430425
431- $ graph ->setProtocol ( $ proto );
426+ $ proto = $ r ->input ( 'protocol ' );
427+ if ( !in_array ( $ proto , array_keys ( $ listProtocols ) ) ){
428+ $ proto = array_keys ( $ listProtocols )[0 ];
429+ }
432430
433- $ graph ->authorise ();
431+ $ ipfn = 'get ' . ucfirst ( $ listProtocols [ $ proto ] ) . 'Address ' ;
432+ $ ip = $ vli ->$ ipfn ()->getAddress ();
433+
434+ $ graph ->setProtocol ( $ proto );
434435
435- return view ( 'statistics/smokeping ' )->with ([
436+ return view ( 'statistics/latency ' )->with ([
436437 'c ' => $ vli ->getVirtualInterface ()->getCustomer (),
437438 'vli ' => $ vli ,
438439 'ip ' => $ ip ,
439440 'protocol ' => $ proto ,
440- 'grapher ' => $ graph ,
441-
441+ 'graph ' => $ graph ,
442442 ]);
443-
444443 }
445444}
0 commit comments