Comments (7)
@Pwuts I think you're running into a slight confusion around the auth system (which is understandable, because it is not the most straightforward).
An influx user is supposed to map to a person that logs in to the UI. Users have a username and password. The --token
flag on the user create
command is to authorize the action, not to set a token for the user.
If you are trying to setup a Telegraf configuration, you need to use an auth
. https://docs.influxdata.com/influxdb/v2.6/reference/cli/influx/auth/create/
There is currently no support for supplying your own token, so the best route would be to create an auth with the expected permissions, capture the resulting token, and then supply that to telegraf.
from influx-cli.
I thought it was, but I've looked around and haven't found anything. I'll think about how we can improve the documentation around this a little better.
from influx-cli.
While I'm investigating, can you try modifying the command to not pass --token
? It should work without that arg, since the container configures the CLI with the initial user's auth.
from influx-cli.
@danxmoran I deleted token
and I still get the message:
ts=2021-03-16T13:35:15.645893Z lvl=error msg="api error encountered" log_id=0SvooBZ0000 error="authorization not found
from influx-cli.
I just ran into this issue myself with InfluxDB v2.
@danxmoran without --token
, it all works indeed. With that flag, the API call fails.
from influx-cli.
The problem must be in the API client implementation called on this line: https://github.com/influxdata/influx-cli/blob/main/clients/params.go#L27
How I ran into this issue
/docker-entrypoint-initdb.d/auth-setup.sh
set -ex
influx org list
influx org find -n $DOCKER_INFLUXDB_INIT_ORG
influx user create \
--org $DOCKER_INFLUXDB_INIT_ORG \
--name telegraf \
--token $TELEGRAF_TOKEN
Container env
TELEGRAF_TOKEN
: verysecretINFLUXD_LOG_LEVEL
: debugDOCKER_INFLUXDB_INIT_ORG
: etvDOCKER_INFLUXDB_INIT_USERNAME
DOCKER_INFLUXDB_INIT_PASSWORD
DOCKER_INFLUXDB_INIT_BUCKET
: default
Output:
+ influx org list
ts=2023-01-16T15:26:46.604857Z lvl=debug msg="user find by ID" log_id=0fQnt96G000 store=new took=0.026ms
ts=2023-01-16T15:26:46.605016Z lvl=debug msg="orgs find" log_id=0fQnt96G000 store=new took=0.035ms
ts=2023-01-16T15:26:46.605035Z lvl=debug msg="Orgs retrieved" log_id=0fQnt96G000 handler=org org=[0xc0022e22a0]
ts=2023-01-16T15:26:46.605275Z lvl=debug msg=Request log_id=0fQnt96G000 service=http method=GET host=localhost:9999 path=/api/v2/orgs query= proto=HTTP/1.1 status_code=200 response_size=694 content_length=0 referrer= remote=127.0.0.1:58292 user_agent=Sha took=0.656ms body=
ID Name
65768f39d2315b23 etv
+ influx org find -n etv
ts=2023-01-16T15:26:46.614493Z lvl=debug msg="user find by ID" log_id=0fQnt96G000 store=new took=0.019ms
ts=2023-01-16T15:26:46.614652Z lvl=debug msg="orgs find" log_id=0fQnt96G000 store=new took=0.035ms
ts=2023-01-16T15:26:46.614691Z lvl=debug msg="Orgs retrieved" log_id=0fQnt96G000 handler=org org=[0xc0022e24e0]
ts=2023-01-16T15:26:46.614872Z lvl=debug msg=Request log_id=0fQnt96G000 service=http method=GET host=localhost:9999 path=/api/v2/orgs query="org=etv" proto=HTTP/1.1 status_code=200 response_size=694 content_length=0 referrer= remote=127.0.0.1:58294 user_agent=influx took=0.604ms body=
ID Name
65768f39d2315b23 etv
+ influx user create --org etv --name telegraf --token verysecret
ts=2023-01-16T15:26:46.622581Z lvl=info msg=Unauthorized log_id=0fQnt96G000 error="authorization not found"
ts=2023-01-16T15:26:46.622835Z lvl=debug msg=Request log_id=0fQnt96G000 service=http method=GET host=localhost:9999 path=/api/v2/orgs query="org=etv" proto=HTTP/1.1 status_code=401 response_size=55 content_length=0 referrer= remote=127.0.0.1:58296 user_agent=influx took=0.336ms error=unauthorized error_code=unauthorized body=
Error: failed to lookup org with name "etv": 401 Unauthorized: unauthorized access
run-parts: /docker-entrypoint-initdb.d/auth-setup.sh exited with return code 1
Further attempts to pinpoint the issue
- creating a user first using
influx user create --name telegraf --password bogusbogusbogus --org $DOCKER_INFLUXDB_INIT_ORG
, theninflux auth create --org $DOCKER_INFLUXDB_INIT_ORG --user telegraf --token $TELEGRAF_TOKEN --read-buckets --write-buckets
; this gives the same errorNote: I noticed the+ influx user create --org etv --name telegraf --password bogusbogusbogus ts=2023-01-16T15:39:28.151089Z lvl=debug msg="user find by ID" log_id=0fQobcuG000 store=new took=0.043ms ts=2023-01-16T15:39:28.151293Z lvl=debug msg="orgs find" log_id=0fQobcuG000 store=new took=0.043ms ts=2023-01-16T15:39:28.151316Z lvl=debug msg="Orgs retrieved" log_id=0fQobcuG000 handler=org org=[0xc002392420] ts=2023-01-16T15:39:28.151494Z lvl=debug msg=Request log_id=0fQobcuG000 service=http method=GET host=localhost:9999 path=/api/v2/orgs query="org=etv" proto=HTTP/1.1 status_code=200 response_size=696 content_length=0 referrer= remote=127.0.0.1:58976 user_agent=influx took=0.817ms body= ts=2023-01-16T15:39:28.152875Z lvl=debug msg="user find by ID" log_id=0fQobcuG000 store=new took=0.042ms ts=2023-01-16T15:39:28.155880Z lvl=debug msg="user create" log_id=0fQobcuG000 store=new took=2.797ms ts=2023-01-16T15:39:28.155953Z lvl=debug msg="User created" log_id=0fQobcuG000 handler=user user="&{0a9ace6b06668000 telegraf active}" ts=2023-01-16T15:39:28.156206Z lvl=debug msg=Request log_id=0fQobcuG000 service=http method=POST host=localhost:9999 path=/api/v2/users query= proto=HTTP/1.1 status_code=201 response_size=130 content_length=-1 referrer= remote=127.0.0.1:58976 user_agent=influx took=3.571ms body="{\"name\":\"telegraf\"}\n" ID Name 0a9ace6b06668000 telegraf ts=2023-01-16T15:39:28.157333Z lvl=debug msg="user find by ID" log_id=0fQobcuG000 store=new took=0.029ms ts=2023-01-16T15:39:28.157555Z lvl=debug msg="org find by ID" log_id=0fQobcuG000 store=new took=0.038ms ts=2023-01-16T15:39:28.157707Z lvl=debug msg="user find by ID" log_id=0fQobcuG000 store=new took=0.025ms ts=2023-01-16T15:39:28.160104Z lvl=debug msg="urm create" log_id=0fQobcuG000 store=new took=2.355ms ts=2023-01-16T15:39:28.160181Z lvl=debug msg="Member/owner created" log_id=0fQobcuG000 handler=urm mapping="&{0a9ace6b06668000 member user orgs 5bfed23ec70329d1}" ts=2023-01-16T15:39:28.160513Z lvl=debug msg=Request log_id=0fQobcuG000 service=http method=POST host=localhost:9999 path=/api/v2/orgs/5bfed23ec70329d1/members query= proto=HTTP/1.1 status_code=201 response_size=149 content_length=-1 referrer= remote=127.0.0.1:58976 user_agent=influx took=3.440ms body="{\"id\":\"0a9ace6b06668000\"}\n" ts=2023-01-16T15:39:28.161583Z lvl=debug msg="user find by ID" log_id=0fQobcuG000 store=new took=0.058ms ts=2023-01-16T15:39:28.220398Z lvl=debug msg="set password" log_id=0fQobcuG000 store=new took=58.586ms ts=2023-01-16T15:39:28.220614Z lvl=debug msg=Request log_id=0fQobcuG000 service=http method=POST host=localhost:9999 path=/api/v2/users/0a9ace6b06668000/password query= proto=HTTP/1.1 status_code=204 response_size=0 content_length=-1 referrer= remote=127.0.0.1:58976 user_agent=Date took=59.306ms + influx auth create --org etv --user telegraf --token verysecret --read-buckets --write-buckets ts=2023-01-16T15:39:28.228677Z lvl=info msg=Unauthorized log_id=0fQobcuG000 error="authorization not found" ts=2023-01-16T15:39:28.228861Z lvl=debug msg=Request log_id=0fQobcuG000 service=http method=GET host=localhost:9999 path=/api/v2/orgs query="org=etv" proto=HTTP/1.1 status_code=401 response_size=55 content_length=0 referrer= remote=127.0.0.1:58978 user_agent=Sha took=0.234ms error=unauthorized error_code=unauthorized body= Error: failed to lookup org with name "etv": 401 Unauthorized: unauthorized access run-parts: /docker-entrypoint-initdb.d/auth-setup.sh exited with return code 1
user_agent
isSha
here instead ofinflux
, not sure if that is related to my problem. - creating a configuration first with the preset admin credentials and setting it active before creating the user or auth, this gives the same error
- creating a configuration with host
localhost:8086
instead of the defaultlocalhost:9999
, this gives the same error:influx
seems to ignore the active config
from influx-cli.
@jeffreyssmith2nd ah, THANK YOU for clearing that up, only cost me ~5 hours of trying to debug so far.. :')
Is this in the documentation somewhere?
from influx-cli.
Related Issues (20)
- Required --user flag problems: prevents token creation on cloud2 offering using cli
- Inconsistency in required parameters for bucket commands
- Unvalidated duration input leads to signed integer overflow and confusing error message
- release version not reported
- CLI v2.7.1 for Windows is not an executable HOT 4
- Error: flag provided but not defined: -read-dbrps HOT 1
- influxdb-cli does not follow xdg base directory specification
- [bug] user option ignored when listing tokens with `influx auth list`
- `influx write` with seperator does not work as without
- Add V3 Querying to CLI
- Is the download link for InfluxDB CLI Windows version 2.7.1 correct?
- influx client CLI / auth create read-telegrafs all or nothing? (create token for specific telegraf config)
- shard duration 0 (infinite) not applying, `Error: retention policy duration must be greater than the shard duration` HOT 2
- Bug in influx v1 shell: Values presented in a bad way depending on what format is used
- Minor fault in influx v1 shell: Incompleteness in the help-as-you-type function
- Bug in influx v1 shell: Rapid cursor movement introduces garbage chars in command line
- Feature request for influx CLI: Custom config preferences for the v1 shell
- Disable password length checking
- disable password length checking [port to 2.7]
- influx write incorrectly parses input data when --skipRowOnError is enabled [port to 2.7]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from influx-cli.