3.5 KiB
title | seotitle | description | menu | weight | related | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Create a task | Create a task for processing data in InfluxDB | Create a data processing task in InfluxDB using the InfluxDB UI or the `influx` CLI. |
|
201 |
|
InfluxDB provides multiple ways to create tasks both in the InfluxDB user interface (UI)
and the influx
command line interface (CLI).
Before creating a task, review the basics criteria for writing a task.
Create a task in the InfluxDB UI
The InfluxDB UI provides multiple ways to create a task:
- Create a task from the Data Explorer
- Create a task in the Task UI
- Import a task
- Create a task from a template
- Clone a task
Create a task from the Data Explorer
-
Click on the Data Explorer icon in the left navigation menu.
{{< nav-icon "data-explorer" >}}
-
Building a query and click Save As in the upper right.
-
Select the Task option.
-
Specify the task options. See Task options for detailed information about each option.
-
Click Save as Task.
{{< img-hd src="/img/2-0-data-explorer-save-as-task.png" title="Add a task from the Data Explorer"/>}}
Create a task in the Task UI
-
Click on the Tasks icon in the left navigation menu.
{{< nav-icon "tasks" >}}
-
Click {{< icon "plus" >}} Create Task in the upper right.
-
Select New Task.
-
In the left panel, specify the task options. See Task options for detailed information about each option.
-
In the right panel, enter your task script.
-
Click Save in the upper right.
{{< img-hd src="/img/2-0-tasks-create-edit.png" title="Create a task" />}}
Import a task
-
Click on the Tasks icon in the left navigation menu.
{{< nav-icon "tasks" >}}
-
Click + Create Task in the upper right.
-
Select Import Task.
-
Upload a JSON task file using one of the following options:
- Drag and drop a JSON task file in the specified area.
- Click to upload and the area to select the JSON task from from your file manager.
- Select the JSON option and paste in raw task JSON.
-
Click Import JSON as Task.
Create a task from a template
-
Click on the Settings icon in the left navigation menu.
{{< nav-icon "Settings" >}}
-
Select Templates.
-
Hover over the template to use to create the task and click Create.
Clone a task
-
Click on the Tasks icon in the left navigation menu.
{{< nav-icon "tasks" >}}
-
Hover over the task you would like to clone and click the {{< icon "duplicate" >}} icon that appears.
-
Click Clone.
Create a task using the influx CLI
Use influx task create
command to create a new task.
It accepts either a file path or raw Flux.
Create a task using a file
# Pattern
influx task create --org <org-name> @</path/to/task-script>
# Example
influx task create --org my-org @/tasks/cq-mean-1h.flux
Create a task using raw Flux
influx task create --org my-org - # <return> to open stdin pipe
options task = {
name: "task-name",
every: 6h
}
# ... Task script ...
# <ctrl-d> to close the pipe and submit the command