datalogd.plugins.influxdb_datasink module¶
-
class
datalogd.plugins.influxdb_datasink.
InfluxDBDataSink
(host='localhost', port=8086, user='root', password='root', dbname='datalogd', session='default', run=None)[source]¶ Bases:
datalogd.DataSink
Connection to a InfluxDB database for storing time-series data.
Note
This plugin is outdated. For new InfluxDB 2.x installs, use the
InfluxDB2DataSink
plugin instead.Note that this doesn’t actually run the InfluxDB database service, but simply connects to an existing InfluxDB database via a network (or localhost) connection. See the getting started documentation for details on configuring a new database server.
Parameters: - host – Host name or IP address of InfluxDB server.
- port – Port used by InfluxDB server.
- user – Name of database user.
- password – Password for database user.
- dbname – Name of database in which to store data.
- session – A name for the measurement session.
- run – A tag to identify commits from this run. Default of
None
will use a date/time stamp.
-
receive
(data)[source]¶ Commit data to the InfluxDB database.
Multiple items of data can be submitted at once if
data
is a list. A typical format ofdata
would be:[ {'type': 'temperature', 'id': '0', 'value': 22.35}, {'type': 'humidity', 'id': '0', 'value': 55.0}, {'type': 'temperature', 'id': '1', 'value': 25.80}, ]
The data point will have its data field generated using the form
<type>_<id> = <value>
.A timestamp for the commit will be generated using the current system clock if a “timestamp” field does not already exist.
Parameters: data – Data to commit to the database.