---
title: ''
description: Telegraf plugin for collecting metrics from Socket Statistics
url: https://docs.influxdata.com/telegraf/v1/input-plugins/socketstat/
estimated_tokens: 706
product: Telegraf Enterprise
version: v1
publisher: InfluxData
canonical: https://docs.influxdata.com/telegraf/v1/input-plugins/socketstat/
date: '2026-05-21T20:10:18+02:00'
lastmod: '2026-05-21T20:10:18+02:00'
---

==========

* Telegraf v1.22.0+

[Plugin source](https://github.com/influxdata/telegraf/tree/v1.39.1/plugins/inputs/socketstat/)[Download configuration](https://raw.githubusercontent.com/influxdata/telegraf/refs/tags/v1.39.1/plugins/inputs/socketstat/sample.conf)

# Socket Statistics Input Plugin

This plugin gathers metrics for established network connections using[iproute2](https://github.com/iproute2/iproute2)’s `ss` command. The `ss` command does not require specific
privileges.

This plugin produces high cardinality data, which when not controlled for will
cause high load on your database. Please make sure to [filter](/telegraf/v1/configuration/#metric-filtering) the
produced metrics or configure your database to avoid cardinality issues!

**Introduced in:** Telegraf v1.22.0**Tags:** network**OS support:** freebsd, linux, macos

## Global configuration options

Plugins support additional global and plugin configuration settings for tasks
such as modifying metrics, tags, and fields, creating aliases, and configuring
plugin ordering. See [CONFIGURATION.md](/telegraf/v1/configuration/#plugins) for more details.

## Configuration

```toml
# Gather indicators from established connections, using iproute2's ss command.
# This plugin ONLY supports non-Windows
[[inputs.socketstat]]
  ## ss can display information about tcp, udp, raw, unix, packet, dccp and sctp sockets
  ## Specify here the types you want to gather
  protocols = [ "tcp", "udp" ]

  ## The default timeout of 1s for ss execution can be overridden here:
  # timeout = "1s"
```

## Metrics

The measurements `socketstat` contains the following fields

* state (string) (for tcp, dccp and sctp protocols)

If ss provides it (it depends on the protocol and ss version) it has the
following additional fields

* bytes\_acked (integer, bytes)
* bytes\_received (integer, bytes)
* segs\_out (integer, count)
* segs\_in (integer, count)
* data\_segs\_out (integer, count)
* data\_segs\_in (integer, count)

All measurements have the following tags:

* proto
* local\_addr
* local\_port
* remote\_addr
* remote\_port

## Example Output

### recent `ss` version (iproute2 4.3.0 here)

```sh
./telegraf --config telegraf.conf --input-filter socketstat --test
```

```text
socketstat,host=ubuntu-xenial,local_addr=10.6.231.226,local_port=42716,proto=tcp,remote_addr=192.168.2.21,remote_port=80 bytes_acked=184i,bytes_received=2624519595i,recv_q=4344i,segs_in=1812580i,segs_out=661642i,send_q=0i,state="ESTAB" 1606457205000000000
```

### older `ss` version (iproute2 3.12.0 here)

```sh
./telegraf --config telegraf.conf --input-filter socketstat --test
```

```text
socketstat,host=ubuntu-trusty,local_addr=10.6.231.163,local_port=35890,proto=tcp,remote_addr=192.168.2.21,remote_port=80 recv_q=0i,send_q=0i,state="ESTAB" 1606456977000000000
```
