InfluxDB
Write measurements to InfluxDB 1, 2 or 3 from rows and query them with InfluxQL, Flux or SQL as rows. Typical uses: store sensor or business metrics, read time series for a report.
influx pinginflux collection_createinflux collection_createinflux collectionsinflux writeinflux writeinflux write_linesinflux write_linesinflux queryinflux queryinflux requestinflux requestinflux collection_drop

influx ping <config>


Description

    Test that the server answers. Returns {ok, version, build}

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
admin
influx ping "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}"
mentdb
{"ok": true, "version": "v2.7.11", "build": "OSS"}
InfluxDB 1 (fixed result: real InfluxDB 1.8.10)
admin
influx ping "{\"url\": \"http://localhost:8086\", \"version\": 1, \"database\": \"metrics\"}"
mentdb
{"ok": true, "version": "1.8.10", "build": "OSS"}
InfluxDB 3 Core (fixed result: real InfluxDB 3.6.0 Core)
admin
influx ping "{\"url\": \"http://localhost:8181\", \"version\": 3, \"token\": \"influx3_token\", \"database\": \"metrics\"}"
mentdb
{"ok": true, "version": "3.6.0", "build": "Core"}

influx collection_create <config> <name>


Description

    Create a bucket (2, in the org of the configuration) or a database (1 and 3). Returns {created}

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    name:   The name - String - required
admin
influx collection_create "{\"url\": \"http://localhost:8181\", \"version\": 3, \"token\": \"influx3_token\", \"database\": \"metrics\"}" "metrics"
mentdb
{"created": "metrics"}
a database on InfluxDB 1 (fixed result: real InfluxDB 1.8.10)
admin
influx collection_create "{\"url\": \"http://localhost:8086\", \"version\": 1, \"database\": \"metrics\"}" "metrics"
mentdb
{"created": "metrics"}

influx collection_create <config> <name> <json_params>


Description

    Create with parameters: retention_seconds (0: forever; versions 1 and 2)

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    name:   The name - String - required
    json_params:   The parameters - String - required
