### Run the example browser application Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/reference/client-libraries/v2/javascript/browser.md Start the example application using npm. This command builds and serves the browser example, making it accessible at http://localhost:3001/examples/index.html. ```sh npm run browser ``` -------------------------------- ### Install the Go client library Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/reference/client-libraries/v3/go/_index.md Use `go get` to install the v2 of the `influxdb3-go` client library. ```shell go get github.com/InfluxCommunity/influxdb3-go/v2 ``` -------------------------------- ### Install Dependencies and Start Hugo Server Source: https://github.com/influxdata/docs-v2/blob/master/telegraf-build/README.md Installs Node.js dependencies using yarn and starts the Hugo server for previewing Telegraf documentation locally. Assumes the current directory is the docs-v2 directory within telegraf-build. ```bash cd ~/Documents/github/docs-v2/telegraf-build/repos/docs-v2 # Install dependencies yarn install # Start Hugo server npx hugo serve ``` -------------------------------- ### Start Superset Docker Containers Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-serverless/process-data/visualize/superset.md Launch the Superset Docker containers using the docker-compose up command with the specified setup file. This command starts the Superset application. ```sh docker-compose -f docker-compose-non-dev.yml up ``` -------------------------------- ### Quick Start LLM Markdown Generation Source: https://github.com/influxdata/docs-v2/blob/master/DOCS-TESTING.md Installs dependencies, builds the project, and generates LLM-friendly Markdown for a specific path. ```bash # Prerequisites (run once) yarn install yarn build:ts npx hugo --quiet # Generate Markdown node scripts/html-to-markdown.js --path influxdb3/core/get-started --limit 10 # Validate generated Markdown node cypress/support/run-e2e-specs.js \ --spec "cypress/e2e/content/markdown-content-validation.cy.js" ``` -------------------------------- ### Setup Python virtual environment Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/get-started/write.md These commands guide you through creating and activating a Python virtual environment for your project. This ensures that project dependencies are isolated. ```bash mkdir -p influxdb_py_client && cd influxdb_py_client ``` ```bash python -m venv envs/virtual-env ``` ```bash source ./envs/virtual-env/bin/activate ``` ```bash pip install influxdb3-python ``` ```bash touch write.py ``` -------------------------------- ### Custom Template for InfluxDB 3 Core Source: https://github.com/influxdata/docs-v2/blob/master/layouts/LLMS-TXT-README.md Example of a custom llms.txt template for InfluxDB 3 Core. This template defines a custom curated section with 'Getting Started' and 'Guides' links. ```go-html-template # InfluxDB 3 Core > InfluxDB 3 Core is the open source, high-performance time series database. {{- /* Custom curated sections */ -}} ## Getting Started - [Install InfluxDB 3 Core](/influxdb3/core/install/): Installation guide - [Quick start](/influxdb3/core/get-started/): Get started in 5 minutes ## Guides - [Write data](/influxdb3/core/write-data/): Write data guide - [Query with SQL](/influxdb3/core/query-data/sql/): SQL query guide ``` -------------------------------- ### Navigate to examples directory Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/reference/client-libraries/v2/javascript/browser.md Change the current directory to the examples folder within the cloned repository. ```js cd examples ``` -------------------------------- ### Get InfluxDB cluster pods Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/clustered/admin/licensing.md Check that database pods start up and are in the Running state after installing your license. ```bash kubectl get pods -l app=iox --namespace influxdb ``` -------------------------------- ### Start Telegraf Controller Windows Service Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/controller/install/_index.md Starts the Telegraf Controller Windows service after it has been installed. ```powershell nssm start TelegrafController ``` -------------------------------- ### Create Documentation - Example Usage Source: https://github.com/influxdata/docs-v2/blob/master/scripts/docs-cli/README.md Demonstrates setting the DOCS_EDITOR environment variable and creating/opening documentation files. ```bash export DOCS_EDITOR=nano ``` ```bash docs create drafts/feature.md --products influxdb3_core --open ``` ```bash docs create drafts/feature.md --products influxdb3_core --open --wait ``` -------------------------------- ### Install and run Go client Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/get-started/query.md Installs necessary packages, builds, and runs the Go program to execute a query and print results. ```sh go mod tidy && go run influxdb_go_client ``` -------------------------------- ### Create a table with custom partitioning Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxctl/table/create.md This example demonstrates creating a table with a custom partition template. It partitions by the 'room' and 'sensor-type' tags, buckets 'customerID' tag values into 1000 buckets, and uses '%Y-%m-%d' as the time format. Ensure you provide a time format when using custom partitioning. ```bash influxctl table create \ --template-tag room \ --template-tag sensor-type \ --template-tag-bucket customerID,1000 \ --template-timeformat '%Y-%m-%d' \ DATABASE_NAME \ TABLE_NAME ``` -------------------------------- ### Example Workflow: Create, Write, Query Source: https://github.com/influxdata/docs-v2/blob/master/helper-scripts/influxdb3-plugins/README.md Demonstrates a typical workflow: creating a trigger, writing test data to a database, and querying the results. ```bash # Create the trigger influxdb3 create trigger \ --database mydb \ --plugin-filename gh:influxdata/[plugin]/[plugin].py \ --trigger-spec "[spec]" \ --trigger-arguments '[arguments]' \ trigger_name # Write test data influxdb3 write \ --database mydb \ "measurement,tag=value field=1" # Query results influxdb3 query \ --database mydb \ "SELECT * FROM result_measurement" ``` -------------------------------- ### Start Telegraf Agent Source: https://github.com/influxdata/docs-v2/blob/master/content/platform/monitoring/influxdata-platform/external-monitor-setup.md Start the Telegraf agent using your custom configuration file after installation and configuration are complete. ```bash telegraf -config path/to/telegraf.conf ``` -------------------------------- ### Initialize Go Project Directory Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb3-write-guides/client-libraries.md Create a project directory and initialize a Go module. Ensure Go 1.13 or later is installed. ```sh mkdir iot-starter-go && cd $_ go mod init iot-starter ``` -------------------------------- ### Create an organization with a description Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb-v2/reference/cli/influx/org/create.md This example shows how to create an organization and provide a descriptive text for it. ```bash influx org create \ --name example-org \ --description "Example organization description" ``` -------------------------------- ### Starting Telegraf with Selectors Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/configuration.md Example command to start Telegraf with multiple selectors, specifying configuration files and directories. ```console telegraf --config config.conf --config-directory directory/ \ --select="app=payments;region=us-*" \ --select="env=prod" \ --watch-config --print-plugin-config-source=true ``` -------------------------------- ### Libvirt Example Configuration Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/input-plugins/libvirt.md An example configuration for the Libvirt input plugin, specifying domain names, connection URI, metrics, and additional statistics. ```toml [[inputs.libvirt]] domain_names = ["ubuntu_20"] libvirt_uri = "qemu:///system" libvirt_metrics = ["state", "interface"] additional_statistics = ["vcpu_mapping"] ``` -------------------------------- ### Run InfluxDB setup interactively Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb-v2/reference/cli/influx/setup/_index.md Use this command to start the interactive InfluxDB setup process. It will prompt you for all required information. ```bash influx setup ``` -------------------------------- ### MQTT Consumer Configuration Example Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/input-plugins/mqtt_consumer.md This is a basic configuration example for the MQTT Consumer input plugin. It shows how to connect to an MQTT broker, subscribe to topics, and specify the data format. ```toml [[inputs.mqtt_consumer]] servers = ["tcp://localhost:1883"] topics = ["topicA", "topicB"] data_format = "json" ``` -------------------------------- ### Example ParquetExec node Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/analyze-query-plan.md An example of a ParquetExec node, which is a common starting point in InfluxDB query plans for retrieving and scanning data. ```text ParquetExec: file_groups={...}, projection=[city, min_temp, time] ``` -------------------------------- ### Update Quick Start Tag in Data API Specs Source: https://github.com/influxdata/docs-v2/blob/master/docs/plans/2025-02-06-clustered-cloud-dedicated-api-structure-design.md Instructions for updating the Quick Start section in the Data API OpenAPI specs to cover both Data and Management API getting started flows. ```bash Quick start in both v2/ref.yml files: - Cover both Data and Management API getting started flow - Show management token creation, then database/token setup, then write/query ``` -------------------------------- ### Example table output for cluster information Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/admin/clusters/get.md This is an example of the default table output from the `influxctl cluster get` command, showing basic cluster details. ```sh +-------+----------------------------------------------------+ | id | X0x0xxx0-0XXx-000x-00x0-0X000Xx00000 | | name | Internal - Cluster 1 | | state | ready | | url | X0x0xxx0-0XXx-000x-00x0-0X000Xx00000.a.influxdb.io | +-------+----------------------------------------------------+ ``` -------------------------------- ### vSphere Input Plugin Configuration Example Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/input-plugins/vsphere.md This is a basic configuration example for the vSphere input plugin. Ensure you replace placeholder values with your actual vCenter credentials and host information. ```toml [inputs.vsphere] ## vCenter Server address server = "your-vcenter-server.local" ## vCenter username and password username = "your-username" password = "your-password" ## Optional: Specify a specific datacenter to monitor # datacenter = "your-datacenter" ## Optional: Set to true to collect cluster metrics # collect_cluster_metrics = true ## Optional: Concurrency settings # collect_concurrency = 4 # discover_concurrency = 4 ## Optional: Historical interval in seconds # historical_interval = 300 ## Optional: Ignore SSL certificate errors # insecure_ssl = false ## Optional: Specify a list of ESXi hosts to monitor directly # esxi_hosts = [ # "esxi-host-1.local", # "esxi-host-2.local" # ] ``` -------------------------------- ### Start Hugo Server with Docker Compose Source: https://github.com/influxdata/docs-v2/blob/master/README.md Uses Docker Compose to start the Hugo server in development mode. This is an alternative to installing Node.js and Hugo directly. ```sh docker compose up local-dev ``` -------------------------------- ### Default Configuration (Equivalent to Basic) Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/input-plugins/intel_powerstat.md This configuration is equivalent to the basic setup, collecting default processor package metrics and no per-CPU metrics. It omits the `cpu_metrics` key. ```toml [[inputs.intel_powerstat]] ``` -------------------------------- ### System Input Plugin Example Output Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/input-plugins/system.md Example output showing system metrics collected by the plugin, including load averages, user counts, CPU counts, and uptime. ```text system,host=tyrion load1=3.72,load5=2.4,load15=2.1,n_users=3i,n_cpus=4i,n_physical_cpus=2i 1483964144000000000 system,host=tyrion uptime=1249632i 1483964144000000000 system,host=tyrion uptime_format="14 days, 11:07" 1483964144000000000 ``` -------------------------------- ### Quick Puppeteer Setup Test Script Source: https://github.com/influxdata/docs-v2/blob/master/scripts/puppeteer/SETUP.md A Node.js script to verify your Puppeteer setup by launching a browser, navigating, taking a screenshot, and getting the page title. Save this as `test-puppeteer-setup.js`. ```javascript #!/usr/bin/env node /** * Quick test to verify Puppeteer setup */ import { launchBrowser, navigateToPage, takeScreenshot } from './utils/puppeteer-helpers.js'; async function test() { console.log('\n🧪 Testing Puppeteer Setup\n'); let browser; try { // 1. Launch browser console.log('1. Launching browser...'); browser = await launchBrowser({ headless: true }); console.log(' āœ“ Browser launched\n'); // 2. Navigate to home page console.log('2. Navigating to home page...'); const page = await navigateToPage(browser, '/'); console.log(' āœ“ Page loaded\n'); // 3. Take screenshot console.log('3. Taking screenshot...'); await takeScreenshot(page, 'test-screenshot.png'); console.log(' āœ“ Screenshot saved\n'); // 4. Get page title console.log('4. Getting page title...'); const title = await page.title(); console.log(` āœ“ Title: "${title}"\n`); console.log('āœ… All tests passed!\n'); console.log('Puppeteer is set up correctly and ready to use.\n'); } catch (error) { console.error('\nāŒ Test failed:', error.message); console.error('\nSee SETUP.md for troubleshooting steps.\n'); process.exit(1); } finally { if (browser) { await browser.close(); } } } test(); ``` -------------------------------- ### Install Documentation CLI Source: https://github.com/influxdata/docs-v2/blob/master/scripts/docs-cli/README.md Installs the documentation CLI tools by creating a symlink to the main entry point. ```bash yarn install ``` -------------------------------- ### Create project directory and navigate Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/clustered/get-started/query.md Creates a new directory for your project and changes the current directory to it. This is a prerequisite for setting up your project environment. ```sh mkdir influx3-query-example && cd $_ ``` -------------------------------- ### selector_first Query Example Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/sql-reference/functions/selector.md Demonstrates how to use the `selector_first` function to get the first precipitation value and its timestamp for each location. This example uses the NOAA Bay Area weather sample data. ```sql SELECT location, selector_first(precip, time)['time'] AS time, selector_first(precip, time)['value'] AS first_precip FROM (SELECT * FROM weather WHERE precip > 0) GROUP BY location ``` -------------------------------- ### Start InfluxQL shell with `influx` CLI Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb-v2/get-started/query.md Use the `influx v1 shell` command to start an InfluxQL shell for querying InfluxDB using InfluxQL. Ensure you have the `influx` CLI downloaded, installed, and configured. ```bash influx v1 shell ``` -------------------------------- ### Example JSON output for cluster information Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/admin/clusters/get.md This is an example of the JSON output from the `influxctl cluster get --format json` command, providing comprehensive cluster details including creation date and account ID. ```json { "account_id": "0x0x0x00-0Xx0-00x0-x0X0-00x00XX0Xx0X", "cluster_id": "X0x0xxx0-0XXx-000x-00x0-0X000Xx00000", "name": "Internal - Cluster 1", "url": "X0x0xxx0-0XXx-000x-00x0-0X000Xx00000.a.influxdb.io", "state": "ready", "created_at": { "seconds": 1686670941, "nanos": 520023000 }, "category": 1 } ``` -------------------------------- ### Initialize Node.js Project Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb3-write-guides/client-libraries.md Create a project directory and initialize a Node.js project using npm. Ensure Node.js is installed. ```sh mkdir -p iot-starter-js && cd $_ npm init ``` -------------------------------- ### Execute InfluxQL query using GET Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb-v2/query-data/execute-queries/influx-api.md This example demonstrates executing an InfluxQL query using an HTTP GET request. The query and database name are provided as URL-encoded query parameters. Basic authentication with a token is used. ```APIDOC ## GET /query ### Description Executes an InfluxQL query using an HTTP GET request. Results are returned in JSON format. ### Method GET ### Endpoint /query ### Query Parameters - **q** (string) - Required - The InfluxQL query to execute. - **db** (string) - Required - The name of the bucket to query. - **u** (string) - Ignored - Typically set to 'ignored' for token authentication. - **p** (string) - Required - The API token for authentication. ### Request Example ```bash curl --get "http://{{< influxdb/host >}}/query" \ --header "Accept: application/json" \ --data-urlencode "q=SELECT * FROM home WHERE time > now() - 1h" \ --data-urlencode "db=BUCKET_NAME" \ --data-urlencode "u=ignored" \ --data-urlencode "p=API_TOKEN" ``` ### Response #### Success Response (200) InfluxDB returns the query results in JSON format. ``` -------------------------------- ### Initialize Go module and install dependencies Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/write-data/best-practices/optimize-writes.md Initialize a new Go module for your project and install necessary dependencies. This is a prerequisite for running Go code that utilizes external libraries. ```bash go mod init processlp go mod tidy ``` -------------------------------- ### Sample Configuration Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/input-plugins/win_perf_counters.md A basic TOML configuration for the Windows Performance Counters input plugin. ```toml # Input plugin to counterPath Performance Counters on Windows operating systems ``` -------------------------------- ### Complete Node.js InfluxDB Query Example Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb-v2/api-guide/client-libraries/nodejs/query.md A complete Node.js script demonstrating how to query InfluxDB. This example includes client setup, Flux query execution, and result processing. Ensure your InfluxDB environment variables are set before running. ```javascript import { InfluxDB } from '@influxdata/influxdb-client' const url = process.env.INFLUX_URL const token = process.env.INFLUX_TOKEN const org = process.env.INFLUX_ORG const queryApi = new InfluxDB({ url, token }).getQueryApi(org) const fluxQuery = 'from(bucket: "YOUR_BUCKET") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "cpu") |> mean()' // Example query, replace with your own const observer = { next: (row, tableMeta) => { const o = tableMeta.toObject(row) console.log(JSON.stringify(o)) }, error: (err) => { console.error(err) console.log('\nError') }, complete: () => { console.log('\nQuery completed') }, } queryApi.queryRows(fluxQuery, observer) ``` -------------------------------- ### Create a database using default settings Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb3-cli/create/database.md Creates a database using default connection settings and any configured environment variables. ```bash influxdb3 create database DATABASE_NAME ``` -------------------------------- ### Get InfluxDB 3 Version with CLI Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/identify-version.md Use the influxdb3 command-line interface to check the installed InfluxDB 3 version. ```bash influxdb3 --version ``` -------------------------------- ### Start InfluxDB with CLI Option Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/enterprise/admin/tokens/resource/preconfigured.md Use the `--permission-tokens-file` option with the `influxdb3 serve` command to load preconfigured tokens at server startup. ```bash influxdb3 serve \ # ... \ --permission-tokens-file path/to/admin-token.json ``` -------------------------------- ### Complete InfluxDB Write Script Example Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/reference/client-libraries/v2/go.md A complete Go program demonstrating how to initialize the InfluxDB client, create a data point, write it to the database, and close the client. ```go package main import ( "context" "fmt" "time" "github.com/influxdata/influxdb-client-go/v2" ) func main() { bucket := "DATABASE_NAME" org := "ignored" token := "DATABASE_TOKEN" // Store the URL of your InfluxDB instance url := "https://{{< influxdb/host >}}" // Create new client with default option for server url authenticate by token client := influxdb2.NewClient(url, token) // User blocking write client for writes to desired bucket writeAPI := client.WriteAPIBlocking(org, bucket) // Create point using full params constructor p := influxdb2.NewPoint("stat", map[string]string{"unit": "temperature"}, map[string]interface{}{"avg": 24.5, "max": 45}, time.Now()) // Write point immediately writeAPI.WritePoint(context.Background(), p) // Ensures background processes finishes client.Close() } ``` -------------------------------- ### Line Protocol Comment Example Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb-v2/reference/syntax/line-protocol.md Demonstrates how to add comments to InfluxDB Line Protocol data by starting a line with a hash symbol (#). ```sh # This is a comment myMeasurement fieldKey="string value" 1556813561098000000 ``` -------------------------------- ### Telegraf Windows Service Commands Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/install.md A reference for common Telegraf Windows service management commands, including install, uninstall, start, and stop. ```bash telegraf.exe --service install telegraf.exe --service uninstall telegraf.exe --service start telegraf.exe --service stop ``` -------------------------------- ### Telegraf Agent Checking for Configuration Updates Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/controller/reference/architecture.md Example of starting a Telegraf agent with an option to periodically check for configuration updates from a specified URL. ```bash telegraf \ --config http://localhost:8888/api/configs/xxxxxx/toml \ --config-url-watch-interval 1h ``` -------------------------------- ### Create a database with custom partitioning options Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/clustered/admin/databases/create.md Create a database with advanced custom partitioning configurations. This includes specifying template tags, tag buckets with limits, and a custom time format for partitioning. ```sh influxctl database create \ --retention-period 30d \ --max-tables 500 \ --max-columns 250 \ --template-tag tag1 \ --template-tag tag2 \ --template-tag-bucket tag3,100 \ --template-tag-bucket tag4,300 \ --template-timeformat '%Y-%m-%d' \ DATABASE_NAME ``` -------------------------------- ### Configure Environment Variables Example Source: https://github.com/influxdata/docs-v2/blob/master/DOCS-TESTING.md Copy the example environment file and rename it for product-specific testing. Assign InfluxDB credentials and cluster-specific IDs. ```bash # Example locations ./content/influxdb/cloud-dedicated/.env.test ./content/influxdb3/clustered/.env.test ``` -------------------------------- ### Get all keys from a map using map_keys Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/sql-reference/functions/map.md This example shows how to use the `map_keys` function to retrieve a list of all keys present in a given map. ```sql SELECT map_keys(map {'a': 1, 'b': NULL, 'c': 3}) AS map_keys ``` -------------------------------- ### Get InfluxDB Version using CLI Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb-v2/reference/faq.md Execute the `influxd version` command in your terminal to display the installed InfluxDB version and build information. ```bash $ influxd version InfluxDB {{< latest-patch >}} (git: x0x000xx0x) build_date: YYYY-MM-DDThh:mm:ssZ ``` -------------------------------- ### File statistics Example Output Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/input-plugins/filestat.md Example output showing metrics for file existence, size, and modification time. Metrics include tags for the file path and host. ```text filestat,file=/tmp/foo/bar,host=tyrion exists=0i 1507218518192154351 filestat,file=/Users/sparrc/ws/telegraf.conf,host=tyrion exists=1i,size=47894i,modification_time=1507152973123456789i 1507218518192154351 ``` -------------------------------- ### Create Documentation - From Draft Source: https://github.com/influxdata/docs-v2/blob/master/scripts/docs-cli/README.md Scaffolds new documentation pages from a draft file, specifying the product(s) it belongs to. ```bash docs create --products ``` -------------------------------- ### Get the last record from a table Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb-v2/query-data/flux/first-last.md Returns the last non-null record in an input table. The example shows the output when applied to a sample dataset. ```flux |> last() ``` -------------------------------- ### Create Content and Frontmatter with AI (Copilot) Source: https://github.com/influxdata/docs-v2/blob/master/content/create.md Generate documentation content and frontmatter by piping the output of `docs create` to Copilot, specifying products to preselect. ```bash npx docs create .context/drafts/"Upgrading Enterprise 3 (draft).md" \ --products "influxdb3_enterprise,influxdb3_core" | \ copilot --prompt --allow-all-tools ``` -------------------------------- ### Get the first record from a table Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb-v2/query-data/flux/first-last.md Returns the first non-null record in an input table. The example shows the output when applied to a sample dataset. ```flux |> first() ``` -------------------------------- ### Set up Go Project for InfluxDB 3 Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-dedicated/write-data/line-protocol/client-libraries.md Installs the InfluxDB 3 Go client library and initializes a Go module. Requires Go 1.13 or later. ```sh mkdir iot-starter-go && cd $_ ``` ```sh go mod init iot-starter ``` ```sh go get github.com/InfluxCommunity/influxdb3-go/v2 ``` -------------------------------- ### Telegraf Input Configuration Example Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/configuration.md This example demonstrates collecting per-CPU data, dropping fields starting with 'time_', tagging measurements with 'dc="denver-1"', and outputting to InfluxDB. It shows the use of global_tags, agent interval, output configuration, and input configuration with fielddrop. ```toml [global_tags] dc = "denver-1" [agent] interval = "10s" # OUTPUTS [[outputs.influxdb]] url = "http://192.168.59.103:8086" # required. database = "telegraf" # required. precision = "1s" # INPUTS [[inputs.cpu]] percpu = true totalcpu = false # filter all fields beginning with 'time_' fielddrop = ["time_*"] ``` -------------------------------- ### PostgreSQL Input Plugin Example Output Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/input-plugins/postgresql.md Sample output demonstrating the metrics collected by the PostgreSQL plugin. ```text postgresql,db=postgres_global,server=dbname\=postgres\ host\=localhost\ port\=5432\ statement_timeout\=10000\ user\=postgres tup_fetched=1271i,tup_updated=5i,session_time=1451414320768.855,xact_rollback=2i,conflicts=0i,blk_write_time=0,temp_bytes=0i,datid=0i,sessions_fatal=0i,tup_returned=1339i,sessions_abandoned=0i,blk_read_time=0,blks_read=88i,idle_in_transaction_time=0,sessions=0i,active_time=0,tup_inserted=24i,tup_deleted=0i,temp_files=0i,numbackends=0i,xact_commit=4i,sessions_killed=0i,blks_hit=5616i,deadlocks=0i 1672399790000000000 postgresql,db=postgres,host=oss_cluster_host,server=dbname\=postgres\ host\=localhost\ port\=5432\ statement_timeout\=10000\ user\=postgres conflicts=0i,sessions_abandoned=2i,active_time=460340.823,tup_returned=119382i,tup_deleted=0i,blk_write_time=0,xact_commit=305i,blks_hit=16358i,deadlocks=0i,sessions=12i,numbackends=1i,temp_files=0i,xact_rollback=5i,sessions_fatal=0i,datname="postgres",blk_read_time=0,idle_in_transaction_time=0,temp_bytes=0i,tup_inserted=3i,tup_updated=0i,blks_read=299i,datid=5i,session_time=469056.613,sessions_killed=0i,tup_fetched=5550i 1672399790000000000 postgresql,db=template1,host=oss_cluster_host,server=dbname\=postgres\ host\=localhost\ port\=5432\ statement_timeout\=10000\ user\=postgres active_time=0,idle_in_transaction_time=0,blks_read=1352i,sessions_abandoned=0i,tup_fetched=28544i,session_time=0,sessions_killed=0i,temp_bytes=0i,tup_returned=188541i,xact_commit=1168i,blk_read_time=0,sessions_fatal=0i,datid=1i,datname="template1",conflicts=0i,xact_rollback=0i,numbackends=0i,deadlocks=0i,sessions=0i,tup_inserted=17520i,temp_files=0i,tup_updated=743i,blk_write_time=0,blks_hit=99487i,tup_deleted=34i 1672399790000000000 postgresql,db=template0,host=oss_cluster_host,server=dbname\=postgres\ host\=localhost\ port\=5432\ statement_timeout\=10000\ user\=postgres sessions=0i,datid=4i,tup_updated=0i,sessions_abandoned=0i,blk_write_time=0,numbackends=0i,blks_read=0i,blks_hit=0i,sessions_fatal=0i,temp_files=0i,deadlocks=0i,conflicts=0i,xact_commit=0i,xact_rollback=0i,session_time=0,datname="template0",tup_returned=0i,tup_inserted=0i,idle_in_transaction_time=0,tup_fetched=0i,active_time=0,temp_bytes=0i,tup_deleted=0i,blk_read_time=0,sessions_killed=0i 1672399790000000000 postgresql,db=postgres,host=oss_cluster_host,server=dbname\=postgres\ host\=localhost\ port\=5432\ statement_timeout\=10000\ user\=postgres buffers_clean=0i,buffers_alloc=426i,checkpoints_req=1i,buffers_checkpoint=50i,buffers_backend_fsync=0i,checkpoint_write_time=5053,checkpoints_timed=26i,checkpoint_sync_time=26,maxwritten_clean=0i,buffers_backend=9i 1672399790000000000 ``` -------------------------------- ### CLI Usage Examples Source: https://github.com/influxdata/docs-v2/blob/master/docs/plans/2026-02-17-api-clean-regeneration-design.md Demonstrates how to use the `generate-openapi-articles.js` script with different flags for cleaning and regeneration. ```bash # Default: clean and regenerate all products node generate-openapi-articles.js # Clean and regenerate specific product node generate-openapi-articles.js influxdb3_core # Preview what would be deleted node generate-openapi-articles.js --dry-run # Preserve existing files (legacy behavior) node generate-openapi-articles.js --no-clean ``` -------------------------------- ### Upgrade InfluxDB using systemctl Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/influxdb3-admin/upgrade.md Steps to stop, install, and start InfluxDB using systemctl. Includes commands to verify the version and check node health. ```bash # 1. Stop the service sudo systemctl stop influxdb3 # 2. Install the new version # Follow the installation instructions for your platform: # https://docs.influxdata.com/influxdb3/enterprise/install/ # 3. Start the service sudo systemctl start influxdb3 # 4. Verify the version influxdb3 --version # 5. Check the node's health influxdb3 query \ --database _internal \ --token ADMIN_TOKEN \ "SELECT * FROM system.queries LIMIT 5" ``` -------------------------------- ### SQL Query with last_value() to Get Last Temperature Source: https://github.com/influxdata/docs-v2/blob/master/content/shared/sql-reference/functions/aggregate.md This example uses the last_value() function to find the last recorded maximum temperature for each location, ordered by time. ```sql SELECT location, last_value(temp_max ORDER BY time) AS temp_max_last_value FROM weather GROUP BY location ``` -------------------------------- ### Example Processes Plugin Output Source: https://github.com/influxdata/docs-v2/blob/master/content/telegraf/v1/input-plugins/processes.md Sample output demonstrating the metrics collected by the processes input plugin, including counts for various process states. ```text processes blocked=8i,running=1i,sleeping=265i,stopped=0i,total=274i,zombie=0i,dead=0i,paging=0i,total_threads=687i 1457478636980905042 ``` -------------------------------- ### Start Hugo Development Server Source: https://github.com/influxdata/docs-v2/blob/master/scripts/puppeteer/SETUP.md Start the Hugo development server to serve your documentation locally. This is a prerequisite for testing screenshots. ```bash # Start Hugo development server npx hugo server ``` -------------------------------- ### Migration Task Configuration Example Source: https://github.com/influxdata/docs-v2/blob/master/content/influxdb3/cloud-serverless/guides/migrate-data/migrate-tsm-to-serverless.md This is an example of a Flux task configuration for migrating data from InfluxDB Cloud (TSM) to InfluxDB Cloud Serverless. It includes essential parameters like task interval, migration start and stop times, batch settings, source and destination buckets, and API credentials. ```flux import "contrib/toml" task = { id: "migration-task", every: 1h, cron: "@every 1h", name: "TSM to Serverless Migration", } migration = { start: 2023-01-01T00:00:00Z, stop: now(), batchInterval: 1h, batchBucket: "_migration_metadata", sourceBucket: "my-tsm-bucket", destinationHost: "https://us-west-2-cloud-serverless.influxdb.com", destinationOrg: "my-serverless-org", destinationToken: await secret("INFLUXDB_SERVERLESS_TOKEN"), destinationBucket: "my-serverless-bucket", } // The following lines are for demonstration purposes only. // Replace with your actual data migration logic. // For example, you might use `from()` and `to()` functions. // Example of how to access migration configuration: // from(bucket: migration.sourceBucket) // |> range(start: migration.start, stop: migration.stop) // |> filter(fn: ( தக) => தக._measurement == "cpu") // |> to(bucket: migration.destinationBucket, host: migration.destinationHost, token: migration.destinationToken) // For a complete example, see the InfluxDB documentation. // This is a placeholder to ensure the script is valid Flux. // In a real scenario, this would be replaced by actual data processing. print("Migration task configured.") ``` -------------------------------- ### Programmatic Puppeteer Usage Source: https://github.com/influxdata/docs-v2/blob/master/scripts/puppeteer/QUICK-REFERENCE.md Example of using Puppeteer helper functions programmatically to launch a browser, navigate, check elements, take screenshots, and get performance metrics. ```javascript import { launchBrowser, navigateToPage, takeScreenshot, elementExists, getPageMetrics, } from './utils/puppeteer-helpers.js'; const browser = await launchBrowser(); const page = await navigateToPage(browser, '/influxdb3/core/'); // Check element const hasComponent = await elementExists(page, '[data-component="format-selector"]'); // Screenshot await takeScreenshot(page, 'debug.png'); // Performance const metrics = await getPageMetrics(page); console.log('Load time:', metrics.performance.loadComplete); await browser.close(); ```