diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-03-14 18:45:04 +0000 |
---|---|---|
committer | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-03-16 10:17:39 +0000 |
commit | 707641f4dc947bce84eeff5499665e1cf76d7806 (patch) | |
tree | 98ba75bd3df15a4757a355fa60e69f4e2e0a71f2 /data/templates | |
parent | c5ee06af8cb0b4485d08a2cf1d1e338c74b3fd85 (diff) | |
download | vyos-1x-707641f4dc947bce84eeff5499665e1cf76d7806.tar.gz vyos-1x-707641f4dc947bce84eeff5499665e1cf76d7806.zip |
T5086: Add sFlow feature based on hsflowd
Add sFlow feature based on hsflowd
According to user reviews, it works more stable and more productive
than pmacct
I haven't deleted 'pmacct' 'system flow-accounting sflow' yet
It could be migrated or deprecated later
set system sflow agent-address '192.0.2.14'
set system sflow interface 'eth0'
set system sflow interface 'eth1'
set system sflow polling '30'
set system sflow sampling-rate '100'
set system sflow server 192.0.2.1 port '6343'
set system sflow server 192.0.2.11 port '6343'
Diffstat (limited to 'data/templates')
-rw-r--r-- | data/templates/sflow/hsflowd.conf.j2 | 28 | ||||
-rw-r--r-- | data/templates/sflow/override.conf.j2 | 16 |
2 files changed, 44 insertions, 0 deletions
diff --git a/data/templates/sflow/hsflowd.conf.j2 b/data/templates/sflow/hsflowd.conf.j2 new file mode 100644 index 000000000..7ce6554d7 --- /dev/null +++ b/data/templates/sflow/hsflowd.conf.j2 @@ -0,0 +1,28 @@ +# Genereated by /usr/libexec/vyos/conf_mode/system_sflow.py +# Parameters http://sflow.net/host-sflow-linux-config.php + +sflow { +{% if polling is vyos_defined %} + polling={{ polling }} +{% endif %} +{% if sampling_rate is vyos_defined %} + sampling={{ sampling_rate }} + sampling.bps_ratio=0 +{% endif %} +{% if agent_address is vyos_defined %} + agentIP={{ agent_address }} +{% endif %} +{% if agent_interface is vyos_defined %} + agent={{ agent_interface }} +{% endif %} +{% if server is vyos_defined %} +{% for server, server_config in server.items() %} + collector { ip = {{ server }} udpport = {{ server_config.port }} } +{% endfor %} +{% endif %} +{% if interface is vyos_defined %} +{% for iface in interface %} + pcap { dev={{ iface }} } +{% endfor %} +{% endif %} +} diff --git a/data/templates/sflow/override.conf.j2 b/data/templates/sflow/override.conf.j2 new file mode 100644 index 000000000..f2a982528 --- /dev/null +++ b/data/templates/sflow/override.conf.j2 @@ -0,0 +1,16 @@ +[Unit] +After= +After=vyos-router.service +ConditionPathExists= +ConditionPathExists=/run/sflow/hsflowd.conf + +[Service] +EnvironmentFile= +ExecStart= +ExecStart=/usr/sbin/hsflowd -m %m -d -f /run/sflow/hsflowd.conf +WorkingDirectory= +WorkingDirectory=/run/sflow +PIDFile= +PIDFile=/run/sflow/hsflowd.pid +Restart=always +RestartSec=10 |