Linux/InfluxDB
Appearance
< Linux
Preparing v1 access via InfluxDB 2.x
- Create token in gui
- "Load Data" -> "API Tokens"
- Get Bucket ID
- "Load Data" -> "Buckets"
- Get Organization Name
- "User" -> "About" -> "Organization Profile" -> "Name"
Create new v1 user
- Access influx command line (docker exec -it influxdb sh)
influx v1 auth create -o {orgName} --username {newuser} --password {newpass} -t {token} --read-bucket {bucketID} --write-bucket {bucketID}
Settings in Node-RED
version = 1.x
database = from previous step (e.g. mybucket)
username = {newuser}
password = {newpass}
Settings in Grafana
Name: InfluxDB
Default: true
Query Language: InfluxQL
URL: http://{containername}:8086
Allowed cookies:
Timeout:
Database: mybucket
User: {newuser}
Password: {newpass}
HTTP Method: GET
Export
- container_run_list-measurements.sh
# Configuration CONTAINER_NAME="influxdb" ORG="org" TOKEN="1234==" # Get list of measurements docker exec $CONTAINER_NAME influx query --org $ORG --token "$TOKEN" --raw 'import "influxdata/influxdb/schema" schema.measurements(bucket: "mybucket")'\ | cut -d, -f4 | tail -n +5 | head -n -1 \ > measurements.txt
- container_run_export-measurements.sh
# Configuration
CONTAINER_NAME="influxdb"
ORG="org"
BUCKET="mybucket"
TOKEN="1234=="
OUTPUT_DIR="./exports"
# Create output directory
mkdir -p $OUTPUT_DIR
while read measurement; do
measurement=$(echo "$measurement" | tr -d '\r\n')
SAFE_MEAS=$(echo "$measurement" | tr '/ ' '__')
echo "Exporting $measurement"
docker exec influxdb influx query '
from(bucket: "'"$BUCKET"'")
|> range(start: 0)
|> filter(fn: (r) => r._measurement == "'"$measurement"'")
|> filter(fn: (r) => r._time < time(v: "2025-07-01T00:00:00Z"))
|> keep(columns: ["_time", "_value", "_measurement"])
' --token "$TOKEN" --org "$ORG" --raw > "$OUTPUT_DIR/${SAFE_MEAS}.csv"
done < measurements.txt