Skip to content

Commit ccf9f78

Browse files
authored
Merge pull request #6197 from influxdata/feat-influxdb3-cli-updates
Monolith: Add missing CLI options, enhance CLI and API docs
2 parents a3a515f + 74970e0 commit ccf9f78

File tree

8 files changed

+149
-15
lines changed

8 files changed

+149
-15
lines changed

api-docs/influxdb3/core/v3/ref.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2029,11 +2029,16 @@ components:
20292029
### Interval-based scheduling
20302030
Format: `every:DURATION`
20312031
2032-
Supported durations: `s` (seconds), `m` (minutes), `h` (hours), `d` (days):
2032+
Supported durations: `s` (seconds), `m` (minutes), `h` (hours), `d` (days), `w` (weeks), `M` (months), `y` (years):
20332033
- `every:30s` - Every 30 seconds
20342034
- `every:5m` - Every 5 minutes
20352035
- `every:1h` - Every hour
20362036
- `every:1d` - Every day
2037+
- `every:1w` - Every week
2038+
- `every:1M` - Every month
2039+
- `every:1y` - Every year
2040+
2041+
**Maximum interval**: 1 year
20372042
20382043
### Table-based triggers
20392044
- `all_tables` - Triggers on write events to any table in the database

api-docs/influxdb3/enterprise/v3/ref.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,11 +2176,16 @@ components:
21762176
### Interval-based scheduling
21772177
Format: `every:DURATION`
21782178
2179-
Supported durations: `s` (seconds), `m` (minutes), `h` (hours), `d` (days):
2179+
Supported durations: `s` (seconds), `m` (minutes), `h` (hours), `d` (days), `w` (weeks), `M` (months), `y` (years):
21802180
- `every:30s` - Every 30 seconds
21812181
- `every:5m` - Every 5 minutes
21822182
- `every:1h` - Every hour
21832183
- `every:1d` - Every day
2184+
- `every:1w` - Every week
2185+
- `every:1M` - Every month
2186+
- `every:1y` - Every year
2187+
2188+
**Maximum interval**: 1 year
21842189
21852190
### Table-based triggers
21862191
- `all_tables` - Triggers on write events to any table in the database

content/influxdb3/core/reference/cli/influxdb3/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ influxdb3 [GLOBAL-OPTIONS] [COMMAND]
4949
| | `--io-runtime-thread-keep-alive` | Custom timeout for a thread in the blocking pool of the tokio IO runtime |
5050
| | `--io-runtime-thread-priority` | Set thread priority tokio IO runtime workers |
5151
| `-h` | `--help` | Print help information |
52-
| | `--help-all` | Print detailed help information |
52+
| | `--help-all` | Print detailed help information including runtime configuration options |
5353
| `-V` | `--version` | Print version |
5454

5555
### Option environment variables

content/influxdb3/core/reference/cli/influxdb3/create/database.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ source: /shared/influxdb3-cli/create/database.md
1111
---
1212

1313
<!--
14-
The content of this file is at content/shared/influxdb3-cli/create/database.md
14+
//SOURCE - content/shared/influxdb3-cli/create/database.md
1515
-->

content/influxdb3/core/reference/cli/influxdb3/create/token/admin.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: influxdb3 create token admin
2+
title: influxdb3 create token --admin
33
description: >
4-
The `influxdb3 create token admin` command creates an operator token or named admin token with full administrative privileges for server actions.
4+
The `influxdb3 create token --admin` subcommand creates an operator token or named admin token with full administrative privileges for server actions.
55
menu:
66
influxdb3_core:
77
parent: influxdb3 create token
8-
name: influxdb3 create token admin
8+
name: influxdb3 create token --admin
99
weight: 400
1010
source: /shared/influxdb3-cli/create/token/admin.md
1111
---

content/influxdb3/enterprise/reference/cli/influxdb3/create/token/admin.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: influxdb3 create token admin
2+
title: influxdb3 create token --admin
33
description: >
4-
The `influxdb3 create token admin` command creates an operator token or named admin token with full administrative privileges for server actions.
4+
The `influxdb3 create token --admin` subcommand creates an operator token or named admin token with full administrative privileges for server actions.
55
menu:
66
influxdb3_enterprise:
77
parent: influxdb3 create token
8-
name: influxdb3 create token admin
8+
name: influxdb3 create token --admin
99
weight: 400
1010
source: /shared/influxdb3-cli/create/token/admin.md
1111
---

