diff --git a/content/v2.0/influxdb-templates/create.md b/content/v2.0/influxdb-templates/create.md index a11f24f47..0093ffbaf 100644 --- a/content/v2.0/influxdb-templates/create.md +++ b/content/v2.0/influxdb-templates/create.md @@ -9,6 +9,9 @@ menu: identifier: Create an InfluxDB template weight: 103 v2.0/tags: [templates] +related: + - /v2.0/reference/cli/influx/pkg/export/ + - /v2.0/reference/cli/influx/pkg/export/all/ --- Use the InfluxDB user interface (UI) and the `influx pkg export` command to diff --git a/content/v2.0/influxdb-templates/use.md b/content/v2.0/influxdb-templates/use.md index 23931b605..f556bb242 100644 --- a/content/v2.0/influxdb-templates/use.md +++ b/content/v2.0/influxdb-templates/use.md @@ -9,6 +9,8 @@ menu: name: Use templates weight: 102 v2.0/tags: [templates] +related: + - /v2.0/reference/cli/influx/pkg/ --- Use the `influx pkg` command to summarize, validate, and install templates from @@ -27,11 +29,19 @@ others in the InfluxData community. Install community templates directly from GitHub using a template's download URL or download the template. -{{% note %}} When attempting to access the community templates via the URL, the templates use the following -as the root of the URL: `https://raw.githubusercontent.com/influxdata/community-templates/master/`. +{{% note %}} +When attempting to access the community templates via the URL, the templates use the following +as the root of the URL: + +```sh +https://raw.githubusercontent.com/influxdata/community-templates/master/ +``` For example, the Docker community template can be accessed via: -`https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml`. + +```sh +https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml +``` {{% /note %}} View InfluxDB Community Templates @@ -216,4 +226,3 @@ influx pkg -f /path/to/template.yml \ ``` _To add a secret after installing a template, see [Add secrets](/v2.0/security/secrets/manage-secrets/add/)._ - diff --git a/content/v2.0/query-data/flux/manipulate-timestamps.md b/content/v2.0/query-data/flux/manipulate-timestamps.md index 401b98d6a..bc46fcd37 100644 --- a/content/v2.0/query-data/flux/manipulate-timestamps.md +++ b/content/v2.0/query-data/flux/manipulate-timestamps.md @@ -33,18 +33,19 @@ If you're just getting started with Flux queries, check out the following: ## Convert timestamp format -### Convert nanosecond epoch timestamp to RFC3339 +### Convert unix nanosecond timestamp to RFC3339 Use the [`time()` function](/v2.0/reference/flux/stdlib/built-in/transformations/type-conversions/time/) -to convert a **nanosecond** epoch timestamp to an RFC3339 timestamp. +to convert a [unix **nanosecond** timestamp](/v2.0/reference/glossary/#unix-timestamp) +to an [RFC3339 timestamp](/v2.0/reference/glossary/#rfc3339-timestamp). ```js time(v: 1568808000000000000) // Returns 2019-09-18T12:00:00.000000000Z ``` -### Convert RFC3339 to nanosecond epoch timestamp +### Convert RFC3339 to nanosecond unix timestamp Use the [`uint()` function](/v2.0/reference/flux/stdlib/built-in/transformations/type-conversions/uint/) -to convert an RFC3339 timestamp to a nanosecond epoch timestamp. +to convert an RFC3339 timestamp to a unix nanosecond timestamp. ```js uint(v: 2019-09-18T12:00:00.000000000Z) @@ -55,8 +56,8 @@ uint(v: 2019-09-18T12:00:00.000000000Z) Flux doesn't support mathematical operations using [time type](/v2.0/reference/flux/language/types/#time-types) values. To calculate the duration between two timestamps: -1. Use the `uint()` function to convert each timestamp to a nanosecond epoch timestamp. -2. Subtract one nanosecond epoch timestamp from the other. +1. Use the `uint()` function to convert each timestamp to a unix nanosecond timestamp. +2. Subtract one unix nanosecond timestamp from the other. 3. Use the `duration()` function to convert the result into a duration. ```js diff --git a/content/v2.0/reference/cli/influx/pkg/_index.md b/content/v2.0/reference/cli/influx/pkg/_index.md index 78aebafff..1cabeba62 100644 --- a/content/v2.0/reference/cli/influx/pkg/_index.md +++ b/content/v2.0/reference/cli/influx/pkg/_index.md @@ -7,9 +7,13 @@ menu: parent: influx weight: 101 v2.0/tags: [templates] +related: + - /v2.0/influxdb-templates/use/ --- The `influx pkg` command manages InfluxDB templates. +_For information about finding and using InfluxDB templates, see +[Use InfluxDB templates](/v2.0/influxdb-templates/use/)._ ## Usage ``` diff --git a/content/v2.0/reference/cli/influx/pkg/export/_index.md b/content/v2.0/reference/cli/influx/pkg/export/_index.md index 82204abcf..6faab6a96 100644 --- a/content/v2.0/reference/cli/influx/pkg/export/_index.md +++ b/content/v2.0/reference/cli/influx/pkg/export/_index.md @@ -5,9 +5,13 @@ menu: v2_0_ref: parent: influx pkg weight: 101 +related: + - /v2.0/influxdb-templates/create/ --- The `influx pkg export` command exports existing resources as an InfluxDB template. +_For detailed examples of exporting InfluxDB templates, see +[Create an InfluxDB template](/v2.0/influxdb-templates/create/)._ ## Usage ``` diff --git a/content/v2.0/reference/cli/influx/pkg/export/all.md b/content/v2.0/reference/cli/influx/pkg/export/all.md index 70c668ae8..6ce2b4786 100644 --- a/content/v2.0/reference/cli/influx/pkg/export/all.md +++ b/content/v2.0/reference/cli/influx/pkg/export/all.md @@ -6,10 +6,14 @@ menu: v2_0_ref: parent: influx pkg export weight: 201 +related: + - /v2.0/influxdb-templates/create/ --- The `influx pkg export all` command exports all resources in an organization as an InfluxDB template. +_For detailed examples of exporting InfluxDB templates, see +[Create an InfluxDB template](/v2.0/influxdb-templates/create/)._ ## Usage ``` diff --git a/content/v2.0/reference/flux/language/types.md b/content/v2.0/reference/flux/language/types.md index 495e6450a..636cbc564 100644 --- a/content/v2.0/reference/flux/language/types.md +++ b/content/v2.0/reference/flux/language/types.md @@ -75,7 +75,7 @@ The time type name is `time`. The time type is nullable. #### Timestamp format -Flux supports [RFC3339](https://tools.ietf.org/html/rfc3339#section-5.6) timestamps: +Flux supports [RFC3339 timestamps](/v2.0/reference/glossary/#rfc3339-timestamp): - `YYYY-MM-DD` - `YYYY-MM-DDT00:00:00Z` diff --git a/content/v2.0/reference/flux/stdlib/json/encode.md b/content/v2.0/reference/flux/stdlib/json/encode.md index b875e925b..b8610cf9a 100644 --- a/content/v2.0/reference/flux/stdlib/json/encode.md +++ b/content/v2.0/reference/flux/stdlib/json/encode.md @@ -22,7 +22,7 @@ json.encode(v: "some value") This function encodes [Flux types](/v2.0/reference/flux/language/types/) as follows: -- `time` values in [RFC3339](https://tools.ietf.org/html/rfc3339) format +- `time` values in [RFC3339](/v2.0/reference/glossary/#rfc3339-timestamp) format - `duration` values in number of milliseconds since the epoch - `regexp` values as their string representation - `bytes` values as base64-encoded strings diff --git a/content/v2.0/reference/glossary.md b/content/v2.0/reference/glossary.md index d49437d40..0c9a97443 100644 --- a/content/v2.0/reference/glossary.md +++ b/content/v2.0/reference/glossary.md @@ -779,6 +779,13 @@ Related entries: [duration](#duration), [measurement](#measurement), [replicatio --> +### RFC3339 timestamp +A timestamp that uses the human readable DateTime format proposed in +[RFC 3339](https://tools.ietf.org/html/rfc3339) (for example: `2020-01-01T00:00:00.00Z`). +Flux and InfluxDB clients return query results with RFC3339 timestamps. + +Related entries: [timestamp](#timestamp), [unix timestamp](#unix-timestamp) + ## S ### schema @@ -927,13 +934,8 @@ Related entries: [bin](#bin) ### step-plot -<<<<<<< HEAD A data visualization that displays time series data in a staircase graph. Generate a step-plot using the step [interpolation option for line graphs](/v2.0/visualize-data/visualization-types/graph/#options). -======= -In InfluxDB 1.x, a [step-plot graph](https://docs.influxdata.com/chronograf/v1.7/guides/visualization-types/#step-plot-graph) displays time series data in a staircase graph. -In InfluxDB 2.0, generate a similar graph using the step interpolation option for [line graphs](/v2.0/visualize-data/visualization-types/graph/#options). ->>>>>>> master ### stream @@ -1025,7 +1027,7 @@ Time in InfluxDB is in UTC. To specify time when writing data, see [Elements of line protocol](/v2.0/reference/syntax/line-protocol/#elements-of-line-protocol). To specify time when querying data, see [Query InfluxDB with Flux](/v2.0/query-data/get-started/query-influxdb/#2-specify-a-time-range). -Related entries: [point](#point) +Related entries: [point](#point), [unix timestamp](#unix-timestamp), [RFC3339 timestamp](#rfc3339-timestamp) ### token @@ -1045,7 +1047,7 @@ See [InfluxQL functions](http://docs.influxdata.com/influxdb/latest/query_langua Related entries: [aggregate](#aggregate), [function](#function), [selector](#selector) -## TSI (Time Series Index) +### TSI (Time Series Index) TSI uses the operating system's page cache to pull frequently accessed data into memory and keep infrequently accessed data on disk. @@ -1053,7 +1055,7 @@ TSI uses the operating system's page cache to pull frequently accessed data into The Time Series Logs (TSL) extension (.tsl) identifies Time Series Index (TSI) log files, generated by the tsi1 engine. -## TSM (Time Structured Merge tree) +### TSM (Time Structured Merge tree) A data storage format that allows greater compaction and higher write and read throughput than B+ or LSM tree implementations. For more information, see [Storage engine](http://docs.influxdata.com/influxdb/latest/concepts/storage_engine/). @@ -1075,6 +1077,23 @@ This protocol is used when speed is desirable and error correction is not necess An implicit block that encompasses all Flux source text in a universe block. +### unix timestamp + +Counts time since **Unix Epoch (1970-01-01T00:00:00Z UTC)** in specified units ([precision](#precision)). +Specify timestamp precision when [writing data to InfluxDB](/v2.0/write-data/). +InfluxDB supports the following unix timestamp precisions: + +| Precision | Description | Example | +|:--------- |:----------- |:------- | +| `ns` | Nanoseconds | `1577836800000000000` | +| `us` | Microseconds | `1577836800000000` | +| `ms` | Milliseconds | `1577836800000` | +| `s` | Seconds | `1577836800` | + +

