InfluxDB 2.x: CSV: Unterschied zwischen den Versionen
Aus Wiki-WebPerfect
Admin (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „== Work with a CSV in InfluxDB 2.x Explorer (from am exported query) == ''You can export queried data directly from InfluxDB 2.x Explorer with the button near…“) |
Admin (Diskussion | Beiträge) |
||
Zeile 3: | Zeile 3: | ||
'''In this example, I show you how to easy work with exported CSV data without import it to your buckets''' <br> | '''In this example, I show you how to easy work with exported CSV data without import it to your buckets''' <br> | ||
− | Exported data from InfluxDB 2.x Explorer: | + | '''Exported data from InfluxDB 2.x Explorer:''' |
<pre> | <pre> | ||
#group,false,false,false,false,false,false,false,false,false,false | #group,false,false,false,false,false,false,false,false,false,false | ||
Zeile 18: | Zeile 18: | ||
+ | '''Use the exported data:''' | ||
+ | <pre> | ||
+ | import "csv" //import the csv library | ||
+ | csvData = " | ||
+ | #group,false,false,false,false,false,false,false,false,false,false | ||
+ | #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,string,double,double | ||
+ | #default,_result,,,,,,,,, | ||
+ | ,result,table,_time,_start,_stop,_level,_measurement,host,threshold,value | ||
+ | ,,0,2021-02-03T20:26:34Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host1,10,14 | ||
+ | ,,0,2021-02-03T20:26:49Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host2,10,12 | ||
+ | ,,0,2021-02-03T20:26:55Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host1,10,16 | ||
+ | ,,0,2021-02-03T20:26:44Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,ok,host_cpu,host1,10,2 | ||
+ | ,,0,2021-02-03T20:27:02Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,ok,host_cpu,host3,10,4 | ||
+ | ,,0,2021-02-03T20:28:55Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host1,10,16 | ||
+ | " | ||
+ | csv.from(csv: csvData) | ||
+ | //here you can use every Flux filters, functions & calculation you want | ||
+ | </pre> | ||
Version vom 5. Februar 2021, 10:52 Uhr
Work with a CSV in InfluxDB 2.x Explorer (from am exported query)
You can export queried data directly from InfluxDB 2.x Explorer with the button near the "Submit" button.
In this example, I show you how to easy work with exported CSV data without import it to your buckets
Exported data from InfluxDB 2.x Explorer:
#group,false,false,false,false,false,false,false,false,false,false #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,string,double,double #default,_result,,,,,,,,, ,result,table,_time,_start,_stop,_level,_measurement,host,threshold,value ,,0,2021-02-03T20:26:34Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host1,10,14 ,,0,2021-02-03T20:26:49Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host2,10,12 ,,0,2021-02-03T20:26:55Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host1,10,16 ,,0,2021-02-03T20:26:44Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,ok,host_cpu,host1,10,2 ,,0,2021-02-03T20:27:02Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,ok,host_cpu,host3,10,4 ,,0,2021-02-03T20:28:55Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host1,10,16
Use the exported data:
import "csv" //import the csv library csvData = " #group,false,false,false,false,false,false,false,false,false,false #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,string,double,double #default,_result,,,,,,,,, ,result,table,_time,_start,_stop,_level,_measurement,host,threshold,value ,,0,2021-02-03T20:26:34Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host1,10,14 ,,0,2021-02-03T20:26:49Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host2,10,12 ,,0,2021-02-03T20:26:55Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host1,10,16 ,,0,2021-02-03T20:26:44Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,ok,host_cpu,host1,10,2 ,,0,2021-02-03T20:27:02Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,ok,host_cpu,host3,10,4 ,,0,2021-02-03T20:28:55Z,2021-02-03T19:48:56.599321105Z,2021-02-04T19:48:56.599321105Z,crit,host_cpu,host1,10,16 " csv.from(csv: csvData) //here you can use every Flux filters, functions & calculation you want