summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyleM <103862795+ServerForge@users.noreply.github.com>2022-09-22 01:57:29 -0400
committerGitHub <noreply@github.com>2022-09-22 07:57:29 +0200
commitf3e6fb5aab6f562dab49f559f31c58c0f86c03df (patch)
tree8537a2f25f53543b7b48f0604d5e38fda3019927
parent2921b6fbcdde6f6bcb2581afff9de44444a167a4 (diff)
downloadvyos-1x-f3e6fb5aab6f562dab49f559f31c58c0f86c03df.tar.gz
vyos-1x-f3e6fb5aab6f562dab49f559f31c58c0f86c03df.zip
telegraf: T4680: fix prometheus client listen-address invalid format
-rw-r--r--data/templates/telegraf/telegraf.j22
-rw-r--r--interface-definitions/include/listen-address-single.xml.i22
-rw-r--r--interface-definitions/service-monitoring-telegraf.xml.in2
3 files changed, 24 insertions, 2 deletions
diff --git a/data/templates/telegraf/telegraf.j2 b/data/templates/telegraf/telegraf.j2
index 6b395692b..2d14230ae 100644
--- a/data/templates/telegraf/telegraf.j2
+++ b/data/templates/telegraf/telegraf.j2
@@ -45,7 +45,7 @@
### Prometheus ###
[[outputs.prometheus_client]]
## Address to listen on
- listen = "{{ prometheus_client.listen_address if prometheus_client.listen_address is vyos_defined else '' }}:{{ prometheus_client.port }}"
+ listen = "{{ prometheus_client.listen_address | bracketize_ipv6 if prometheus_client.listen_address is vyos_defined else '' }}:{{ prometheus_client.port }}"
metric_version = {{ prometheus_client.metric_version }}
{% if prometheus_client.authentication.username is vyos_defined and prometheus_client.authentication.password is vyos_defined %}
## Use HTTP Basic Authentication
diff --git a/interface-definitions/include/listen-address-single.xml.i b/interface-definitions/include/listen-address-single.xml.i
new file mode 100644
index 000000000..b5841cabb
--- /dev/null
+++ b/interface-definitions/include/listen-address-single.xml.i
@@ -0,0 +1,22 @@
+<leafNode name="listen-address">
+ <properties>
+ <help>Local IP addresses to listen on</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_local_ips.sh --both</script>
+ </completionHelp>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>IPv4 address to listen for incoming connections</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ipv6</format>
+ <description>IPv6 address to listen for incoming connections</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ <validator name="ipv6-address"/>
+ <validator name="ipv6-link-local"/>
+ </constraint>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/service-monitoring-telegraf.xml.in b/interface-definitions/service-monitoring-telegraf.xml.in
index 68215dba4..47f943d83 100644
--- a/interface-definitions/service-monitoring-telegraf.xml.in
+++ b/interface-definitions/service-monitoring-telegraf.xml.in
@@ -228,7 +228,7 @@
</constraint>
</properties>
</leafNode>
- #include <include/listen-address.xml.i>
+ #include <include/listen-address-single.xml.i>
<leafNode name="metric-version">
<properties>
<help>Metric version control mapping from Telegraf to Prometheus format</help>