Process Data
Tools & integrations
InfluxDB HTTP API
Reference
First check out version installed
influxd version
InfluxDB v2.7.8 (git: 18c989726c) build_date: 2024-07-25T19:55:43Z
Lets do the tutorial at InfluxDB OSS v2 Documentation (influxdata.com)
Write data
We write data with Python for this test code at linux-and-azure/azure-extra-linux-vm/influxdb-telegraf/README.md at main · spawnmarvel/linux-and-azure · GitHub
Example output
Example data
Query data
Great now we have some data, lest do some queries on it.
Flux is in maintenance mode and is not supported in InfluxDB v3 due to the broad demand for native SQL and the continued growth and adoption of InfluxQL.
So we jump to InfluxQL.
Query data with InfluxQL | InfluxDB OSS v2 Documentation (influxdata.com)
Verify buckets have a mapping.
Create DBRP mappings for unmapped buckets.
Query a mapped bucket with InfluxQL.
mkdir influxdbcli
cd influxdbcli
# amd64
wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz
# amd64
tar xvzf path/to/influxdb2-client-2.7.5-linux-amd64.tar.gz
# (Optional) Place the unpackaged influx executable in your system $PATH
# amd64
sudo cp influx/usr/local/bin/
influx version
Influx CLI dev (git: a79a2a1b825867421d320428538f76a4c90aa34c) build_date: 2024-04-16T14:34:32Z
Messy stuff
Option use API with curl or
Query in Data Explorer, Query in Data Explorer | InfluxDB OSS v2 Documentation (influxdata.com)
Visualize data
Create, control, export delete a dashboard.
Data explorer and flux
Get started with Flux | Flux Documentation (influxdata.com)
You can play with dashboards and copy some queries.
// This was copied from a dashboard
from(bucket: "bucketTemperature")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Tag-BRG" or r["_measurement"] == "Tag-OSL")
|> filter(fn: (r) => r["_field"] == "temperature")
|> yield(name: "mean")
The result of that is:
Use and manage variables
Dashboard variables let you alter specific components of cells’ queries without having to edit the queries, making it easy to interact with your dashboard cells and explore your data.
Both predefined dashboard variables and custom dashboard variables are stored in a v record associated with each dashboard. Reference each variable using dot-notation (e.g. v.variableName).
Types
Process Data
Process and analyze your data with tasks in the InfluxDB task engine. Use tasks (scheduled Flux queries) to input a data stream and then analyze, modify, and act on the data accordingly.
Discover how to create and manage tasks using the InfluxDB user interface (UI) the influx command line interface (CLI), and the InfluxDB /api/v2 API. Find examples of data downsampling and other common tasks.
Monitor & alert
Manage checks.
Checks in InfluxDB query data and apply a status or level to each data point based on specified conditions
Check query:
Specifies the dataset to monitor.
May include tags to narrow results.
Check configuration
- Defines check properties, including the check interval and status message.
- Evaluates specified conditions and applies a status (if applicable) to each data point:
- crit
- warn
- info
- ok
- Stores status in the _level column.
Check types
There are two types of checks:
- threshold
- deadman
Threshold check
A threshold check assigns a status based on a value being above, below, inside, or outside of defined thresholds.
Deadman check
A deadman check assigns a status to data when a series or group doesn’t report in a specified amount of time.
Threshold check’s example.
lets feed some data to influxdb with python.
# the valued will be between
bucket = "bucketTemperature"
ran1 = random.uniform(10.5, 35.9) # Tag-BRG
ran2 = ran1 + 5 # Tag-OSL
Create check
Choose type
Select bucket, measurement, field and tag set in step 1
Example
Choose a function
Submit then you see data / or see raw data
Now we configure the check in step 2
Example with a tag
In the Status Message Template column, enter the status message template for the check. Use Flux string interpolation to populate the message with data from the query.
Check data is represented as a record, r. Access specific column values using dot notation: r.columnName.
Use data from the following columns:
columns included in the query output
custom tags added to the query output
_check_id
_check_name
_level
_source_measurement
_type
We keep the default
Our check
Select thresholds, we choose warn
Configure, the bar above with the live data shows the limit live.
save the check
Name the check
View check
Alerts
Alert history
Check status , wait a bit for more data to come.
Press check for warn and drill down, view raw data
Notification endpoints
And notification rules
You can use just influx for alerts, but the stack is usually
Tools & integrations
Administer InfluxDB
TLS Enable TLS/SSL encryption | InfluxDB OSS v2 Documentation (influxdata.com)
For config
Configure HTTPS over TLS | InfluxDB Enterprise Documentation (influxdata.com)
basically you have the option to add lines to the config file ( /etc/influxdb/config.toml )
e.g - add this for the toml file:
tls-cert = "/path/to/influxdb.crt"
tls-key = "/path/to/influxdb.key"
or this for yaml:
tls-cert: /path/to/influxdb.crt
tls-key: /path/to/influxdb.key
InfluxDB file system layout | InfluxDB OSS v2 Documentation (influxdata.com)
InfluxDB HTTP API
Reference