content/shared/influxdb3-cli/create/token/_index.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ influxdb3 create token <SUBCOMMAND>
2020

2121
## Options
2222

23-
| Option | | Description |
24-
| :----- | :------- | :--------------------- |
25-
| |`--admin`| Create an admin token |
26-
| `-h` | `--help` | Print help information |
23+
| Option | | Description |
24+
|:-------|:----------|:-----------------------|
25+
| | `--admin` | Create an admin token |
26+
| `-h` | `--help` | Print help information |
27+
| | `--help-all` | Print detailed help information
2728

2829

content/shared/influxdb3-cli/create/trigger.md

Lines changed: 124 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ influxdb3 create trigger [OPTIONS] \
2828
| | `--token` | _({{< req >}})_ Authentication token |
2929
| | `--plugin-filename` | _({{< req >}})_ Name of the file, stored in the server's `plugin-dir`, that contains the Python plugin code to run |
3030
| | `--trigger-spec` | Trigger specification: `table:<TABLE_NAME>`, `all_tables`, `every:<DURATION>`, `cron:<EXPRESSION>`, or `request:<REQUEST_PATH>` |
31+
| | `--trigger-arguments` | Additional arguments for the trigger, in the format `key=value`, separated by commas (for example, `arg1=val1,arg2=val2`) |
3132
| | `--disabled` | Create the trigger in disabled state |
33+
| | `--error-behavior` | Error handling behavior: `log`, `retry`, or `disable` |
34+
| | `--run-asynchronous` | Run the trigger asynchronously, allowing multiple triggers to run simultaneously (default is synchronous) |
3235
| | `--tls-ca` | Path to a custom TLS certificate authority (for testing or self-signed certificates) |
3336
| `-h` | `--help` | Print help information |
3437
| | `--help-all` | Print detailed help information |
3538

