summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-03-16 21:13:01 +0100
committerGitHub <noreply@github.com>2023-03-16 21:13:01 +0100
commit5619dd6fd7b38314488db998cdf912950e3fdc3d (patch)
treeab5165dd154b7b105619964050377b4cdbe62dca /data
parent7f0eb0b029c927e4b7b0003c934f682be9b36380 (diff)
parent707641f4dc947bce84eeff5499665e1cf76d7806 (diff)
downloadvyos-1x-5619dd6fd7b38314488db998cdf912950e3fdc3d.tar.gz
vyos-1x-5619dd6fd7b38314488db998cdf912950e3fdc3d.zip
Merge pull request #1891 from sever-sever/T5086
T5086: Add sFlow feature based on hsflowd
Diffstat (limited to 'data')
-rw-r--r--data/configd-include.json1
-rw-r--r--data/templates/sflow/hsflowd.conf.j228
-rw-r--r--data/templates/sflow/override.conf.j216
3 files changed, 45 insertions, 0 deletions
diff --git a/data/configd-include.json b/data/configd-include.json
index 648655a8b..456211caa 100644
--- a/data/configd-include.json
+++ b/data/configd-include.json
@@ -74,6 +74,7 @@
"system-logs.py",
"system-option.py",
"system-proxy.py",
+"system_sflow.py",
"system_sysctl.py",
"system-syslog.py",
"system-timezone.py",
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