Writes the data to InfluxDB as it is received.
Example:
stream |from() .measurement('requests') |eval(lambda: "errors" / "total") .as('error_percent') // Write the transformed data to InfluxDB |influxDBOut() .database('mydb') .retentionPolicy('myrp') .measurement('errors') .tag('kapacitor', 'true') .tag('version', '0.2')
Available Statistics:
Property methods modify state on the calling node. They do not add another node to the pipeline, and always return a reference to the calling node. Property methods are marked using the .
operator.
Number of points to buffer when writing to InfluxDB. Default: 1000
node.buffer(value int64)
The name of the InfluxDB instance to connect to. If empty the configured default will be used.
node.cluster(value string)
Create indicates that both the database and retention policy will be created, when the task is started. If the retention policy name is empty than no retention policy will be specified and the default retention policy name will be created.
If the database already exists nothing happens.
node.create()
The name of the database.
node.database(value string)
Write points to InfluxDB after interval even if buffer is not full. Default: 10s
node.flushInterval(value time.Duration)
The name of the measurement.
node.measurement(value string)
The precision to use when writing the data.
node.precision(value string)
The name of the retention policy.
node.retentionPolicy(value string)
Add a static tag to all data points. Tag can be called more than once.
node.tag(key string, value string)
The write consistency to use when writing the data.
node.writeConsistency(value string)
Chaining methods create a new node in the pipeline as a child of the calling node. They do not modify the calling node. Chaining methods are marked using the |
operator.
Helper function for creating an alert on low throughput, a.k.a. deadman's switch.
Example:
var data = stream |from()... // Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s. data |deadman(100.0, 10s) //Do normal processing of data data...
The above is equivalent to this Example:
var data = stream |from()... // Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s. data |stats(10s) .align() |derivative('emitted') .unit(10s) .nonNegative() |alert() .id('node \'stream0\' in task \'{{ .TaskName }}\'') .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "emitted" | printf "%0.3f" }} points/10s.') .crit(lambda: "emitted" <= 100.0) //Do normal processing of data data...
The id
and message
alert properties can be configured globally via the 'deadman' configuration section.
Since the AlertNode is the last piece it can be further modified as usual. Example:
var data = stream |from()... // Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s. data |deadman(100.0, 10s) .slack() .channel('#dead_tasks') //Do normal processing of data data...
You can specify additional lambda expressions to further constrain when the deadman's switch is triggered. Example:
var data = stream |from()... // Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s. // Only trigger the alert if the time of day is between 8am-5pm. data |deadman(100.0, 10s, lambda: hour("time") >= 8 AND hour("time") <= 17) //Do normal processing of data data...
node|deadman(threshold float64, interval time.Duration, expr ...ast.LambdaNode)
Returns: AlertNode
Create a new stream of data that contains the internal statistics of the node. The interval represents how often to emit the statistics based on real time. This means the interval time is independent of the times of the data points the source node is receiving.
node|stats(interval time.Duration)
Returns: StatsNode
© 2015 InfluxData, Inc.
Licensed under the MIT license.
https://docs.influxdata.com/kapacitor/v1.3/nodes/influx_d_b_out_node/