updated to function and tasks, updated AND operator, resolves #170

pull/173/head
Scott Anderson 2019-04-18 10:01:47 -06:00
parent eb5b11d823
commit df11cabbaf
4 changed files with 22 additions and 8 deletions

View File

@ -293,7 +293,7 @@ The shortcode structure is the same as above, but the shortcode names are differ
data = from(bucket: "telegraf/autogen")
|> range(start: -15m)
|> filter(fn: (r) =>
r._measurement == "mem" AND
r._measurement == "mem" and
r._field == "used_percent"
)
```

View File

@ -33,7 +33,7 @@ This is a paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nu
data = from(bucket: "telegraf/autogen")
|> range(start: -15m)
|> filter(fn: (r) =>
r._measurement == "mem" AND
r._measurement == "mem" and
r._field == "used_percent"
)
```
@ -442,7 +442,7 @@ This is a paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nu
data = from(bucket: "telegraf/autogen")
|> range(start: -15m)
|> filter(fn: (r) =>
r._measurement == "mem" AND
r._measurement == "mem" and
r._field == "used_percent"
)
```

View File

@ -62,7 +62,7 @@ the required time range and any relevant filters.
data = from(bucket: "telegraf/default")
|> range(start: -task.every)
|> filter(fn: (r) =>
r._measurement == "mem" AND
r._measurement == "mem" and
r.host == "myHost"
)
```
@ -111,7 +111,10 @@ to send the transformed data to another bucket:
```
{{% note %}}
You cannot write to the same bucket you are reading from.
#### Important notes
- You cannot write to the same bucket you are reading from.
- In order to write data into InfluxDB, you must have `_time`, `_measurement`,
`_field`, and `_value` columns.
{{% /note %}}
## Full example task script
@ -132,7 +135,7 @@ option task = {
data = from(bucket: "telegraf/default")
|> range(start: -task.every)
|> filter(fn: (r) =>
r._measurement == "mem" AND
r._measurement == "mem" and
r.host == "myHost"
)

View File

@ -12,8 +12,7 @@ weight: 401
The `to()` function writes data to an **InfluxDB v2.0** bucket.
_**Function type:** Output_
_**Output data type:** Object_
_**Function type:** Output_
```js
to(
@ -39,6 +38,18 @@ to(
)
```
{{% note %}}
### Output data requirements
The `to()` function converts output data into line protocol and writes it to InfluxDB.
Line protocol requires each record to have a timestamp, a measurement, a field, and a value.
All output data must include the following columns:
- `_time`
- `_measurement`
- `_field`
- `_value`
{{% /note %}}
## Parameters
{{% note %}}
`bucket` OR `bucketID` is **required**.