diff options
author | Rasmus Luha <rasmus.luha@ut.ee> | 2025-04-29 00:25:22 +0300 |
---|---|---|
committer | Rasmus Luha <rasmus.luha@ut.ee> | 2025-04-29 00:25:22 +0300 |
commit | b2e8ec86abe8089ed5fbd1655677889b6691397f (patch) | |
tree | 0982990ad217e4537e1005dbd20c63d758facc17 /modules/telegraf/telegraf_utils.py | |
parent | 6b3c096f6efea8855772c7faffa90f71861290bd (diff) |
add cml variables, and platform option to config
Diffstat (limited to 'modules/telegraf/telegraf_utils.py')
-rw-r--r-- | modules/telegraf/telegraf_utils.py | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/modules/telegraf/telegraf_utils.py b/modules/telegraf/telegraf_utils.py index d6ed376..ffaddfd 100644 --- a/modules/telegraf/telegraf_utils.py +++ b/modules/telegraf/telegraf_utils.py @@ -6,6 +6,43 @@ def modify_input(new_pipeline_path, key, value): if key in pluggin: + #print(f"Before: {key} = {pluggin[key]}") + pluggin[key] = value + #print(f"After: {key} = {pluggin[key]}") + + + with open(new_pipeline_path, "w") as f: + toml.dump(data, f) + + +##modify_input("templates/basic_ETL.toml", "test_pipers.toml, "urls", ["stillTesting"]) + + +## TODO +def modify_agent(new_pipeline_path, key, value): + data = toml.load(new_pipeline_path) + pluggin = data["agent"] + + if key in pluggin: + + #print(f"Before: {key} = {pluggin[key]}") + pluggin[key] = value + #print(f"After: {key} = {pluggin[key]}") + + + with open(new_pipeline_path, "w") as f: + toml.dump(data, f) + + + + +## TODO +def modify_output(new_pipeline_path, key, value): + data = toml.load(new_pipeline_path) + pluggin = data["outputs"]["influxdb"][0] + + if key in pluggin: + print(f"Before: {key} = {pluggin[key]}") pluggin[key] = value print(f"After: {key} = {pluggin[key]}") @@ -13,5 +50,3 @@ def modify_input(new_pipeline_path, key, value): with open(new_pipeline_path, "w") as f: toml.dump(data, f) - -#modify_input("templates/basic_ETL.toml", "test_pipers.toml, "urls", ["stillTesting"]) |