trafficmonitor init...2
This commit is contained in:
parent
6bd251f60b
commit
56c93291bf
@ -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];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user