admin
influx collection_create "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "archive" "{\"retention_seconds\": 2592000}"
mentdb
{"created": "archive"}

influx collections <config>


Description

    The names of the buckets (2) or of the databases (1 and 3)

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
admin
influx collections "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}"
mentdb
["_monitoring", "_tasks", "archive", "metrics"]
InfluxDB 1 (fixed result: real InfluxDB 1.8.10)
admin
influx collections "{\"url\": \"http://localhost:8086\", \"version\": 1, \"database\": \"metrics\"}"
mentdb
["_internal", "metrics"]

influx write <config> <measurement> <json_rows>


Description

    Write rows as points of a measurement (all the non-null columns except time become fields). Returns {lines, skipped, requests}: a row without any field is skipped

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    measurement:   The measurement - String - required
    json_rows:   The rows - String - required
admin
influx write "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "temperature" "[{\"time\": \"2026-11-17T10:00:00Z\", \"value\": 21.5}, {\"time\": \"2026-11-17T10:05:00Z\", \"value\": 22}]"
mentdb
{"lines": 2, "skipped": 0, "requests": 1}

influx write <config> <measurement> <json_rows> <json_params>


Description

    Write with parameters: tags, fields, integer_fields, time (time), precision (ns, us, ms or s; ms), bucket or database, batch_size (5000)

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    measurement:   The measurement - String - required
    json_rows:   The rows - String - required
    json_params:   The parameters - String - required
admin
influx write "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "cpu" "[{\"time\": \"2026-11-17T10:00:00Z\", \"host\": \"srv1\", \"region\": \"eu\", \"usage\": 12.5, \"procs\": 120, \"note\": \"ok, stable\"}, {\"time\": \"2026-11-17T10:01:00Z\", \"host\": \"srv2\", \"region\": \"eu\", \"usage\": 40, \"procs\": 98}, {\"time\": \"2026-11-17T10:02:00Z\", \"host\": \"srv1\", \"region\": \"eu\", \"usage\": null}]" "{\"tags\": [\"host\", \"region\"], \"integer_fields\": [\"procs\"]}"
mentdb
{"lines": 2, "skipped": 1, "requests": 1}
InfluxDB 1, precision in seconds (fixed result: real InfluxDB 1.8.10)
admin
influx write "{\"url\": \"http://localhost:8086\", \"version\": 1, \"database\": \"metrics\"}" "cpu" "[{\"time\": \"2026-11-17 10:00:00\", \"host\": \"srv1\", \"usage\": 12.5}, {\"time\": \"2026-11-17 10:01:00\", \"host\": \"srv2\", \"usage\": 40}]" "{\"tags\": [\"host\"], \"precision\": \"s\"}"
mentdb
{"lines": 2, "skipped": 0, "requests": 1}
InfluxDB 3 (fixed result: real InfluxDB 3.6.0 Core)
admin
influx write "{\"url\": \"http://localhost:8181\", \"version\": 3, \"token\": \"influx3_token\", \"database\": \"metrics\"}" "cpu" "[{\"time\": \"2026-11-17T10:00:00Z\", \"host\": \"srv1\", \"usage\": 12.5}, {\"time\": \"2026-11-17T10:01:00Z\", \"host\": \"srv2\", \"usage\": 40}]" "{\"tags\": [\"host\"]}"
mentdb
{"lines": 2, "skipped": 0, "requests": 1}

influx write_lines <config> <lines>


Description

    Write a text of line protocol as it is, in one request (string fields may hold line breaks). Returns {bytes, requests}; nothing is sent when the text only has empty lines and # comments

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    lines:   The lines - String - required
admin
influx write_lines "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "cpu,host=srv3 usage=7.5 1794913200000 cpu,host=srv3 usage=8 1794913260000"
mentdb
{"bytes": 73, "requests": 1}

influx write_lines <config> <lines> <json_params>


Description

    Write lines with parameters: precision (ms), bucket or database

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    lines:   The lines - String - required
    json_params:   The parameters - String - required
admin
influx write_lines "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "cpu,host=srv4 usage=3 1794913200" "{\"precision\": \"s\"}"
mentdb
{"bytes": 32, "requests": 1}

influx query <config> <query>


Description

    Run a query in the language of the version (InfluxQL for 1, Flux for 2, SQL for 3): rows

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    query:   The query - String - required
admin
influx query "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "from(bucket: \"metrics\") |> range(start: 2026-11-17T00:00:00Z, stop: 2026-11-18T00:00:00Z) |> filter(fn: (r) => r._measurement == \"cpu\" and r.host == \"srv1\") |> pivot(rowKey: [\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\") |> keep(columns: [\"_time\", \"host\", \"usage\", \"procs\", \"note\"])"
mentdb
[{"_time": "2026-11-17T10:00:00Z", "host": "srv1", "note": "ok, stable", "procs": 120, "usage": 12.5}]
a Flux error (fixed result: real InfluxDB 2.7.11)
admin
influx query "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "from(bucket: \"metrics\") |> rangee()"
mentdb
ERROR: Sorry, an error appears (influxdb error: error @1:28-1:34: undefined identifier rangee (HTTP 400)).
InfluxQL (fixed result: real InfluxDB 1.8.10)
admin
influx query "{\"url\": \"http://localhost:8086\", \"version\": 1, \"database\": \"metrics\"}" "SELECT usage FROM cpu WHERE time >= '2026-11-17T00:00:00Z' GROUP BY host"
mentdb
[{"time": "2026-11-17T10:00:00Z", "host": "srv1", "usage": 12.5}, {"time": "2026-11-17T10:01:00Z", "host": "srv2", "usage": 40}]
SQL (fixed result: real InfluxDB 3.6.0 Core)
admin
influx query "{\"url\": \"http://localhost:8181\", \"version\": 3, \"token\": \"influx3_token\", \"database\": \"metrics\"}" "SELECT host, usage, time FROM cpu ORDER BY time"
mentdb
[{"host": "srv1", "usage": 12.5, "time": "2026-11-17T10:00:00"}, {"host": "srv2", "usage": 40, "time": "2026-11-17T10:01:00"}]

influx query <config> <query> <json_params>


Description

    Query with parameters: language (influxql, flux or sql), bucket or database, limit (10000), epoch (InfluxQL of versions 1 and 2: the times as numbers in ns, u, ms, s, m or h)

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    query:   The query - String - required
    json_params:   The parameters - String - required
admin
influx query "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "SELECT mean(usage) AS avg FROM cpu WHERE time >= '2026-11-17T00:00:00Z' AND time < '2026-11-18T00:00:00Z' GROUP BY host" "{\"language\": \"influxql\", \"epoch\": \"ms\"}"
mentdb
[{"time": 1794873600000, "host": "srv1", "avg": 12.5}, {"time": 1794873600000, "host": "srv2", "avg": 40}, {"time": 1794873600000, "host": "srv3", "avg": 7.75}, {"time": 1794873600000, "host": "srv4", "avg": 3}]
InfluxQL on InfluxDB 3 (fixed result: real InfluxDB 3.6.0 Core)
admin
influx query "{\"url\": \"http://localhost:8181\", \"version\": 3, \"token\": \"influx3_token\", \"database\": \"metrics\"}" "SELECT max(usage) FROM cpu GROUP BY host" "{\"language\": \"influxql\"}"
mentdb
[{"iox::measurement": "cpu", "time": "2026-11-17T10:00:00", "host": "srv1", "max": 12.5}, {"iox::measurement": "cpu", "time": "2026-11-17T10:01:00", "host": "srv2", "max": 40}]
one row at most (fixed result: real InfluxDB 1.8.10)
admin
influx query "{\"url\": \"http://localhost:8086\", \"version\": 1, \"database\": \"metrics\"}" "SELECT * FROM cpu" "{\"limit\": 1}"
mentdb
[{"time": "2026-11-17T10:00:00Z", "host": "srv1", "usage": 12.5}]

influx request <config> <method> <path>


Description

    Any HTTP request of the API, relative to url (the authorization is added; no ..; GET, POST, PUT, PATCH or DELETE). Returns the response text

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    method:   The method - String - required
    path:   The path with its query, like /api/v2/orgs - String - required
admin
influx request "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "GET" "/health"
mentdb
{"name":"influxdb", "message":"ready for queries and writes", "status":"pass", "checks":[], "version": "v2.7.11", "commit": "fbf5d4ab5e"}

influx request <config> <method> <path> <body>


Description

    A request with a body (JSON, or text for the line protocol)

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    method:   The method - String - required
    path:   The path - String - required
    body:   The body - String - required
admin
influx request "{\"url\": \"http://localhost:8181\", \"version\": 3, \"token\": \"influx3_token\", \"database\": \"metrics\"}" "POST" "/api/v3/write_lp?db=metrics&precision=second" "cpu,host=srv9 usage=1 1794913200"
mentdb

influx collection_drop <config> <name>


Description

    Delete a bucket (2) or a database (1 and 3) with all its data. Returns {dropped}

Parameters

    config:   The InfluxDB configuration as JSON: url (http://localhost:8086; 8181 for version 3), version (2; 1 or 3), token (or token: the name of a secret (secret set); versions 2 and 3), username and password (or password; version 1), org (version 2), bucket or database (the default target), retention_policy (version 1), allow_plain (false: a token or a password over http is refused unless the host is localhost), timeout_ms (30000), max_bytes (64 MB: the largest response) - String - required
    name:   The name - String - required
admin
influx collection_drop "{\"url\": \"http://localhost:8086\", \"token\": \"influx_token\", \"org\": \"acme\", \"bucket\": \"metrics\"}" "archive"
mentdb
{"dropped": "archive"}