mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 11:18:03 +00:00
Create new Influx dashboards from a CSV
Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
This commit is contained in:
@@ -252,17 +252,11 @@ def main():
|
||||
|
||||
scriptname = csvtoinflux.script_name()
|
||||
|
||||
if args.panel_name is None:
|
||||
panel_name = scriptname
|
||||
else:
|
||||
panel_name = args.panel_name
|
||||
|
||||
DataToGrafana = data_to_grafana(_bucket=args.influx_bucket,
|
||||
_script=scriptname,
|
||||
_panel_name=panel_name)
|
||||
|
||||
csvtoinflux.post_to_influx()
|
||||
|
||||
grafana_input = DataToGrafana.json_parser
|
||||
GrafanaDB.create_custom_dashboard(scripts=[scriptname],
|
||||
title=args.panel_name,
|
||||
bucket=args.influx_bucket)
|
||||
|
||||
GrafanaDB.GR.create_dashboard_from_dict(dictionary=grafana_input)
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -96,6 +96,7 @@ class CSVtoInflux(Realm):
|
||||
line = line.split('\t')
|
||||
test_id_index = line.index('test-id')
|
||||
line = fp.readline()
|
||||
line.split('\t')
|
||||
return line[test_id_index]
|
||||
|
||||
|
||||
@@ -113,7 +114,7 @@ def main():
|
||||
debug = False
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='test_l3_longevity.py',
|
||||
prog='csv_to_influx.py',
|
||||
# formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
epilog='''
|
||||
|
||||
@@ -145,6 +145,13 @@ class UseGrafana(LFCliBase):
|
||||
fieldConfig['defaults'] = dict()
|
||||
fieldConfig['overrides'] = list()
|
||||
|
||||
transformation = dict()
|
||||
transformation['id'] = "renameByRegex"
|
||||
transformation_options = dict()
|
||||
transformation_options['regex'] = "(.*) value.*"
|
||||
transformation_options['renamePattern'] = "$1"
|
||||
transformation['options'] = transformation_options
|
||||
|
||||
xaxis = dict()
|
||||
xaxis['buckets'] = None
|
||||
xaxis['mode'] = "time"
|
||||
@@ -195,6 +202,8 @@ class UseGrafana(LFCliBase):
|
||||
panel['timeRegions'] = list()
|
||||
panel['timeShift'] = None
|
||||
panel['title'] = scriptname+' '+graph_group
|
||||
panel['transformations'] = list()
|
||||
panel['transformations'].append(transformation)
|
||||
panel['type'] = "graph"
|
||||
panel['xaxis'] = xaxis
|
||||
panel['yaxes'] = list()
|
||||
|
||||
0
py-scripts/wifi_cap_to_influx.sh
Normal file
0
py-scripts/wifi_cap_to_influx.sh
Normal file
Reference in New Issue
Block a user