Skip to content

socket

Use case

Confirm a TCP port is listening locally, or reachable on a remote host - a lighter-weight alternative to http for non-HTTP services (databases, message queues, …). UDP is not supported.

Configuration

Field Type Meaning
socket string required, local <tcp|udp> <port> or remote <host> <tcp|udp> <port>
connect bool also open a real TCP connection, not just inspect the connection table; default false for local, true for remote

udp is refused outright (“UDP socket not implemented”).

Output

Item Type Meaning
socket_name string the check name (tag)
socket_port int the port (tag)
socket_type string always "local" (tag, even for a remote check)
socket_proto string "tcp" (tag)
socket_alive string "yes"/"no", or "n/a" for a remote check with connect: false and no established connection seen (datapoint)
socket_count int established connections matching the port (datapoint)

Example

checks:
  - module: socket
    name: redis
    conf:
      socket: local tcp 6379
      connect: true

  - module: socket
    name: www_google
    conf:
      socket: remote www.google.com tcp 443