Socket
The socket collector is used to collect UDP/TCP port information.
Configuration¶
Preconditions¶
UDP metrics require the operating system to have nc
programs.
Attention
The socket collector are suitable for collecting local network TCP/UDP service. For public network, Dialtesting is recommended. If the URLs point to localhost, please turn off the election flag(election: false
).
Collector Configuration¶
Go to the conf.d/socket
directory under the DataKit installation directory, copy socket.conf.sample
and name it socket.conf
. Examples are as follows:
[[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"
After configuration, restart DataKit.
The collector can now be turned on by ConfigMap Injection Collector Configuration.
Metric¶
For all of the following measurements, the proto/dest_host/dest_port
global tag is appended by default, or other tags can be specified in the configuration by [inputs.socket.tags]
:
tcp
¶
- tag
Tag | Description |
---|---|
dest_host |
TCP domain or host, such as wwww.baidu.com , 1.2.3.4 |
dest_port |
TCP port, such as 80 |
proto |
Protocol, const to be tcp |
- metric list
Metric | Description | Type | Unit |
---|---|---|---|
response_time |
TCP connection time(without DNS query time) | int | μs |
response_time_with_dns |
TCP connection time(with DNS query time) | int | μs |
success |
1: success/-1: failed | int | - |
udp
¶
- tag
Tag | Description |
---|---|
dest_host |
UDP host |
dest_port |
UDP port |
proto |
Protocol, const to be udp |
- metric list
Metric | Description | Type | Unit |
---|---|---|---|
success |
1: success/-1: failed | int | - |