36-
If you want to use a plugin from the [Plugin Library](https://github.com/influxdata/influxdb3_plugins) repo, use the url path with `gh:` specified as the prefix.
39+
If you want to use a plugin from the [Plugin Library](https://github.com/influxdata/influxdb3_plugins) repo, use the URL path with `gh:` specified as the prefix.
3740
For example, to use the [System Metrics](https://github.com/influxdata/influxdb3_plugins/blob/main/examples/schedule/system_metrics/system_metrics.py) plugin, the plugin filename is `gh:examples/schedule/system_metrics/system_metrics.py`.
3841

3942

@@ -51,6 +54,17 @@ You can use the following environment variables to set command options:
5154

5255
The following examples show how to use the `influxdb3 create trigger` command to create triggers in different scenarios.
5356

57+
- [Create a trigger for a specific table](#create-a-trigger-for-a-specific-table)
58+
- [Create a trigger for all tables](#create-a-trigger-for-all-tables)
59+
- [Create a trigger with a schedule](#create-a-trigger-with-a-schedule)
60+
- [Create a trigger for HTTP requests](#create-a-trigger-for-http-requests)
61+
- [Create a trigger with additional arguments](#create-a-trigger-with-additional-arguments)
62+
- [Create a disabled trigger](#create-a-disabled-trigger)
63+
- [Create a trigger with error handling](#create-a-trigger-with-error-handling)
64+
65+
---
66+
67+
Replace the following placeholders with your values:
5468

5569
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: Database name
5670
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}: Authentication token
@@ -77,6 +91,8 @@ influxdb3 create trigger \
7791
TRIGGER_NAME
7892
```
7993

94+
`PLUGIN_FILENAME` must implement the [data write plugin](/influxdb3/version/plugins/#create-a-data-write-plugin) interface.
95+
8096
### Create a trigger for all tables
8197

8298
Create a trigger that applies to all tables in the specified database.
@@ -92,8 +108,77 @@ influxdb3 create trigger \
92108
TRIGGER_NAME
93109
```
94110

111+
`PLUGIN_FILENAME` must implement the [data write plugin](/influxdb3/version/plugins/#create-a-data-write-plugin) interface.
112+
95113
This is useful when you want a trigger to apply to any table in the database, regardless of name.
96114

115+
### Create a trigger with a schedule
116+
117+
Create a trigger that runs at a specific interval using a duration. Supported duration units: `s` (seconds), `m` (minutes), `h` (hours), `d` (days), `w` (weeks), `M` (months), `y` (years). Maximum interval is 1 year.
118+
119+
```bash
120+
influxdb3 create trigger \
121+
--database DATABASE_NAME \
122+
--token AUTH_TOKEN \
123+
--plugin-filename <PLUGIN_FILENAME> \
124+
--trigger-spec every:5m \
125+
TRIGGER_NAME
126+
```
127+
128+
Create a trigger that runs based on a cron schedule using extended 6-field cron format. The cron expression follows the format:
129+
130+
```console
131+
second minute hour day_of_month month day_of_week
132+
```
133+
134+
Fields:
135+
- **second**: 0-59
136+
- **minute**: 0-59
137+
- **hour**: 0-23
138+
- **day_of_month**: 1-31
139+
- **month**: 1-12 or JAN-DEC
140+
- **day_of_week**: 0-7 (0 or 7 is Sunday) or SUN-SAT
141+
142+
Example: Run at 6:00 AM every weekday (Monday-Friday):
143+
144+
```bash
145+
influxdb3 create trigger \
146+
--database DATABASE_NAME \
147+
--token AUTH_TOKEN \
148+
--plugin-filename <PLUGIN_FILENAME> \
149+
--trigger-spec "cron:0 0 6 * * 1-5" \
150+
TRIGGER_NAME
151+
```
152+
153+
`PLUGIN_FILENAME` must implement the [scheduled plugin](/influxdb3/version/plugins/#create-a-scheduled-plugin) interface.
154+
155+
### Create a trigger for HTTP requests
156+
157+
Create a trigger that provides an API endpoint and processes HTTP requests.
158+
159+
```bash
160+
influxdb3 create trigger \
161+
--database DATABASE_NAME \
162+
--token AUTH_TOKEN \
163+
--plugin-filename PLUGIN_FILENAME \
164+
--trigger-spec request:REQUEST_PATH \
165+
TRIGGER_NAME
166+
```
167+
168+
`PLUGIN_FILENAME` must implement the [HTTP request plugin](/influxdb3/version/plugins/#create-an-http-request-plugin) interface.
169+
170+
### Create a trigger with additional arguments
171+
172+
```bash
173+
influxdb3 create trigger \
174+
--database DATABASE_NAME \
175+
--token AUTH_TOKEN \
176+
--plugin-filename <PLUGIN_FILENAME> \
177+
--trigger-spec table:TABLE_NAME \
178+
--trigger-arguments arg1=value1,arg2=value2 \
179+
TRIGGER_NAME
180+
```
181+
97182
### Create a disabled trigger
98183

99184
Create a trigger in a disabled state.
@@ -112,4 +197,42 @@ influxdb3 create trigger \
112197

113198
Creating a trigger in a disabled state prevents it from running immediately. You can enable it later when you're ready to activate it.
114199

200+
### Create a trigger with error handling
201+
202+
Log the error to the service output and the `system.processing_engine_logs` table:
203+
204+
```bash
205+
influxdb3 create trigger \
206+
--database DATABASE_NAME \
207+
--token AUTH_TOKEN \
208+
--plugin-filename <PLUGIN_FILENAME> \
209+
--trigger-spec table:TABLE_NAME \
210+
--error-behavior log \
211+
TRIGGER_NAME
212+
```
213+
214+
Rerun the trigger if it fails:
215+
216+
```bash
217+
influxdb3 create trigger \
218+
--database DATABASE_NAME \
219+
--token AUTH_TOKEN \
220+
--plugin-filename <PLUGIN_FILENAME> \
221+
--trigger-spec table:TABLE_NAME \
222+
--error-behavior retry \
223+
TRIGGER_NAME
224+
```
225+
226+
Disable the trigger if it fails:
227+
228+
```bash
229+
influxdb3 create trigger \
230+
--database DATABASE_NAME \
231+
--token AUTH_TOKEN \
232+
--plugin-filename <PLUGIN_FILENAME> \
233+
--trigger-spec table:TABLE_NAME \
234+
--error-behavior disable \
235+
TRIGGER_NAME
236+
```
237+
115238
{{% /code-placeholders %}}

0 commit comments

Comments
 (0)