summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-07-01 13:07:27 +0200
committerGitHub <noreply@github.com>2024-07-01 13:07:27 +0200
commitf61bd9137189661b6c497f727447b435619abc60 (patch)
treef801f11b030d9a8a3da0c7a86b536e9033e33c6a /src
parentee7053d201c8b05611280020abdc6c57b571c154 (diff)
parent753eef575f06e00cce47352ded7e8ee0b91d10af (diff)
downloadvyos-1x-f61bd9137189661b6c497f727447b435619abc60.tar.gz
vyos-1x-f61bd9137189661b6c497f727447b435619abc60.zip
Merge pull request #3738 from vyos/mergify/bp/sagitta/pr-3720
T6477: Add telegraf loki output plugin (backport #3720)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/service_monitoring_telegraf.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/conf_mode/service_monitoring_telegraf.py b/src/conf_mode/service_monitoring_telegraf.py
index 40eb13e23..9455b6109 100755
--- a/src/conf_mode/service_monitoring_telegraf.py
+++ b/src/conf_mode/service_monitoring_telegraf.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2021-2023 VyOS maintainers and contributors
+# Copyright (C) 2021-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -113,6 +113,9 @@ def get_config(config=None):
if not conf.exists(base + ['azure-data-explorer']):
del monitoring['azure_data_explorer']
+ if not conf.exists(base + ['loki']):
+ del monitoring['loki']
+
return monitoring
def verify(monitoring):
@@ -159,6 +162,19 @@ def verify(monitoring):
if 'url' not in monitoring['splunk']:
raise ConfigError(f'Monitoring splunk "url" is mandatory!')
+ # Verify Loki
+ if 'loki' in monitoring:
+ if 'url' not in monitoring['loki']:
+ raise ConfigError(f'Monitoring loki "url" is mandatory!')
+ if 'authentication' in monitoring['loki']:
+ if (
+ 'username' not in monitoring['loki']['authentication']
+ or 'password' not in monitoring['loki']['authentication']
+ ):
+ raise ConfigError(
+ f'Authentication "username" and "password" are mandatory!'
+ )
+
return None
def generate(monitoring):