trafficmonitor init...2
This commit is contained in:
parent
da9f79b32b
commit
e1f2ddbfa3
@ -26,11 +26,11 @@ class Collector extends CommonController
|
|||||||
public function execute(): void
|
public function execute(): void
|
||||||
{
|
{
|
||||||
$trafficService = service('trafficservice');
|
$trafficService = service('trafficservice');
|
||||||
foreach ($trafficService->getEntities(['status' => STATUS['AVAILABLE']]) as $entity) {
|
foreach ($trafficService->getEntities(['status' => STATUS['AVAILABLE']]) as $trafficEntity) {
|
||||||
$data = $this->service->getCalculatedData($entity);
|
$data = $this->service->getCalculatedData($trafficEntity);
|
||||||
// Collector DB에 결과 저장
|
// Collector DB에 결과 저장
|
||||||
$this->service->create($this->createDTO($data));
|
$entity = $this->service->create($this->createDTO($data));
|
||||||
log_message('info', "트래픽 계산 및 저장 완료 (UID: {$entity->getPK()}), In: {$data['in_kbits_sec']} Kb/s");
|
log_message('info', "트래픽 계산 및 저장 완료 (UID: {$trafficEntity->getPK()}), In: {$entity->getIn()} Kb/s / Out: {$entity->getOut()} Kb/s");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,10 +131,10 @@ class CollectorService extends CommonService
|
|||||||
// DB에 저장할 데이터를 배열로 반환
|
// DB에 저장할 데이터를 배열로 반환
|
||||||
return [
|
return [
|
||||||
'trafficinfo_uid' => $trafficEntity->getPK(),
|
'trafficinfo_uid' => $trafficEntity->getPK(),
|
||||||
'in_kbits_sec' => round($inKbitsSec, 2),
|
'in' => round($inKbitsSec, 2),
|
||||||
'out_kbits_sec' => round($outKbitsSec, 2),
|
'out' => round($outKbitsSec, 2),
|
||||||
'raw_in_octets' => $currentInOctets,
|
'raw_in' => $currentInOctets,
|
||||||
'raw_out_octets' => $currentOutOctets,
|
'raw_out' => $currentOutOctets,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user