trafficmonitor init...2

This commit is contained in:
choi.jh 2025-11-12 15:11:30 +09:00
parent da9f79b32b
commit e1f2ddbfa3
2 changed files with 8 additions and 8 deletions

View File

@ -26,11 +26,11 @@ class Collector extends CommonController
public function execute(): void
{
$trafficService = service('trafficservice');
foreach ($trafficService->getEntities(['status' => STATUS['AVAILABLE']]) as $entity) {
$data = $this->service->getCalculatedData($entity);
foreach ($trafficService->getEntities(['status' => STATUS['AVAILABLE']]) as $trafficEntity) {
$data = $this->service->getCalculatedData($trafficEntity);
// Collector DB에 결과 저장
$this->service->create($this->createDTO($data));
log_message('info', "트래픽 계산 및 저장 완료 (UID: {$entity->getPK()}), In: {$data['in_kbits_sec']} Kb/s");
$entity = $this->service->create($this->createDTO($data));
log_message('info', "트래픽 계산 및 저장 완료 (UID: {$trafficEntity->getPK()}), In: {$entity->getIn()} Kb/s / Out: {$entity->getOut()} Kb/s");
}
}
}

View File

@ -131,10 +131,10 @@ class CollectorService extends CommonService
// DB에 저장할 데이터를 배열로 반환
return [
'trafficinfo_uid' => $trafficEntity->getPK(),
'in_kbits_sec' => round($inKbitsSec, 2),
'out_kbits_sec' => round($outKbitsSec, 2),
'raw_in_octets' => $currentInOctets,
'raw_out_octets' => $currentOutOctets,
'in' => round($inKbitsSec, 2),
'out' => round($outKbitsSec, 2),
'raw_in' => $currentInOctets,
'raw_out' => $currentOutOctets,
];
}
}