Socket
UDP/TCP 포트 메트릭 데이터를 수집합니다.
설정¶
사전 조건¶
UDP 메트릭를 사용하려면 운영 체제에 nc 프로그램이 있어야 합니다.
Info
소켓 수집기는 인트라넷에서 TCP/UDP 포트 검색에 적합합니다. 공용 네트워크 서비스의 경우 다이얼 테스트 기능 사용을 권장합니다. 서비스 주소가 로컬 시스템을 가리키는 경우 수집기의 선택(election: false) 기능을 끄십시오. 그렇지 않으면 잘못된 수집이 발생합니다.
수집기 설정¶
DataKit 설치 디렉토리 아래에 conf.d/samples 디렉토리를 입력하고 socket.conf.sample를 복사한 후 이름을 socket.conf로 지정합니다. 예는 다음과 같습니다:
[[inputs.socket]]
## Support TCP/UDP.
## If the quantity to be detected is too large, it is recommended to open more collectors
dest_url = [
"tcp://host:port",
"udp://host:port",
]
## @param interval - number - optional - default: 30
interval = "30s"
## @param interval - number - optional - default: 10
tcp_timeout = "10s"
## @param interval - number - optional - default: 10
udp_timeout = "10s"
## set false to disable election
election = true
[inputs.socket.tags]
# some_tag = "some_value"
# more_tag = "some_other_value"
구성한 후 DataKit을 다시 시작하면 됩니다.
현재 수집기 구성을 삽입하는 ConfigMap 메서드를 통해 컬렉터를 켤 수 있습니다.
Kubernetes 환경에서 DataKit 도메인 이름은 datakit-service.datakit.svc이며 로그 전송자는 DataKit 도메인 이름을 수신자로 지정할 수 있습니다. 일반적으로 UDP 프로토콜에는 도메인 이름만 사용하는 것이 좋습니다. TCP 프로토콜에는 컨텍스트가 부족한 여러 줄의 데이터가 있을 수 있습니다.
메트릭¶
다음 메트릭 세트는 모두 기본적으로 proto/dest_host/dest_port 글로벌 태그와 함께 추가됩니다. 구성에서 [inputs.socket.tags]를 통해 다른 태그를 지정할 수도 있습니다.
tcp¶
| Tags & Fields | Description |
|---|---|
| dest_host ( tag) |
Configured TCP destination domain name or IP address, such as www.google.com or 1.2.3.4. |
| dest_port ( tag) |
Configured TCP destination port, such as 80. |
| proto ( tag) |
Socket protocol. Always tcp for this measurement. |
| response_time | TCP connection duration excluding DNS lookup time. Type: int | (gauge) Unit: time,μs Tagged by: dest_host, dest_port, proto |
| response_time_with_dns | TCP connection duration including DNS lookup time. Type: int | (gauge) Unit: time,μs Tagged by: dest_host, dest_port, proto |
| success | Socket probe result: 1 for success and -1 for failure. Type: int | (gauge) Unit: N/A Tagged by: dest_host, dest_port, proto |
udp¶
| Tags & Fields | Description |
|---|---|
| dest_host ( tag) |
Configured UDP destination domain name or IP address. |
| dest_port ( tag) |
Configured UDP destination port. |
| proto ( tag) |
Socket protocol. Always udp for this measurement. |
| success | Socket probe result: 1 for success and -1 for failure. Type: int | (gauge) Unit: N/A Tagged by: dest_host, dest_port, proto |