cancel
Showing results for 
Search instead for 
Did you mean: 

InfluxDB app (version >= 2.04): use of influx CLI?

InfluxDB app (version >= 2.04): use of influx CLI?

LunatiX
New Contributor

Is it possible to use the influx CLI (command line interface)? Or how could we interact and export data from influxDB t.e. into a csv file?

In old influxDB versions there was a button "CSV" which unfortunately isn't available anymore:

LunatiX_0-1703169097302.png

 

3 REPLIES 3

Sgilk
Contributor

Hi @LunatiX ,

This seems to be a known issue with this version of InfluxDB... I tried with HTTPS and Firefox and have not been able to get the CSV export button to display.

You can use the REST API or CLI to retrieve data in csv format. I would suggest the REST API as it can be used from many standard clients. See the documentation for a walkthrough.

Here is an example I just tried on a Virtual CORE using Postman.

I sent a POST request to the API query URL with my organization ID as a query paramater.

 

https://127.0.0.1:8443/influxdb/api/v2/query?orgID=98d3f3e96e7bd66

 

I used Bearer Token authorization, with an all access API token, generated within my InfluxDB.

I set the Content-type header to application/vnd.flux

In the request body, I used the following query, generated using the graphical query builder of InfluxDB.

 

query=from(bucket: "Test")
  |> range(start: -12h)
  |> filter(fn: (r) => r["_measurement"] == "metrics")
  |> filter(fn: (r) => r["_field"] == "cpu_usage_percent")
  |> aggregateWindow(every: 1h, fn: mean)
  |> yield(name: "mean")

 

I recieved a response of csv data.

 

,result,table,_start,_stop,_time,_value,_field,_measurement,host,node,source
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T05:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T06:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T07:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T08:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T09:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T10:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T11:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T12:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T13:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T14:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T15:00:00Z,,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T16:00:00Z,4.22110807647288,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost
,mean,0,2023-12-21T04:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,2023-12-21T16:34:28.8461513Z,4.117602427921053,cpu_usage_percent,metrics,VirtualControl-2-2-4,framework/metrics/system/cpu-utilisation-percent,localhost

 

Seen also,

Lready discussed with the devs but it doens't depend by us!

ctrlXnovo
Long-established Member

If Influx will not add this feature back, I'd consider adding it to our InfluxDB app.  It was super useful.  I am currently setting up a system to record data for a customer and now I need to step back and develop a new way to do this since the button is gone in the later versions.  We developed instructions for the customer to get the data without us, since it was simple.  Now it is not.  Going back to an old version is probably my best choice with the time I have left.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist