diff options
| author | MichaelSonger <michael.songer@infinitivegroup.co.uk> | 2026-09-24 17:00:38 +0100 |
|---|---|---|
| committer | MichaelSonger <michael.songer@infinitivegroup.co.uk> | 2026-09-24 17:00:38 +0100 |
| commit | 75781f0d9dbf0174dfbb55d5f0e8228a38b6f608 (patch) | |
| tree | e00453e8d48c78d337b6076c77500352a001ba6c /src | |
| parent | ed218c254d964775ddf24158ac6520972d575faf (diff) | |
| download | vyos-1x-75781f0d9dbf0174dfbb55d5f0e8228a38b6f608.tar.gz vyos-1x-75781f0d9dbf0174dfbb55d5f0e8228a38b6f608.zip | |
T9274: Add more telegraf configuration- #5453
Added the ability to make several agent values configurable instead of hardcoded.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/service_monitoring_telegraf.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/conf_mode/service_monitoring_telegraf.py b/src/conf_mode/service_monitoring_telegraf.py index 8503fc003..8b2f3b14f 100755 --- a/src/conf_mode/service_monitoring_telegraf.py +++ b/src/conf_mode/service_monitoring_telegraf.py @@ -26,6 +26,7 @@ from vyos.configdict import is_node_changed from vyos.configverify import verify_vrf from vyos.ifconfig import Section from vyos.template import render +from vyos.utils.convert import human_to_seconds from vyos.utils.process import call from vyos.utils.permission import chown from vyos.utils.process import cmdl @@ -177,6 +178,26 @@ def verify(monitoring): if 'value' not in tag_config: raise ConfigError(f'Global tag "{tag}" has no value assigned!') + # Verify agent + # Telegraf can handle up to 9223372036854775807ns + # Which is roughly 9223372036s + max_agent_duration_s = 9223372036 + + if 'agent' in monitoring: + for option in ( + 'interval', + 'collection_jitter', + 'flush_interval', + 'flush_jitter', + ): + if option not in monitoring['agent']: + continue + + duration_s = human_to_seconds(monitoring['agent'][option]) + + if duration_s > max_agent_duration_s: + raise ConfigError(f'{option.replace("_", "-")} value is too large') + # Verify influxdb if 'influxdb' in monitoring: if 'authentication' not in monitoring['influxdb'] or \ |
