Feeding data to influxDB



  • Hi there, progress is great on my project. I have now reached a state, where I am considering the optimal approach to storing time-series-data in my influxDB.

    I can do it from the device, which is ESP8266 on wifi with IP, or I can do it from the server, but not sure what approach to use on the server.

    Any tips and tricks to share?


  • ADMIN

    @njbuch

    Any tips and tricks to share?

    You can do it from server. No need to touch your device ;)

    This feature is available in recent SNAPSHOT version.

    You have to create an external server as shown,

    0_1486399732509_upload-361a7b51-b651-4d63-8266-0d4e7f4f19ff

    Assign sensors variable or sensor or gateway to this external server.

    0_1486399805051_upload-c4264ae1-299d-4ab8-ab80-3debaa6c9980

    All done :)



  • Super awesome it works great, can I add more sensor variables to one line in the external server?


  • ADMIN

    @njbuch You can not add more sensor variables to one line.
    however,

    • if you configure a sensor it will send all the sensor variables data under the sensor.
    • If configure a node it will all the sensor variables data under the node.
    • If you configure a gateway it will send all the sensor variable data under the gateway.

    If the above configuration does not meet your requirements, you have to create multiple entries.



  • Tried to post all measurements from a node, but there is no tag keys, and hence I cannot query the data....

    Looking at the interface there is a "tags" field, but not sure how the temperature measurement is seperated from the humidity...?


  • ADMIN

    @njbuch Tags are common across all data in MyController, It will indicate that, data from MyConroller. You can do a query based on Key format. Default key format is sensorName



  • @jkandasa Not sure I understand that. I have tried:

    SELECT mean("value") FROM "$ESP_0B9892" WHERE "sensorName" = 'humid-1'

    In influxdb, but no results....(but works).. but trying:

    SELECT * FROM "$ESP_0B9892"

    Returns:

    time    value
    2017-02-07T17:35:21.305Z    21
    2017-02-07T17:35:21.34Z     54.4
    2017-02-07T17:36:22.233Z    21.1
    2017-02-07T17:36:22.269Z    54.4
    

    which indicates there is no tags or anything to seperate the data.

    This is my config window:
    0_1486500910356_upload-b007fd61-5c93-4bd3-93df-9496ff45bc5e


  • ADMIN

    @njbuch You should use dynamic key format. currently("$ESP_0B9892") it is static. Change keyFormat as one of or mixed. Supported key's are here

    Example:
    Key format, examples:

    • $sensorName >> SELECT mean("value") FROM 'humid-1'
    • $sensorName >> SELECT mean("value") FROM 'temp-1'


  • @njbuch

    Is that in the query on influxdb or the configuration?

    In configuration, you have to user key format from the following list,

    • $gatewayName
    • $nodeName
    • $nodeEui
    • $sensorName
    • $sensorId
    • $variableType
    • $variableTypeId

    You can use mixed of any value from above list.
    Examples:

    • $sensorName
    • $sensorName_$sensorId
      etc.,

    The table name will be based on your Key format value. If you use any references from the above list, It will be replaced dynamically at runtime with actual value. Hence your table name will be based on your key format and actual resource value.

    You have to create a query for influxDB based on your resource and Key format.

    Example:

    • My key format is $nodeEui_$sensorName
    • My resource: nodeEui = 2, sensorName = temp_1
    • My query will be like SELECT mean("value") FROM '2_temp_1'
    • Here Key format ($nodeEui_$sensorName) replaced on dynamically as 2_temp_1.

    I hope this example clears your confusion.



  • Thanks for the good explanation, have played a lot with it, but cannot make it work.

    This is my external server configs:
    0_1486586923982_upload-9e3bb13a-02cd-4e42-aed7-b997559730eb

    And I have two resources created:
    0_1486586961908_upload-93a7aabe-a744-4bf1-b924-5ba17572c87e

    But nothing can be found in influxdb, and the log is empty...

    I had it working 2 days ago with static info in the external server... which was stupid I see now :)


  • ADMIN

    @njbuch To check available series on the databases do the query, SHOW SERIES. will list available series.

    For your configuration, you should have the following series and it is query,

    • ESP_0B9892_Skur_fugtighed >> select * from ESP_0B9892_Skur_fugtighed
    • ESP_0B9892_Skur_Temperature >> select * from ESP_0B9892_Skur_Temperature

Log in to reply