Code Monkey home page Code Monkey logo

Comments (5)

 avatar commented on July 25, 2024 1

I recreated a new token and still have an incomplete bucket list.
This is necessarily a problem to the API https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/
which does not make the link between the token and the authorized buckets

I made a ticket to influxData support to give me an answer

Thanks a lot for your help

from influxdb-gds-connector.

bednar avatar bednar commented on July 25, 2024

@dmeireles, thanks for using our connector.

It looks like that your token doesn't have permission to read from selected bucket. Could you please check the following queries:

  1. Query to Buckets:
curl "https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/query?org=YOUR_ORG" \
  -H "Accept: application/csv" \
  -H "Authorization: Token YOUR_TOKEN" \
  -H "Content-type: application/vnd.flux" \
  -d 'buckets() |> rename(columns: {"name": "_value"}) |> keep(columns: ["_value"]) |> sort(columns: ["_value"], desc: false)'
  1. Query to Measurements:
curl "https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/query?org=YOUR_ORG" \
  -H "Accept: application/csv" \
  -H "Authorization: Token YOUR_TOKEN" \
  -H "Content-type: application/vnd.flux" \
  -d 'import "influxdata/influxdb/v1"

v1.tagValues(
  bucket: "YOUR_SELECTED_BUCKET",
  tag: "_measurement",
  predicate: (r) => true,
  start: duration(v: uint(v: 1970-01-01) - uint(v: now()))
)'  
  1. Query to Tags:
curl "https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/query?org=YOUR_ORG" \
  -H "Accept: application/csv" \
  -H "Authorization: Token YOUR_TOKEN" \
  -H "Content-type: application/vnd.flux" \
  -d 'import "influxdata/influxdb/v1"

v1.tagKeys(
  bucket: "YOUR_SELECTED_BUCKET",
  predicate: (r) => r._measurement == "YOUR_SELECTED_MEASUREMENT",
  start: duration(v: uint(v: 1970-01-01) - uint(v: now()))
)
|> filter(fn: (r) => r._value != "_start" and r._value != "_stop" and r._value != "_measurement" and r._value != "_field")'  
  1. Query to Fields:
curl "https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/query?org=YOUR_ORG" \
  -H "Accept: application/csv" \
  -H "Authorization: Token YOUR_TOKEN" \
  -H "Content-type: application/vnd.flux" \
  -d 'from(bucket: "YOUR_SELECTED_BUCKET")
    |> range(start: time(v: 1))
    |> filter(fn: (r) => r["_measurement"] == "YOUR_SELECTED_MEASUREMENT") 
    |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
    |> drop(columns: ["_start", "_stop", "_time", "_measurement"])
    |> limit(n:1)'  

Regards

from influxdb-gds-connector.

 avatar commented on July 25, 2024

Hello,

Thank you for your reply.

I did the tests you asked me and I have the feeling that the buckets that contain _ in their name have not return for a few days (ex : test_pixxid or test_hsecaraibes in picture).
The other buckets are available in the result (ex : hsem1)

The result of the query for the list of buckets :

curl "https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/query?org=**************" \

-H "Accept: application/csv"
-H "Authorization: Token z*****************************************************3Eog=="
-H "Content-type: application/vnd.flux"
-d 'buckets() |> rename(columns: {"name": "_value"}) |> keep(columns: ["_value"]) |> sort(columns: ["_value"], desc: false)'
,result,table,_value
,_result,0,hsem1

Maybe you exclude names with underscore ?

The majority of my buckets are named ans, do you think you can revert to the previous operation?

Thank you

TEST TOKEN

from influxdb-gds-connector.

bednar avatar bednar commented on July 25, 2024

Hello,

Thank you for your reply.

I did the tests you asked me and I have the feeling that the buckets that contain _ in their name have not return for a few days (ex : test_pixxid or test_hsecaraibes in picture).
The other buckets are available in the result (ex : hsem1)

The result of the query for the list of buckets :

curl "https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/query?org=**************" \

-H "Accept: application/csv"
-H "Authorization: Token z*****************************************************3Eog=="
-H "Content-type: application/vnd.flux"
-d 'buckets() |> rename(columns: {"name": "_value"}) |> keep(columns: ["_value"]) |> sort(columns: ["_value"], desc: false)'
,result,table,_value
,_result,0,hsem1

The same query is also used for retrieving buckets in connector. As you see at your result output there is only bucket hsem1. Try to generate new token.

Maybe you exclude names with underscore ?

No, there isn't this type of exclusion.

I ran test for a following token:

image

and results are correct:

curl "https://us-west-2-1.aws.cloud2.influxdata.com/api/v2/query?org=MY_ORG" \
  -H "Accept: application/csv" \
  -H "Authorization: Token MY_TOKEN" \
  -H "Content-type: application/vnd.flux" \
  -d 'buckets() |> rename(columns: {"name": "_value"}) |> keep(columns: ["_value"]) |> sort(columns: ["_value"], desc: false)'


,result,table,_value
,_result,0,github
,_result,0,test_underscore

from influxdb-gds-connector.

bednar avatar bednar commented on July 25, 2024

You are welcome

from influxdb-gds-connector.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.