InfluxDB Publisher Configuration
Each logger instance has its own configuration, multiple loggers can be configured and executed at the same time.
The logger specific connection string must be set in the property "Connection".
Example: http://mydb.com:8086/api/v2/write?bucket=humanos&orgID=880d77f7f6649211&rp=
Add additional Properties to the publisher.
Use CustomHeader:<HeaderName>
to specify special properties for HTTP/HTTPS communications, such as Authorization
.
The following table contains the specific properties of the InfluxDbLogger Publisher configuration. It extends the general DataLogger publisher configuration documented in Common DataLogger Configuration.
Parameter | Description | Data Type |
---|---|---|
Precision | Precision of the data logger
| System.String |
Connection Parameter
The Connection parameter contains the write-URL without the “precision”-query.
Example Influx 1.x:
http://10.196.24.12:8086/write?db=test&rp=
Example Influx 2.x:
http://10.241.0.14:8086/api/v2/write?bucket=HumanOS&orgID=83720f1029&rp=
Authentication
The authentication changed from version 1.x to 2.x.
-
1.x: The username and password must be specified in the “Connection” setting
http://10.196.24.12:8086/write?db=test&rp=&u=username&p=password
-
2.x: The authentication can be realized using an API token in the header (CustomHeader:Authentication property of the publisher)
Influx Line Protocol
The DataSet-element specifies the elements of the Influx line protocol (measurement, tags, fields and timestamp).
// Syntax
<measurement>[,<tag_key>=<tag_value>[,<tag_key>=<tag_value>]]
<field_key>=<field_value>[,<field_key>=<field_value>]
[<timestamp>]
// Example
myMeasurement,tag1=value1,tag2=value2 fieldKey="fieldValue"
1556813561098000000
Accordingly, the dataset contains following log-fields, that must match to the protocol elements:
FieldName | Description | Data Type |
---|---|---|
Measurement | Field contains the name of the measurement | System.String |
State | Field contains the data state | System.Type |
Tag:<key> | [Optional] Field contains a tag-key and value | System.String |
Field:<key> | Field contains a field-key and its value | System.Object |
TimeStamp | [Optional] Field contains the timestamp of the data node. If not set, it will take to current timestamp of data processing | System.DateTime |
Further information about DataSets can be found in the manual Common DataLogger Configuration.
Note, that multiple tags can be specified. Use tags to optimize the queries in InfluxDB.
If a tag value is empty, the tag is not reported to InfluxDB.
Measurement names, tag-keys, and field-keys cannot begin with an underscore
_
. The_
namespace is reserved for InfluxDB system use.
Example:
The example uses the Guid of the data node as measurement and the node name as tag-key. The value of data node is mapped to the influx field-value.
{
"Disable": false,
"Publishers": [
{
"Id": "608BB9CC-29A3-4F35-9439-6B132207BFE1",
"Name": "TestDataLogger20",
"Connection": "http://10.241.0.14:8086/api/v2/write?bucket=HumanOS&orgID=990d66f7556400fb&rp=",
"Precision": "ms",
"NetworkTimeout": 10000,
"Properties": {
"CustomHeader:Authorization": "Token I83k382JSMAu3jdmsm-oweowe932o23092721-pgoq8uAQfqp8s=="
},
"DataSets": [
{
"Name": "test2",
"Type": "DataNode",
"NodeFilter": "",
"Tag": "test",
"Fields": [
{
"Name": "Measurement",
"DataType": "System.String",
"Query": "item.GlobalId"
},
{
"Name": "Tag:Name",
"DataType": "System.String",
"Query": "item.Node.Name"
},
{
"Name": "TimeStamp",
"DataType": "System.DateTime",
"Query": "item.TimeStamp"
},
{
"Name": "Field:Value",
"DataType": "System.Object",
"Query": "item.Value"
},
{
"Name": "State",
"DataType": "System.Int32",
"Query": "item.DataState"
}
]
}
],
"ServiceRule": {
"BindingRuleId": "{8A80927A-B1F8-4505-B4BA-FB2DFED765E4}",
"UnbindingRuleId": "{1058566D-0787-48C3-95A5-235E9A55CCF3}",
"Type": "All"
}
}
]
}
Mapping of HumanOS® DataTypes
HumanOS® supports much more data types than InfluxDB.
DataType | Mapping |
---|---|
System.Boolean | Maps to the Boolean of Influx (True or False ) |
System.SByte; System.Int16; System.Int32; System.Int64 | Maps to the Integer data type of Influx (64bit) |
System.Byte; System.UInt16; System.UInt32; System.UInt64 | Maps to UInteger of Influx (64bit) |
System.Double; System.Single; System.Decimal | Maps to IEEE-754 64-bit floating-point numbers. |
Arrays | Maps to a string. Elements are separated by “;” |
Everything else | Maps to string. |