diff --git a/py-scripts/csv_to_grafana.py b/py-scripts/csv_to_grafana.py index c04134cf..5399d4a9 100755 --- a/py-scripts/csv_to_grafana.py +++ b/py-scripts/csv_to_grafana.py @@ -14,7 +14,7 @@ if 'py-json' not in sys.path: from LANforge.lfcli_base import LFCliBase import json -from influx2 import RecordInflux +from InfluxRequest import RecordInflux from csv_to_influx import CSVtoInflux, influx_add_parser_args from grafana_profile import UseGrafana import random diff --git a/py-scripts/csv_to_influx.py b/py-scripts/csv_to_influx.py new file mode 100755 index 00000000..35c9666f --- /dev/null +++ b/py-scripts/csv_to_influx.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 + + +import sys +import os + +if 'py-dashboard' not in sys.path: + sys.path.append(os.path.join(os.path.abspath('..'), 'py-dashboard')) + +from InfluxRequest import * +from cv_test_manager import * +from pathlib import Path +import argparse + + +class CSVtoInflux: + def __init__(self, + influx_host, + influx_port, + influx_org, + influx_token, + influx_bucket, + path): + self.path = path + self.influxdb = RecordInflux(_influx_host=influx_host, + _influx_port=influx_port, + _influx_org=influx_org, + _influx_token=influx_token, + _influx_bucket=influx_bucket) + + def glob(self): + path = Path(self.path) + self.kpi_list = list(path.glob('**/kpi.csv')) + for kpi in self.kpi_list: + self.influxdb.RecordInflux.csv_to_influx(kpi) + + +def main(): + parser = argparse.ArgumentParser() + cv_add_base_parser(parser) + + parser.add_argument('--path', append=True) + + args = parser.parse_args() + + cv_base_adjust_parser(args) + + csvtoinflux = CSVtoInflux(args.influx_host, + args.influx_port, + args.influx_org, + args.influx_token, + args.influx_bucket, + args.path) + + csvtoinflux.glob() + + +if __name__ == "__main__": + main() diff --git a/py-scripts/recordinflux.py b/py-scripts/recordinflux.py index 2e4921e4..cfee0a09 100755 --- a/py-scripts/recordinflux.py +++ b/py-scripts/recordinflux.py @@ -20,6 +20,9 @@ if sys.version_info[0] != 3: if 'py-json' not in sys.path: sys.path.append(os.path.join(os.path.abspath('..'), 'py-json')) +if 'py-dashboard' not in sys.path: + sys.path.append(os.path.join(os.path.abspath('..'), 'py-dashboard')) + from LANforge.lfcli_base import LFCliBase import argparse @@ -58,7 +61,7 @@ def main(): tags = dict() tags['script'] = 'recordinflux' if args.influx_user is None: - from influx2 import RecordInflux + from InfluxRequest import RecordInflux grapher = RecordInflux(_influx_host=args.mgr, _influx_port=args.influx_port, _influx_bucket=args.influx_db, diff --git a/py-scripts/test_ip_variable_time.py b/py-scripts/test_ip_variable_time.py index 6507dfb5..3eef1e0f 100755 --- a/py-scripts/test_ip_variable_time.py +++ b/py-scripts/test_ip_variable_time.py @@ -35,10 +35,12 @@ if sys.version_info[0] != 3: if 'py-json' not in sys.path: sys.path.append(os.path.join(os.path.abspath('..'), 'py-json')) +if 'py-dashboard' not in sys.path: + sys.path.append(os.path.join(os.path.abspath('..'), 'py-dashboard')) + import argparse from LANforge import LFUtils from realm import Realm -import time import datetime @@ -471,7 +473,7 @@ python3 ./test_ip_variable_time.py # manager = args.influx_mgr if args.influx_org is not None: - from influx2 import RecordInflux + from InfluxRequest import RecordInflux grapher = RecordInflux(_influx_host=args.influx_host, _influx_port=args.influx_port, _influx_org=args.influx_org, diff --git a/py-scripts/test_l3_longevity.py b/py-scripts/test_l3_longevity.py index 0b65d716..7cb0f6be 100755 --- a/py-scripts/test_l3_longevity.py +++ b/py-scripts/test_l3_longevity.py @@ -1366,7 +1366,7 @@ python3 .\\test_l3_longevity.py --test_duration 4m --endp_type \"lf_tcp lf_udp m influxdb = None if args.influx_bucket is not None: - from influx2 import RecordInflux + from InfluxRequest import RecordInflux influxdb = RecordInflux(_influx_host=args.influx_host, _influx_port=args.influx_port, _influx_org=args.influx_org,