matthewwall / weewx-influx

uploader for influxdb
GNU General Public License v3.0
45 stars 22 forks source link

raise Bad Login(e)??? #5

Closed johnny2678 closed 7 years ago

johnny2678 commented 7 years ago

Getting hung up... looks like it connects and runs the 'CREATE DATABASE' statement ok but then errors out after the first REC.

This is against a vanilla install of influxDB with no user/pass set.

The weewx.conf settings are:

[StdRESTful]
    [[Influx]]
        database = PiPool
        port = 8086
        host = 192.168.x.x                         # specify host OR server_url
#        server_url = http://192.168.x.x.       # specify server_url OR host
#        username = root
#        password = root
        tags = station=KFLBRADE95,test=yes                   # optional

/var/log/messages output with debug=1 set

May 31 15:53:30 adf5818cadc6 weewx[24]: restx: Influx: service version is 0.3
May 31 15:53:30 adf5818cadc6 weewx[24]: restx: Influx: tags ['station=KFLBRADE95', 'test=yes']
May 31 15:53:30 adf5818cadc6 weewx[24]: restx: Influx: database is PiPool
May 31 15:53:30 adf5818cadc6 weewx[24]: manager: Daily summary version is 1.0
May 31 15:53:30 adf5818cadc6 weewx[24]: manager: Daily summary version is 1.0
May 31 15:53:30 adf5818cadc6 weewx[24]: restx: Influx: code: 200 payload: {"results":[{"statement_id":0,"messages":[{"level":"warning","text":"deprecated use of 'CREATE DATABASE PiPool' in a read only context, please use a POST request instead"}]}]}
May 31 15:53:30 adf5818cadc6 weewx[24]: restx: Influx: Data will be uploaded to http://192.168.x.x:8086
May 31 15:53:30 adf5818cadc6 weewx[24]: engine: Finished loading service user.influx.Influx
May 31 15:53:30 adf5818cadc6 weewx[24]: engine: Loading service weewx.engine.StdPrint
May 31 15:53:30 adf5818cadc6 weewx[24]: engine: Finished loading service weewx.engine.StdPrint
May 31 15:53:30 adf5818cadc6 weewx[24]: engine: Loading service weewx.engine.StdReport
May 31 15:53:30 adf5818cadc6 weewx[24]: engine: Finished loading service weewx.engine.StdReport
May 31 15:53:30 adf5818cadc6 weewx[24]: engine: Starting up weewx version 3.7.1
May 31 15:53:30 adf5818cadc6 weewx[24]: engine: Station does not support reading the time
May 31 15:53:30 adf5818cadc6 weewx[24]: engine: Starting main packet loop.
May 31 15:53:30 adf5818cadc6 weewx[24]: manager: Daily summary version is 1.0
May 31 15:54:30 adf5818cadc6 weewx[24]: manager: Added record 2017-05-31 15:54:00 EDT (1496260440) to database 'weewx.sdb'
May 31 15:54:30 adf5818cadc6 weewx[24]: manager: Added record 2017-05-31 15:54:00 EDT (1496260440) to daily summary in 'weewx.sdb'
May 31 15:54:30 adf5818cadc6 weewx[24]: reportengine: Running reports for latest time in the database.
May 31 15:54:30 adf5818cadc6 weewx[24]: reportengine: Running report StandardReport
May 31 15:54:30 adf5818cadc6 weewx[24]: reportengine: Found configuration file /home/weewx/skins/Standard/skin.conf for report StandardReport
May 31 15:54:30 adf5818cadc6 weewx[24]: restx: Influx: Unexpected exception of type <type 'exceptions.NameError'>
May 31 15:54:30 adf5818cadc6 weewx[24]: *** Traceback (most recent call last):
May 31 15:54:30 adf5818cadc6 weewx[24]: ***   File "/home/weewx/bin/weewx/restx.py", line 343, in run_loop
May 31 15:54:30 adf5818cadc6 weewx[24]: ***     self.process_record(_record, dbmanager)
May 31 15:54:30 adf5818cadc6 weewx[24]: ***   File "/home/weewx/bin/user/influx.py", line 313, in process_record
May 31 15:54:30 adf5818cadc6 weewx[24]: ***     self.post_with_retries(req)
May 31 15:54:30 adf5818cadc6 weewx[24]: ***   File "/home/weewx/bin/weewx/restx.py", line 417, in post_with_retries
May 31 15:54:30 adf5818cadc6 weewx[24]: ***     _response = self.post_request(request, payload)
May 31 15:54:30 adf5818cadc6 weewx[24]: ***   File "/home/weewx/bin/user/influx.py", line 353, in post_request
May 31 15:54:30 adf5818cadc6 weewx[24]: ***     raise BadLogin(e)
May 31 15:54:30 adf5818cadc6 weewx[24]: *** NameError: global name 'BadLogin' is not defined
May 31 15:54:30 adf5818cadc6 weewx[24]: restx: Influx: Thread exiting. Reason: global name 'BadLogin' is not defined
May 31 15:54:30 adf5818cadc6 weewx[24]: cheetahgenerator: using search list ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo', 'weewx.cheetahgenerator.Extras']
May 31 15:54:30 adf5818cadc6 weewx[24]: manager: Daily summary version is 1.0
May 31 15:54:30 adf5818cadc
matthewwall commented 7 years ago

