diff options
author | Rasmus Luha <rasmus.luha@ut.ee> | 2025-04-26 01:10:52 +0300 |
---|---|---|
committer | Rasmus Luha <rasmus.luha@ut.ee> | 2025-04-26 01:10:52 +0300 |
commit | 6b3c096f6efea8855772c7faffa90f71861290bd (patch) | |
tree | b8b820dc282578851892c8e9fab0b937dcb6cb78 /modules/telegraf/core.py | |
parent | 0a16e0e3e586456cf2e86dbdad4b66787b036a5d (diff) |
telegraf initial pluggin modifiying implemented
Diffstat (limited to 'modules/telegraf/core.py')
-rw-r--r-- | modules/telegraf/core.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/modules/telegraf/core.py b/modules/telegraf/core.py index 1d49917..3febf7b 100644 --- a/modules/telegraf/core.py +++ b/modules/telegraf/core.py @@ -2,9 +2,80 @@ from pyfiglet import figlet_format from rich.console import Console +from modules.telegraf import telegraf_utils +#from modules.nifi import nifi_utils +from common import core as common +import config + + +import toml +import shutil + + + def introduction(): console = Console() ascii_art = figlet_format("Telegraf") console.print(ascii_art, style="cyan") print("Valisid Telegraf Platformi!\n") + + + +########################### + + +def modify_template(new_pipeline_path, api_url): + #telegraf_utils.modify_output("templates/basic_ETL.toml", "urls", "testingIfWorks") + + ## Api Url editing + telegraf_utils.modify_input(new_pipeline_path,"urls", [api_url]) + + + + + + +########################### + + + +def build_pipeline(): + if config.INTERACTIVE_MODE: + data_values, api_url, api_username, api_password= common.get_data_values() + + print("\nKui tihti peaks andmekonveier jooksma? (sekundites)") + schedulingPeriod = str(common.ask_digit_input(86400))+ "sec" + + new_pipeline_name=input("Mis saab andmekonveieri nimeks: ")+".toml" + + ## TODO + else: + api_url = config.API_URL + data_values = config.API_FIELDS + schedulingPeriod = config.PIPELINE_SCHEDULING_PERIOD + new_pipeline_name = config.PIPELINE_NAME+".toml" + api_username = config.API_USERNAME + api_password = config.API_PASSWORD + + + + + ### Select template + ##TODO + template_name="basic_ETL.toml" + + new_pipeline_path = f"pipelines/{new_pipeline_name}" + shutil.copy(f"modules/telegraf/templates/{template_name}", new_pipeline_path) + + + modify_template(new_pipeline_path, api_url) + #telegraf.modify_output("templates/basic_ETL.toml", "urls", "testingIfWorks") + + + + + + + print("end currently") + #print(f"✅✅✅ Valmis. Uus genereeritud andmekoveier nimega '{new_pipeline_name}' asub kaustas 'pipelines'.") |