From 56c93291bf2958655e6f8aab71640184237b425c Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Wed, 12 Nov 2025 15:51:52 +0900 Subject: [PATCH] trafficmonitor init...2 --- app/Services/CollectorService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Services/CollectorService.php b/app/Services/CollectorService.php index 1fc60f5..8c814c1 100644 --- a/app/Services/CollectorService.php +++ b/app/Services/CollectorService.php @@ -77,7 +77,7 @@ class CollectorService extends CommonService $this->model->orLike($this->model->getTable() . "." . $this->model->getTitleField(), $word, 'both'); parent::setSearchWord($word); } - + //SNMP연결 private function getSNMPOctets(TrafficEntity $trafficEntity, string $oid): ?int { $fullOid = $oid . $trafficEntity->getInterface(); @@ -91,8 +91,8 @@ class CollectorService extends CommonService log_message('error', "SNMP 통신 실패: {$ip} ({$fullOid}, Community: {$community})"); return null; } - // 결과 문자열에서 숫자 값만 추출하여 정수로 변환 - if (preg_match('/\d+/', $result, $matches)) { + // 💡 정규식 수정: /\d+$/ (문자열 끝의 숫자만 추출) + if (preg_match('/\d+$/', $result, $matches)) { // SNMP Counter는 BigInt가 될 수 있으므로 intval 대신 (int) 캐스팅을 사용하여 // 최대한 큰 정수로 변환합니다. PHP 64비트 환경이 필요합니다. return (int)$matches[0];