Announcement

Collapse
No announcement yet.

influxdb token setup

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    influxdb token setup

    I am trying to setup influxdb and I'm not having any luck getting mcsMQTT to write to it. Here's what I did:

    Installed influxdb2-2.0.6 on to a Ubuntu 18.03 ESXI 6.7 VM.
    Created a bucket called MQTT.

    Code:
    $ influx bucket list
    ID Name Retention Shard group duration Organization ID
    96971ea5ffbab55f MQTT infinite 168h0m0s e253c08a9227a453
    4124b318283e72fa _monitoring 168h0m0s 24h0m0s e253c08a9227a453
    169be0acf0b160fa _tasks 72h0m0s 24h0m0s e253c08a9227a453
    Created an org called homeseer:

    Code:
    $ influx org list
    ID Name
    e253c08a9227a453 homeseer
    Created a read write token and pasted it into the mcsMQTT Authorization Token field.

    Code:
    $ influx auth list
    ID Description Token User Name User ID Permissions
    07a3a22bc1d27000 patrick's Token XXXAt6sa6nwmCo8wsGWfcrTXvSzu-3HfOAlVLbdnsKK_uocqDYVSMjLr438JYVzKnfxOvLKT2DzaBN6ewQhT7g== patrick 07a3a22bb5127000 [read:authorizations write:authorizations read:buckets write:buckets read:dashboards write:dashboards read:orgs write:orgs read:sources write:sources read:tasks write:tasks read:telegrafs write:telegrafs read:users write:users read:variables write:variables read:scrapers write:scrapers read:secrets write:secrets read:labels write:labels read:views write:views read:documents write:documents read:notificationRules write:notificationRules read:notificationEndpoints write:notificationEndpoints read:checks write:checks read:dbrp write:dbrp]
    07a4db3f08127000 homeseer XXXv-2oy6jTqkONshEuTp4LASt-NPXPuKS62PLL8kIdWYGh2elnOqiogou60irqWv-R1iH5fuWeJ9nSoS1XKw== patrick 07a3a22bb5127000 [read:orgs/e253c08a9227a453/authorizations write:orgs/e253c08a9227a453/authorizations read:orgs/e253c08a9227a453/buckets write:orgs/e253c08a9227a453/buckets read:orgs/e253c08a9227a453/checks write:orgs/e253c08a9227a453/checks read:orgs/e253c08a9227a453/dashboards write:orgs/e253c08a9227a453/dashboards read:orgs/e253c08a9227a453/dbrp write:orgs/e253c08a9227a453/dbrp read:orgs/e253c08a9227a453/documents write:orgs/e253c08a9227a453/documents read:orgs/e253c08a9227a453/labels write:orgs/e253c08a9227a453/labels read:orgs/e253c08a9227a453/notificationRules write:orgs/e253c08a9227a453/notificationRules read:orgs/e253c08a9227a453/notificationEndpoints write:orgs/e253c08a9227a453/notificationEndpoints read:orgs/e253c08a9227a453 read:orgs/e253c08a9227a453/secrets write:orgs/e253c08a9227a453/secrets read:orgs/e253c08a9227a453/scrapers write:orgs/e253c08a9227a453/scrapers read:orgs/e253c08a9227a453/sources write:orgs/e253c08a9227a453/sources read:orgs/e253c08a9227a453/tasks write:orgs/e253c08a9227a453/tasks read:orgs/e253c08a9227a453/telegrafs write:orgs/e253c08a9227a453/telegrafs read:users/07a3a22bb5127000 write:users/07a3a22bb5127000 read:orgs/e253c08a9227a453/variables write:orgs/e253c08a9227a453/variables read:orgs/e253c08a9227a453/views write:orgs/e253c08a9227a453/views]
    When I check the status of influxdb I see that mcsMQTT is trying to communicate but there is a message about token required:

    Code:
    $ sudo service influxdb status
    ● influxdb.service - InfluxDB is an open-source, distributed, time series database
    Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2021-06-05 16:34:36 PDT; 23h ago
    Docs: https://docs.influxdata.com/influxdb/
    Main PID: 4712 (influxd)
    Tasks: 7 (limit: 2323)
    CGroup: /system.slice/influxdb.service
    └─4712 /usr/bin/influxd
    
    Jun 06 14:16:38 patrick-virtual-machine influxd[4712]: ts=2021-06-06T21:16:38.045370Z lvl=info msg="executing new query" log_id=0UZdIvHW000 query="SELECT COUNT(\"value\") FROM mcsMQTT WHERE (((time >= '2021-06-05T00:00:00Z') AND (time < '2021-06-07T00:00:00Z')))"
    Jun 06 14:16:54 patrick-virtual-machine influxd[4712]: ts=2021-06-06T21:16:54.057826Z lvl=info msg="executing new query" log_id=0UZdIvHW000 query="SELECT COUNT(\"value\") FROM mcsMQTT WHERE (((time >= '2021-06-05T00:00:00Z') AND (time < '2021-06-07T00:00:00Z')))"
    Jun 06 14:17:02 patrick-virtual-machine influxd[4712]: ts=2021-06-06T21:17:02.565004Z lvl=info msg="executing new query" log_id=0UZdIvHW000 query="SELECT COUNT(\"value\") FROM mcsMQTT WHERE (((time >= '2021-06-05T00:00:00Z') AND (time < '2021-06-07T00:00:00Z')))"
    Jun 06 14:34:42 patrick-virtual-machine influxd[4712]: ts=2021-06-06T21:34:42.114477Z lvl=info msg="Retention policy deletion check (start)" log_id=0UZdIvHW000 service=retention op_name=retention_delete_check op_event=start
    Jun 06 14:34:42 patrick-virtual-machine influxd[4712]: ts=2021-06-06T21:34:42.115193Z lvl=info msg="Retention policy deletion check (end)" log_id=0UZdIvHW000 service=retention op_name=retention_delete_check op_event=end op_elapsed=42.313ms
    Jun 06 15:04:42 patrick-virtual-machine influxd[4712]: ts=2021-06-06T22:04:42.072877Z lvl=info msg="Retention policy deletion check (start)" log_id=0UZdIvHW000 service=retention op_name=retention_delete_check op_event=start
    Jun 06 15:04:42 patrick-virtual-machine influxd[4712]: ts=2021-06-06T22:04:42.073489Z lvl=info msg="Retention policy deletion check (end)" log_id=0UZdIvHW000 service=retention op_name=retention_delete_check op_event=end op_elapsed=0.636ms
    Jun 06 15:06:13 patrick-virtual-machine influxd[4712]: ts=2021-06-06T22:06:13.862356Z lvl=info msg=Unauthorized log_id=0UZdIvHW000 error="token required"
    Jun 06 15:34:42 patrick-virtual-machine influxd[4712]: ts=2021-06-06T22:34:42.072892Z lvl=info msg="Retention policy deletion check (start)" log_id=0UZdIvHW000 service=retention op_name=retention_delete_check op_event=start
    Jun 06 15:34:42 patrick-virtual-machine influxd[4712]: ts=2021-06-06T22:34:42.073507Z lvl=info msg="Retention policy deletion check (end)" log_id=0UZdIvHW000 service=retention op_name=retention_delete_check op_event=end op_elapsed=0.637ms
    Here is a snippet of mcsMQTT Debug.txt:

    Code:
    6/6/2021 4:00:33 PM 83938841 | ProcessMessage New weather/loop
    6/6/2021 4:00:33 PM 83938843 | Update Accepted 1415 to 70.5 StatusType=2 Payload= 70.5 RegExValue=70.5
    6/6/2021 4:00:33 PM 83938844 | Updating Device from 70.5 PayloadNumeric=True nValue=70.5
    6/6/2021 4:00:33 PM 83938845 | Update Accepted 1414 to 63.1 StatusType=2 Payload= 63.1 RegExValue=63.1
    6/6/2021 4:00:33 PM 83938849 | Updating Device from 63.1 PayloadNumeric=True nValue=63.1
    6/6/2021 4:00:33 PM 83938850 | Update Accepted 1428 to 0.000567440944882 StatusType=2 Payload= 0.000567440944882 RegExValue=0.000567440944882
    6/6/2021 4:00:33 PM 83938851 | Updating Device from 0.000567440944882 PayloadNumeric=True nValue=0.000567440944882
    6/6/2021 4:00:33 PM 83938852 | Update Accepted 682 to 0.0 StatusType=2 Payload= 0.0 RegExValue=0.0
    6/6/2021 4:00:33 PM 83938853 | Updating Device from 0 PayloadNumeric=True nValue=0
    6/6/2021 4:00:33 PM 83938853 | Update Accepted 1429 to 0.426743346457 StatusType=2 Payload= 0.426743346457 RegExValue=0.426743346457
    6/6/2021 4:00:33 PM 83938854 | Updating Device from 0.426743346457 PayloadNumeric=True nValue=0.426743346457
    6/6/2021 4:00:33 PM 83938855 | Update Accepted 630 to 726.673115125 StatusType=2 Payload= 726.673115125 RegExValue=726.673115125
    6/6/2021 4:00:33 PM 83938857 | Updating Device from 726.751823471 PayloadNumeric=True nValue=726.673115125
    6/6/2021 4:00:33 PM 83938857 | Update Accepted 1430 to 0.0 StatusType=2 Payload= 0.0 RegExValue=0.0
    6/6/2021 4:00:33 PM 83938858 | Updating Device from 0 PayloadNumeric=True nValue=0
    6/6/2021 4:00:33 PM 83938859 | Update Accepted 1431 to 1623020433.0 StatusType=2 Payload= 1623020433.0 RegExValue=1623020433.0
    6/6/2021 4:00:33 PM 83938860 | Updating Device from 1623020431 PayloadNumeric=True nValue=1623020433
    6/6/2021 4:00:33 PM 83938860 | Update Accepted 1432 to 0.191689251969 StatusType=2 Payload= 0.191689251969 RegExValue=0.191689251969
    6/6/2021 4:00:33 PM 83938861 | Updating Device from 0.191689251969 PayloadNumeric=True nValue=0.191689251969
    6/6/2021 4:00:33 PM 83938861 | Update Accepted 1433 to 1.0 StatusType=2 Payload= 1.0 RegExValue=1.0
    6/6/2021 4:00:33 PM 83938862 | Updating Device from 1 PayloadNumeric=True nValue=1
    6/6/2021 4:00:33 PM 83938863 | ActOnMessageForTrigger Topic weather/loop,Payload={"soilMoist1_centibar": "70.5", "extraTemp3_F": "63.1", "hourRain_in": "0.000567440944882", "windSpeed_mph": "0.0", "rain24_in": "0.426743346457", "maxSolarRad": "726.673115125", "rainRate_inch_per_hour": "0.0", "dateTime": "1623020433.0", "dayRain_in": "0.191689251969", "usUnits": "1.0"}, Triggers=11
    6/6/2021 4:00:33 PM 83938874 | InfluxDB Write Auth Authorization: Token XXX2v-2oy6jTqkONshEuTp4LASt-NPXPuKS62PLL8kIdWYGh2elnOqiogou60irqWv-R1iH5fuWeJ9nSoS1XKw==
    6/6/2021 4:00:33 PM 83938896 | HSEvent VALUE_CHANGE| 1024| | 115530| 115529| 458
    6/6/2021 4:00:34 PM 83938918 | InfluxDB Write Finally no Response The remote server returned an error: (400) Bad Request.
    6/6/2021 4:00:34 PM 83938918 | InfluxDB Write Finally The remote server returned an error: (400) Bad Request., Queue Depth =1
    6/6/2021 4:00:34 PM 83938918 | InfluxDB Write Auth Authorization: Token XXX2v-2oy6jTqkONshEuTp4LASt-NPXPuKS62PLL8kIdWYGh2elnOqiogou60irqWv-R1iH5fuWeJ9nSoS1XKw==
    6/6/2021 4:00:34 PM 83938962 | InfluxDB Write Finally no Response The remote server returned an error: (400) Bad Request.
    6/6/2021 4:00:34 PM 83938962 | InfluxDB Write Finally The remote server returned an error: (400) Bad Request., Queue Depth =0
    Can someone give me some guidance on setting up the tokens?


    #2
    You need the org ID and not the org Name with Influx 2. It is visible on the InfluxDB browser console.

    Comment


      #3
      Thanks!

      Comment

      Working...
      X