| 1 | <!--startmeta |
| 2 | custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/crates/netflow-plugin/integrations/sflow.md" |
| 3 | meta_yaml: "https://github.com/netdata/netdata/edit/master/src/crates/netflow-plugin/metadata.yaml" |
| 4 | sidebar_label: "sFlow" |
| 5 | learn_status: "Published" |
| 6 | learn_rel_path: "Network Flows/Flow Protocols" |
| 7 | keywords: ['sflow', 'sflow v5', 'sampled flows', 'flows', 'network flows', 'flow collector', 'inmon'] |
| 8 | message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE FLOWS' metadata.yaml FILE" |
| 9 | endmeta--> |
| 10 | |
| 11 | <!-- markdownlint-disable-file --> |
| 12 | |
| 13 | # sFlow |
| 14 | |
| 15 | |
| 16 | <img src="https://netdata.cloud/img/network-wired.svg" width="150"/> |
| 17 | |
| 18 | |
| 19 | Plugin: netflow-plugin |
| 20 | Module: sflow |
| 21 | |
| 22 | <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> |
| 23 | |
| 24 | ## Overview |
| 25 | |
| 26 | Collect sampled network flow records from sFlow v5 agents. sFlow provides |
| 27 | statistically sampled packet headers, interface counters, or extended gateway data. |
| 28 | Each flow record exposes source and destination IP, ports, protocol, bytes, packets, |
| 29 | and sampling rate information. |
| 30 | |
| 31 | For full documentation including how sFlow differs fundamentally from NetFlow (packet |
| 32 | sampling vs aggregated flows), vendor configuration examples (Arista, Juniper, Aruba CX, |
| 33 | Ruckus, hsflowd), and the limits of sampled data, see the |
| 34 | [Network Flows Overview](https://learn.netdata.cloud/docs/network-flows/). |
| 35 | |
| 36 | |
| 37 | The plugin listens on the same UDP socket as NetFlow. sFlow datagrams are identified by |
| 38 | their distinct header format and decoded per the sFlow v5 specification. Decoded records |
| 39 | are enriched and appended to disk-backed journal tiers. |
| 40 | |
| 41 | |
| 42 | This integration is only supported on the following platforms: |
| 43 | |
| 44 | - Linux |
| 45 | |
| 46 | This integration runs as a single instance per Netdata Agent. |
| 47 | |
| 48 | |
| 49 | ### Default Behavior |
| 50 | |
| 51 | #### Auto-Detection |
| 52 | |
| 53 | The plugin starts when enabled in netflow.yaml and listens on the configured UDP port. |
| 54 | |
| 55 | #### Limits |
| 56 | |
| 57 | Operational limits are driven by sustained samples/s, sampling rate, cardinality, retention, storage speed, and enrichment. Plan capacity from the received sample rate and the expanded byte/packet estimates. |
| 58 | |
| 59 | #### Performance Impact |
| 60 | |
| 61 | Disabled until sFlow agents send traffic. Once active, CPU and disk I/O scale with received samples/s and cardinality; size retention and storage from observed flow records/s. |
| 62 | |
| 63 | ## Setup |
| 64 | |
| 65 | |
| 66 | ### Prerequisites |
| 67 | |
| 68 | #### sFlow-capable agent |
| 69 | |
| 70 | A switch, router, or host-based sFlow agent (such as Host sFlow) configured to send |
| 71 | sFlow v5 datagrams to the Netdata agent's UDP listener. |
| 72 | |
| 73 | |
| 74 | |
| 75 | ### Configuration |
| 76 | |
| 77 | #### Options |
| 78 | |
| 79 | sFlow shares the same `netflow.yaml` configuration file as NetFlow and IPFIX. |
| 80 | Enable sFlow via the `protocols.sflow` option. |
| 81 | |
| 82 | |
| 83 | <details open><summary>Config options</summary> |
| 84 | |
| 85 | |
| 86 | |
| 87 | | Option | Description | Default | Required | |
| 88 | |:-----|:------------|:--------|:---------:| |
| 89 | | listener.listen | UDP endpoint for sFlow datagrams. | 0.0.0.0:2055 | no | |
| 90 | | protocols.sflow | Enable sFlow decoding. | yes | no | |
| 91 | | journal.journal_dir | Directory for journal files (relative to NETDATA_CACHE_DIR). | flows | no | |
| 92 | | journal.tiers.<tier>.size_of_journal_files | Per-tier hard size cap. Replace `<tier>` with `raw`, `minute_1`, `minute_5`, or `hour_1`. Set to `null` for time-only retention. | 10GB | no | |
| 93 | | journal.tiers.<tier>.duration_of_journal_files | Per-tier maximum age. Replace `<tier>` with `raw`, `minute_1`, `minute_5`, or `hour_1`. Set to `null` for size-only retention. | 7d | no | |
| 94 | |
| 95 | |
| 96 | </details> |
| 97 | |
| 98 | |
| 99 | |
| 100 | #### via File |
| 101 | |
| 102 | The configuration file name for this integration is `netflow.yaml`. |
| 103 | |
| 104 | |
| 105 | You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-configuration-files) script from the |
| 106 | Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#locate-your-config-directory). |
| 107 | |
| 108 | ```bash |
| 109 | cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata |
| 110 | sudo ./edit-config netflow.yaml |
| 111 | ``` |
| 112 | |
| 113 | ##### Examples |
| 114 | |
| 115 | ###### sFlow collection |
| 116 | |
| 117 | Listen for sFlow v5 datagrams on Netdata's default flow listener port. |
| 118 | |
| 119 | ```yaml |
| 120 | enabled: true |
| 121 | listener: |
| 122 | listen: "0.0.0.0:2055" |
| 123 | protocols: |
| 124 | v5: false |
| 125 | v7: false |
| 126 | v9: false |
| 127 | ipfix: false |
| 128 | sflow: true |
| 129 | |
| 130 | ``` |
| 131 | |
| 132 | |
| 133 | ### Verifying sFlow is arriving and diagnosing failures |
| 134 | |
| 135 | See [Troubleshooting](https://learn.netdata.cloud/docs/network-flows/troubleshooting) for |
| 136 | the full diagnostic recipe. sFlow-specific gotchas: counter samples are not surfaced |
| 137 | (only flow samples), bytes/packets are statistical estimates that won't match SNMP |
| 138 | byte-for-byte, and VLAN information comes from `ExtendedSwitch` records only -- not |
| 139 | from 802.1Q tags inside the sampled header. See also |
| 140 | [Validation and Data Quality](https://learn.netdata.cloud/docs/network-flows/validation-and-data-quality) |
| 141 | and the sFlow section of [Anti-patterns](https://learn.netdata.cloud/docs/network-flows/anti-patterns). |
| 142 | |
| 143 | |
| 144 |