The examples above represent 2020-01-01T00:00:00Z UTC.

+ +Related entries: [timestamp](#timestamp), [RFC3339 timestamp](#rfc3339-timestamp) + ### user InfluxDB users are granted permission to access to InfluxDB. @@ -1082,13 +1101,18 @@ Users are added as a member of an organization and are given a unique authentica ## V -## values per second +### values per second The preferred measurement of the rate at which data are persisted to InfluxDB. Write speeds are generally quoted in values per second. -To calculate the values per second rate, multiply the number of points written per second by the number of values stored per point. -For example, if the points have four fields each, and a batch of 5000 points is written 10 times per second, the values per second rate is `4 field values per point * 5000 points per batch * 10 batches per second = 200,000 values per second`. +To calculate the values per second rate, multiply the number of points written +per second by the number of values stored per point. +For example, if the points have four fields each, and a batch of 5000 points is +written 10 times per second, the values per second rate is: + +**4 field values per point** × **5000 points per batch** × **10 batches per second** = **200,000 values per second** + Related entries: [batch](#batch), [field](#field), [point](#point) diff --git a/content/v2.0/reference/key-concepts/data-elements.md b/content/v2.0/reference/key-concepts/data-elements.md index f8ca28895..89cb7484f 100644 --- a/content/v2.0/reference/key-concepts/data-elements.md +++ b/content/v2.0/reference/key-concepts/data-elements.md @@ -40,7 +40,7 @@ _Hover over highlighted terms to get acquainted with InfluxDB terminology and la ## Timestamp -All data stored in InfluxDB has a `_time` column that stores timestamps. On disk, timestamps are stored in epoch nanosecond format. InfluxDB formats timestamps show the date and time in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) UTC associated with data. Timestamp precision is important when you write data. +All data stored in InfluxDB has a `_time` column that stores timestamps. On disk, timestamps are stored in epoch nanosecond format. InfluxDB formats timestamps show the date and time in [RFC3339](/v2.0/reference/glossary/#rfc3339-timestamp) UTC associated with data. Timestamp precision is important when you write data. ## Measurement diff --git a/content/v2.0/reference/syntax/line-protocol.md b/content/v2.0/reference/syntax/line-protocol.md index 7bfae3b61..ea15303b6 100644 --- a/content/v2.0/reference/syntax/line-protocol.md +++ b/content/v2.0/reference/syntax/line-protocol.md @@ -10,6 +10,8 @@ weight: 102 v2.0/tags: [write, line protocol, syntax] aliases: - /v2.0/reference/line-protocol +related: + - /v2.0/write-data/ --- InfluxDB uses line protocol to write data points. @@ -87,20 +89,18 @@ measurementName fieldKey="field string value" 1556813561098000000 ### Timestamp _**Optional**_ – -The Unix nanosecond timestamp for the data point. +The [unix timestamp](/v2.0/reference/glossary/#unix-timestamp) for the data point. InfluxDB accepts one timestamp per point. If no timestamp is provided, InfluxDB uses the system time (UTC) of its host machine. _**Data type:** [Unix timestamp](#unix-timestamp)_ {{% note %}} -To ensure a data point includes the time a metric is observed (not received by InfluxDB), -include the timestamp. -{{% /note %}} - -{{% note %}} -_Use the default nanosecond precision timestamp or specify an alternative precision -when [writing the data](/v2.0/write-data/#timestamp-precision)._ +#### Important notes about timestamps +- To ensure a data point includes the time a metric is observed (not received by InfluxDB), + include the timestamp. +- If your timestamps are not in nanoseconds, specify the precision of your timestamps + when [writing the data to InfluxDB](/v2.0/write-data/#timestamp-precision). {{% /note %}} ### Whitespace @@ -191,7 +191,8 @@ Quoted field values are interpreted as strings. {{% /note %}} ### Unix timestamp -Unix nanosecond timestamp. +Unix timestamp in a [specified precision](/v2.0/reference/glossary/#unix-timestamp). +Default precision is nanoseconds (`ns`). | Minimum timestamp | Maximum timestamp | | ----------------- | ----------------- | diff --git a/content/v2.0/write-data/_index.md b/content/v2.0/write-data/_index.md index 127812d3e..e94db17ea 100644 --- a/content/v2.0/write-data/_index.md +++ b/content/v2.0/write-data/_index.md @@ -26,7 +26,8 @@ the InfluxDB user interface (UI), and client libraries. - [User Interface](#user-interface) - [influx CLI](#influx-cli) - [InfluxDB API](#influxdb-api) - - [Others](#others) + - [Other ways to write data](#other-ways-to-write-data) +- [Next steps](#next-steps) ### What you'll need @@ -56,7 +57,7 @@ mem,host=host1 used_percent=21.83599203 1556892777007291000 ``` #### Timestamp precision -Timestamps are essential in InfluxDB. +When writing data to InfluxDB, we [recommend including a timestamp](/v2.0/reference/syntax/line-protocol/#timestamp) with each point. If a data point does not include a timestamp when it is received by the database, InfluxDB uses the current system time (UTC) of its host machine. @@ -70,7 +71,8 @@ InfluxDB accepts the following precisions: - `ms` - Milliseconds - `s` - Seconds -_For more details about line protocol, see the [Line protocol reference](/v2.0/reference/syntax/line-protocol) and [Best practices for writing data](/v2.0/write-data/best-practices/)._ +_For more details about line protocol, see the [Line protocol reference](/v2.0/reference/syntax/line-protocol) +and [Best practices for writing data](/v2.0/write-data/best-practices/)._ ## Ways to write data into InfluxDB @@ -179,7 +181,7 @@ influx write \ ### InfluxDB API Write data to InfluxDB using an HTTP request to the InfluxDB API `/write` endpoint. -Include the following in your request: +Use the `POST` request method and include the following in your request: | Requirement | Include by | |:----------- |:---------- | @@ -189,19 +191,50 @@ Include the following in your request: | Authentication token | Use the `Authorization: Token` header. | | Line protocol | Pass as plain text in your request body. | -##### Example API write request +#### Example API write request Below is an example API write request using `curl`. -The URL depends on the version and location of your InfluxDB 2.0 instance. +The URL depends on the version and location of your InfluxDB 2.0 instance _(see [InfluxDB URLs](/v2.0/reference/urls/))_. +To compress data when writing to InfluxDB, set the `Content-Encoding` header to `gzip`. +Compressing write requests reduces network bandwidth, but increases server-side load. +{{< code-tabs-wrapper >}} +{{% code-tabs %}} +[Uncompressed](#) +[Compressed](#) +{{% /code-tabs %}} +{{% code-tab-content %}} ```sh curl -XPOST "http://localhost:9999/api/v2/write?org=YOUR_ORG&bucket=YOUR_BUCKET&precision=s" \ --header "Authorization: Token YOURAUTHTOKEN" \ - --data-raw "mem,host=host1 used_percent=23.43234543 1556896326" + --data-raw " +mem,host=host1 used_percent=23.43234543 1556896326 +mem,host=host2 used_percent=26.81522361 1556896326 +mem,host=host1 used_percent=22.52984738 1556896336 +mem,host=host2 used_percent=27.18294630 1556896336 +" ``` +{{% /code-tab-content %}} +{{% code-tab-content %}} +```bash +curl -XPOST "http://localhost:9999/api/v2/write?org=YOUR_ORG&bucket=YOUR_BUCKET&precision=s" \ + --header "Authorization: Token YOURAUTHTOKEN" \ + --header "Content-Encoding: gzip" \ + --data-raw " +mem,host=host1 used_percent=23.43234543 1556896326 +mem,host=host2 used_percent=26.81522361 1556896326 +mem,host=host1 used_percent=22.52984738 1556896336 +mem,host=host2 used_percent=27.18294630 1556896336 +" +``` +{{% /code-tab-content %}} +{{< /code-tabs-wrapper >}} -### Others +_For information about **InfluxDB API response codes**, see +[InfluxDB API Write documentation](/v2.0/api/#operation/PostWrite)._ + +## Other ways to write data {{< children >}} @@ -209,3 +242,23 @@ curl -XPOST "http://localhost:9999/api/v2/write?org=YOUR_ORG&bucket=YOUR_BUCKET& Use language-specific client libraries to integrate with the InfluxDB v2 API. See [Client libraries reference](/v2.0/reference/api/client-libraries/) for more information. + +--- + +## Next steps +With your data in InfluxDB, you're ready to do one or more of the following: + +### Query and explore your data +Query data using Flux, the UI, and the `influx` command line interface. +See [Query data](/v2.0/query-data/). + +### Process your data +Use InfluxDB tasks to process and downsample data. See [Process data](/v2.0/process-data/). + +### Visualize your data +Build custom dashboards to visualize your data. +See [Visualize data](/v2.0/visualize-data/). + +### Monitor your data and send alerts +Monitor your data and sends alerts based on specified logic. +See [Monitor and alert](/v2.0/monitor-alert/).