please try v0.4 of the uploader. forgot to qualify weewx.restx.BadLogin

johnny2678 commented 7 years ago

Thanks for the quick response. Now the logs look like this:

Jun  1 07:24:52 ad4902691d6f weewx[24]: manager: Daily summary version is 1.0
Jun  1 07:24:52 ad4902691d6f weewx[24]: manager: Daily summary version is 1.0
Jun  1 07:24:52 ad4902691d6f weewx[24]: restx: Influx: code: 200 payload: {"results":[{"statement_id":0,"messages":[{"level":"warning","text":"deprecated use of 'CREATE DATABASE PiPool' in a read only context, please use a POST request instead"}]}]}
Jun  1 07:24:52 ad4902691d6f weewx[24]: restx: Influx: Data will be uploaded to http://192.168.5.133:8086
Jun  1 07:24:52 ad4902691d6f weewx[24]: engine: Finished loading service user.influx.Influx
Jun  1 07:24:52 ad4902691d6f weewx[24]: engine: Loading service weewx.engine.StdPrint
Jun  1 07:24:52 ad4902691d6f weewx[24]: engine: Finished loading service weewx.engine.StdPrint
Jun  1 07:24:52 ad4902691d6f weewx[24]: engine: Loading service weewx.engine.StdReport
Jun  1 07:24:52 ad4902691d6f weewx[24]: engine: Finished loading service weewx.engine.StdReport
Jun  1 07:24:52 ad4902691d6f weewx[24]: engine: Starting up weewx version 3.7.1
Jun  1 07:24:52 ad4902691d6f weewx[24]: engine: Station does not support reading the time
Jun  1 07:24:52 ad4902691d6f weewx[24]: engine: Starting main packet loop.
Jun  1 07:24:52 ad4902691d6f weewx[24]: manager: Daily summary version is 1.0
Jun  1 07:25:28 ad4902691d6f weewx[24]: manager: Added record 2017-06-01 07:25:00 EDT (1496316300) to database 'weewx.sdb'
Jun  1 07:25:28 ad4902691d6f weewx[24]: manager: Added record 2017-06-01 07:25:00 EDT (1496316300) to daily summary in 'weewx.sdb'
Jun  1 07:25:28 ad4902691d6f weewx[24]: reportengine: Running reports for latest time in the database.
Jun  1 07:25:28 ad4902691d6f weewx[24]: reportengine: Running report StandardReport
Jun  1 07:25:28 ad4902691d6f weewx[24]: restx: Influx: Bad login; waiting 60.0 minutes then retrying

Result is the same whether username & password is set or commented out in weewx.conf. I never set an Influx instance password or a password on the database. With Grafana, I just use root/root and it works.

I'm traveling today but might try setting a database password later unless you have any thoughts. Thanks again.

matthewwall commented 7 years ago

please try v0.5

i forgot that i had partial edits in 0.3/0.4 - that is where the bogus code was

0.5 should handle both http and https. i am anchored off an island in the caribbean at the moment so i do not have easy access to my test equipment to verify this.

johnny2678 commented 7 years ago

works! go back to your bucket of Kalik Gold and stop squashing bugs for us needy mainlanders ;)