diff --git a/content/v2.0/write-data/_index.md b/content/v2.0/write-data/_index.md index b5515ec42..dcd4c3c03 100644 --- a/content/v2.0/write-data/_index.md +++ b/content/v2.0/write-data/_index.md @@ -2,9 +2,10 @@ title: Write data to InfluxDB list_title: Write data description: > - Collect and write time series data to InfluxDB using line protocol, Telegraf, data scrapers, - the InfluxDB v2 API, `influx` CLI, the InfluxDB UI, client libraries, and third-party technologies. + Collect and write time series data to InfluxDB Cloud and InfluxDB OSS. weight: 2 +aliases: + - /v2.0/write-data/quick-start/ menu: v2_0: name: Write data @@ -22,12 +23,10 @@ Telegraf, data scrapers, the InfluxDB v2 API, `influx` command line interface (C the InfluxDB user interface (UI), client libraries, and third-party technologies. - [What you'll need](#what-you-ll-need) -- [Ways to write data into InfluxDB](#ways-to-write-data-into-influxdb) - - [User Interface](#user-interface) - - [influx CLI](#influx-cli) - - [InfluxDB API](#influxdb-api) - - [Third-party technologies (with native line protocol support)](#third-party-technologies) - - [Other ways to write data](#other-ways-to-write-data) +- [Quickly start collecting data](#quickly-start-collecting-data) + - [Demo data for InfluxDB Cloud](#demo-data-for-influxdb-cloud) + - [Quick Start for InfluxDB OSS](#quick-start-for-influxdb-oss) +- [Other ways to write data](#other-ways-to-write-data) - [Next steps](#next-steps) ### What you'll need @@ -76,232 +75,100 @@ InfluxDB accepts the following precisions: _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 +## Quickly start collecting data -To write data into InfluxDB, use one of the following methods: +Familiarize yourself with querying, visualizing, and processing data in InfluxDB Cloud and InfluxDB OSS by collecting data right away. The following options are available: -- [User Interface](#user-interface) -- [influx CLI](#influx-cli) -- [InfluxDB API](#influxdb-api) +- [Demo data for InfluxDB Cloud](#demo-data-for-influxdb-cloud) +- [Quick Start for InfluxDB OSS](#quick-start-for-influxdb-oss) -### User Interface -To quickly start writing data, use the provided user interface. +## Demo data for InfluxDB Cloud +Use **InfluxDB Cloud** demo data buckets for quick and easy access to different +types of demo data that let you explore and familiarize yourself with InfluxDB Cloud. -1. Do one of the following: - - _**InfluxDB 2.0 OSS**_: - In your terminal, run `influxd` and then in your browser, go to the location - where you're hosting the UI (by default, **localhost:9999**). - - _**InfluxDB 2.0 Cloud**_: - In your browser, go to https://cloud2.influxdata.com/. -2. In the navigation menu on the left, select **Data** (**Load Data**) > **Buckets**. -3. Under the bucket you want to write data to, click **{{< icon "plus" >}} Add Data**. -4. Select from the following options: +- [Add a demo data bucket](#add-a-demo-data-bucket) +- [Explore demo data](#explore-demo-data) +- [View demo data dashboards](#view-demo-data-dashboards) + +{{% note %}} +#### Free to use and read-only +- InfluxDB Cloud demo data buckets are **free to use** and are **_not_ subject to + [Free Plan](/v2.0/account-management/pricing-plans/#free-plan) rate limits**. +- Demo data buckets are **read-only**. You cannot write data into demo data buckets. +{{% /note %}} + +## Demo data sets +Choose from the following demo data sets: + +- **Website Monitoring** + Explore, visualize, and monitor HTTP response metrics from InfluxData websites. + + +## Add a demo data bucket +1. In the navigation menu on the left, click **Data (Load Data)** > **Buckets**. + + {{< nav-icon "data" >}} + +2. Click **{{< icon "plus" >}} Add Demo Data**, and then select the demo data bucket to add. +3. The Demo Data bucket appears in your list of buckets. + +## Explore demo data +Use the [Data Explorer](https://v2.docs.influxdata.com/v2.0/visualize-data/explore-metrics/) +to query and visualize data in demo data buckets. + +In the navigation menu on the left, click **Explore (Data Explorer)**. + +{{< nav-icon "explore" >}} + +## View demo data dashboards +After adding a demo data bucket, view the pre-built dashboard specific to the demo data set: + +1. In the navigation menu on the left, click **Boards (Dashboards)**. + + {{< nav-icon "dashboards" >}} + +2. Click the name of the dashboard that corresponds to your demo data bucket. + +{{% note %}} +#### Other sample data sets +See [Sample data](/v2.0/write-data/sample-data) for more sample InfluxDB data sets. +{{% /note %}} + +## Quick Start for InfluxDB OSS + +Select **Quick Start** in the last step of the InfluxDB user interface's (UI) +[setup process](/v2.0/get-started/#set-up-influxdb) to quickly start collecting data with InfluxDB. +Quick Start creates a data scraper that collects metrics from the InfluxDB `/metrics` endpoint. +The scraped data provides a robust dataset of internal InfluxDB metrics that you can query, visualize, and process. + +### Use Quick Start to collect InfluxDB metrics +After [setting up InfluxDB v2.0](/v2.0/get-started/#set-up-influxdb), +the "Let's start collecting data!" page displays options for collecting data. +Click **Quick Start**. + +InfluxDB creates and configures a new [scraper](/v2.0/write-data/scrape-data/). +The target URL points to the `/metrics` HTTP endpoint of your local InfluxDB instance +(for example, `http://localhost:9999/metrics`), which outputs internal InfluxDB +metrics in the [Prometheus data format](https://prometheus.io/docs/instrumenting/exposition_formats/). +The scraper stores the scraped metrics in the bucket created during the +[initial setup process](/v2.0/get-started/#set-up-influxdb). + +{{% note %}} +Quick Start is only available in the last step of the setup process. +If you missed the Quick Start option, you can [manually create a scraper](/v2.0/write-data/scrape-data) +that scrapes data from the `/metrics` endpoint. +{{% /note %}} - - [Configure Telegraf Agent](#configure-telegraf-agent) - - [Line Protocol](#line-protocol) - - [Scrape Metrics](#scrape-metrics) --- -#### Configure Telegraf Agent - -To configure a Telegraf agent, see [Automatically create a Telegraf configuration](/v2.0/write-data/use-telegraf/auto-config/#create-a-telegraf-configuration). - ---- - -#### Line Protocol - -1. Select **Upload File** or **Enter Manually**. - - **Upload File:** - Select the time precision of your data. - Drag and drop the line protocol file into the UI or click to select the - file from your file manager. - - **Enter Manually:** - Select the time precision of your data. - Manually enter line protocol. -2. Click **Write Data**. - A message indicates whether data is successfully written to InfluxDB. -3. To add more data or correct line protocol, click **Previous**. -4. Click **Finish**. - ---- - -#### Scrape Metrics - -To scrape metrics, see [Create a scraper](/v2.0/write-data/scrape-data/manage-scrapers/create-a-scraper/#create-a-scraper-in-the-influxdb-ui). - -{{% cloud %}}{{< cloud-name >}} does not support scrapers. -{{% /cloud %}} - -### influx CLI - -From the command line, use the [`influx write` command](/v2.0/reference/cli/influx/write/) to write data to InfluxDB. -Include the following in your command: - -| Requirement | Include by | -|:----------- |:---------- | -| Organization | Use the `-o`,`--org`, or `--org-id` flags. | -| Bucket | Use the `-b`, `--bucket`, or `--bucket-id` flags. | -| Precision | Use the `-p`, `--precision` flag. | -| Authentication token | Set the `INFLUX_TOKEN` environment variable or use the `t`, `--token` flag. | -| Data | Write data using **line protocol** or **annotated CSV**. Pass a file with the `-f`, `--file` flag. | - -_See [Line protocol](/v2.0/reference/syntax/line-protocol/) and [Annotated CSV](/v2.0/reference/syntax/annotated-csv)_ - -#### Example influx write commands - -##### Write a single line of line protocol -```sh -influx write \ - -b bucketName \ - -o orgName \ - -p s \ - 'myMeasurement,host=myHost testField="testData" 1556896326' -``` - -##### Write line protocol from a file -```sh -influx write \ - -b bucketName \ - -o orgName \ - -p s \ - --format=lp - -f /path/to/line-protocol.txt -``` - -##### Write annotated CSV from a file -```sh -influx write \ - -b bucketName \ - -o orgName \ - -p s \ - --format=csv - -f /path/to/data.csv -``` - -### InfluxDB API - -Write data to InfluxDB using an HTTP request to the InfluxDB API `/write` endpoint. -Use the `POST` request method and include the following in your request: - -| Requirement | Include by | -|:----------- |:---------- | -| Organization | Use the `org` query parameter in your request URL. | -| Bucket | Use the `bucket` query parameter in your request URL. | -| Precision | Use the `precision` query parameter in your request URL. | -| Authentication token | Use the `Authorization: Token` header. | -| Line protocol | Pass as plain text in your request body. | - -#### 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 _(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 -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 >}} - -_For information about **InfluxDB API response codes**, see -[InfluxDB API Write documentation](/v2.0/api/#operation/PostWrite)._ - -### Third-party technologies - -A number of third-party technologies can be configured to send line protocol directly to InfluxDB. - -If you're using any of the following technologies, check out the handy links below to configure these technologies to write data to InfluxDB (**no additional software to download or install**): - -- (Write metrics only) [Vector 0.9 or later](#configure-vector) - -- [Apache NiFi 1.8 or later](#configure-apache-nifi) - -- [OpenHAB 3.0 or later](#configure-openhab) - -- [Apache JMeter 5.2 or later](#configure-apache-jmeter) - -- [FluentD 1.x or later](#configure-fluentd) - -#### Configure Vector - -1. On the Vector.dev docs site, see the [InfluxDB Metrics Sink](https://vector.dev/docs/reference/sinks/influxdb_metrics/) page. -2. Under **Configuration**, click **v2** to view configuration settings. -3. Scroll down to [How It Works](https://vector.dev/docs/reference/sinks/influxdb_metrics/#how-it-works) for more detail. - -#### Configure Apache NiFi - -See the _[InfluxDB Processors for Apache NiFi Readme](https://github.com/influxdata/nifi-influxdb-bundle#influxdb-processors-for-apache-nifi)_ for details. - -#### Configure OpenHAB - -See the _[InfluxDB Persistence Readme](https://github.com/openhab/openhab-addons/tree/master/bundles/org.openhab.persistence.influxdb)_ for details. - -#### Configure Apache JMeter - - - -To configure Apache JMeter, complete the following steps in InfluxDB and JMeter. - -##### In InfluxDB - -1. [Find the name of your organization](https://v2.docs.influxdata.com/v2.0/organizations/view-orgs/) (needed to create a bucket and token). -2. [Create a bucket using the influx CLI](https://v2.docs.influxdata.com/v2.0/organizations/buckets/create-bucket/#create-a-bucket-using-the-influx-cli) and name it `jmeter`. -3. [Create a token](https://v2.docs.influxdata.com/v2.0/security/tokens/create-token/). - -##### In JMeter - -1. Create a [Backend Listener](https://jmeter.apache.org/usermanual/component_reference.html#Backend_Listener) using the _InfluxDBBackendListenerClient_ implementation. -2. In the **Backend Listener implementation** field, enter _org.apache.jmeter.visualizers.backend.influxdb.influxdbBackendListenerClient_ -3. Under **Parameters**, specify the following: - - **influxdbMetricsSender**: _org.apache.jmeter.visualizers.backend.influxdb.HttpMetricsSender_ - - **influxdbUrl**: _http://localhost:9999/api/v2/write?org=my-org&bucket=jmeter_ (include the bucket and org you created in InfluxDB) - - **application**: _InfluxDB2_ - - **influxdbToken**: _my-token_ (include the token you created in InfluxDB) - - Include additional parameters as needed. -4. Click **Add** to add the _InfluxDBBackendListenerClient_ implementation. - -#### Configure FluentD - -See the _[influxdb-plugin-fluent Readme](https://github.com/influxdata/influxdb-plugin-fluent)_ for details. - ## Other ways to write data -{{< children >}} +There are multiple options for writing data into InfluxDB, including both no-code and developer solutions. -### InfluxDB client libraries - -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. + - [No-code solutions](/v2.0/write-data/no-code) + - [Development tools](/v2.0/write-data/development-tools) --- diff --git a/content/v2.0/write-data/quick-start.md b/content/v2.0/write-data/quick-start.md deleted file mode 100644 index 86676aa11..000000000 --- a/content/v2.0/write-data/quick-start.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -title: Quick start to data collection -list_title: Quick start -description: > - Start collecting data right away with demo data or scrapers. -aliases: - - /v2.0/collect-data/scraper-quickstart - - /v2.0/collect-data/quick-start - - /v2.0/write-data/sample-data/demo-data/ -menu: - v2_0: - name: Quick start - parent: Write data -weight: 101 ---- -Familiarize yourself with querying, visualizing, and processing data in InfluxDB Cloud and InfluxDB OSS by collecting data right away. The following options are available: - -- [Demo data for InfluxDB Cloud](#demo-data-for-influxdb-cloud) -- [Quick Start for InfluxDB OSS](#quick-start-for-influxdb-oss) - - -## Demo data for InfluxDB Cloud -Use **InfluxDB Cloud** demo data buckets for quick and easy access to different -types of demo data that let you explore and familiarize yourself with InfluxDB Cloud. - -- [Add a demo data bucket](#add-a-demo-data-bucket) -- [Explore demo data](#explore-demo-data) -- [View demo data dashboards](#view-demo-data-dashboards) - -{{% note %}} -#### Free to use and read-only -- InfluxDB Cloud demo data buckets are **free to use** and are **_not_ subject to - [Free Plan](/v2.0/account-management/pricing-plans/#free-plan) rate limits**. -- Demo data buckets are **read-only**. You cannot write data into demo data buckets. -{{% /note %}} - -## Demo data sets -Choose from the following demo data sets: - -- **Website Monitoring** - Explore, visualize, and monitor HTTP response metrics from InfluxData websites. - - -## Add a demo data bucket -1. In the navigation menu on the left, click **Data (Load Data)** > **Buckets**. - - {{< nav-icon "data" >}} - -2. Click **{{< icon "plus" >}} Add Demo Data**, and then select the demo data bucket to add. -3. The Demo Data bucket appears in your list of buckets. - -## Explore demo data -Use the [Data Explorer](https://v2.docs.influxdata.com/v2.0/visualize-data/explore-metrics/) -to query and visualize data in demo data buckets. - -In the navigation menu on the left, click **Explore (Data Explorer)**. - -{{< nav-icon "explore" >}} - -## View demo data dashboards -After adding a demo data bucket, view the pre-built dashboard specific to the demo data set: - -1. In the navigation menu on the left, click **Boards (Dashboards)**. - - {{< nav-icon "dashboards" >}} - -2. Click the name of the dashboard that corresponds to your demo data bucket. - -{{% note %}} -#### Other sample data sets -See [Sample data](/v2.0/write-data/sample-data) for more sample InfluxDB data sets. -{{% /note %}} - -## Quick Start for InfluxDB OSS - -Select **Quick Start** in the last step of the InfluxDB user interface's (UI) -[setup process](/v2.0/get-started/#set-up-influxdb) to quickly start collecting data with InfluxDB. -Quick Start creates a data scraper that collects metrics from the InfluxDB `/metrics` endpoint. -The scraped data provides a robust dataset of internal InfluxDB metrics that you can query, visualize, and process. - -### Use Quick Start to collect InfluxDB metrics -After [setting up InfluxDB v2.0](/v2.0/get-started/#set-up-influxdb), -the "Let's start collecting data!" page displays options for collecting data. -Click **Quick Start**. - -InfluxDB creates and configures a new [scraper](/v2.0/write-data/scrape-data/). -The target URL points to the `/metrics` HTTP endpoint of your local InfluxDB instance -(for example, `http://localhost:9999/metrics`), which outputs internal InfluxDB -metrics in the [Prometheus data format](https://prometheus.io/docs/instrumenting/exposition_formats/). -The scraper stores the scraped metrics in the bucket created during the -[initial setup process](/v2.0/get-started/#set-up-influxdb). - -{{% note %}} -Quick Start is only available in the last step of the setup process. -If you missed the Quick Start option, you can [manually create a scraper](/v2.0/write-data/scrape-data) -that scrapes data from the `/metrics` endpoint. -{{% /note %}} - -## Next steps -Now with data to explore, you can: - -- [Query data in InfluxDB](/v2.0/query-data) -- [Process data with InfluxDB tasks](/v2.0/process-data) -- [Visualize data with the InfluxDB UI](/v2.0/visualize-data)