PacktPublishing / Learn-Grafana-7.0

Learn Grafana 7.0, published by packt
MIT License
65 stars 43 forks source link

Error 401:Unauthorized when loading data into InfluxDB #12

Closed mvcatsifma closed 2 years ago

mvcatsifma commented 2 years ago

I get an error 401:Unauthorized when I run the load data command on page page 104, chapter 5.

$ docker run --rm --network host -v "$(PWD):/usr/src/app" weather --input wx.txt --db weatherdb INFO:root:http://localhost:8086/query?q=CREATE+DATABASE+weatherdb ERROR:root:create_database: 401:Unauthorized Traceback (most recent call last): File "/usr/src/app/./weather.py", line 164, in <module> sys.exit(main()) File "/usr/src/app/./weather.py", line 159, in main load_wx_data(db_host=args.host, db_port=args.port, db_name=args.database, input_file=args.input_file) File "/usr/src/app/./weather.py", line 80, in load_wx_data create_database(db_host=db_host, db_port=db_port, db_name=db_name) File "/usr/src/app/./weather.py", line 19, in create_database raise Exception(f'create_database: {response.status_code}:{response.reason}') Exception: create_database: 401:Unauthorized

This error only occurs when running against InfluxDB latest. When I update the docker-compose file to use InfluxDB 1.8.7 the command executes without issues.

esalituro commented 2 years ago

You are correct. The book was developed for InfluxDB 1.X.