Releasing soon Vigo is in alpha and closing in on its first stable release. Expect breaking changes between releases until then — we're looking for testing partners with meaningful fleets across diverse architectures. Learn more →

ports

The ports trait collector discovers listening TCP ports on the system.

Trait Structure

{
  "ports": {
    "listening": [22, 80, 443, 3306, 5432, 8080]
  }
}

Fields

Field Type Description
listening int[] Sorted list of TCP ports in LISTEN state

Platform Support

Platform Method
Linux Parses /proc/net/tcp and /proc/net/tcp6 for state 0A (LISTEN)
macOS sockstat -l or netstat -tln fallback
FreeBSD sockstat -l
OpenBSD netstat -tln
NetBSD netstat -tln
illumos sockstat -l
Windows Not supported (returns null)

When Expression Builtin

The port_listening() builtin checks whether a specific port is in the ports.listening array:

- name: nginx-config
  type: file
  target_path: /etc/nginx/nginx.conf
  content: "..."
  when: "port_listening(80)"

See When Expressions for details.

Classification

Volatile -- listening ports change as services start and stop. Collected every cycle.