> For the complete documentation index, see [llms.txt](https://docs.ilert.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ilert.com/ai-and-agents/mcp/hosted/influxdb.md).

# InfluxDB

Give an agent access to InfluxDB with an API token.

#### Required permissions

<table><thead><tr><th width="177.62890625">Tool</th><th width="177.9765625">Required Permission</th><th>Description</th></tr></thead><tbody><tr><td><code>get_measurements</code></td><td><code>read</code></td><td>Get measurements from InfluxDB useful to identify the measurements to use in the <code>query_time_series</code> tool.</td></tr><tr><td><code>query_time_series</code></td><td><code>read</code></td><td>Query time series data from InfluxDB using Flux query language (v2 API). This tool retrieves metrics, logs, and other time-stamped data from InfluxDB databases. It supports filtering by time range and measurement type, and returns formatted results showing timestamp, measurement name, location tags, and field values.</td></tr></tbody></table>

#### Create API token

Using the InfluxDB MCP server requires an API token with appropriate permissions.

**For InfluxDB 2.x (Cloud and OSS)**

{% stepper %}
{% step %}
Log in to your InfluxDB instance (InfluxDB Cloud or self-hosted)
{% endstep %}

{% step %}
Navigate to **Data** → **Tokens** (or **Load Data** → **Tokens** in InfluxDB Cloud)
{% endstep %}

{% step %}
Click **Generate API Token** → **Read Token** (or **Custom Token** for more control)
{% endstep %}

{% step %}
Configure the token:

* **Description**: Enter a name (e.g., "ilert-mcp-agent")
* **Permissions**: Select **Read** access
* **Resources**:
  * Select the **Organization** you want to grant access to
  * Select the **Buckets** you want to grant read access to (or select "All buckets" for full read access)
* **Expiration**: Set expiration date (optional, recommended for security)
  {% endstep %}

{% step %}
Click **Save** or **Generate Token**
{% endstep %}

{% step %}
Copy the API token immediately (it won't be shown again)
{% endstep %}

{% step %}
Store the token securely. You will need this token when setting up the InfluxDB MCP server in ilert.
{% endstep %}
{% endstepper %}

**For InfluxDB 1.x (Legacy)**

If you're using InfluxDB 1.x, authentication is handled differently:

{% stepper %}
{% step %}
Create a user with read permissions:

```bash

# Connect to InfluxDB CLI
influx

# Create a user
CREATE USER "ilert_agent" WITH PASSWORD 'your-secure-password' WITH ALL PRIVILEGES

# Or grant read-only access to specific databases
GRANT READ ON "your_database" TO "ilert_agent"
```

{% endstep %}

{% step %}
Use the username and password when configuring the InfluxDB MCP server in ilert.
{% endstep %}
{% endstepper %}

#### Create API token via CLI (InfluxDB 2.x)

Alternatively, you can create an API token using the InfluxDB CLI:

{% stepper %}
{% step %}
Install the InfluxDB CLI (if not already installed)
{% endstep %}

{% step %}
Authenticate with InfluxDB:

```bash
influx auth create \
  --org your-organization \
  --description "ilert-mcp-agent" \
  --read-bucket your-bucket-name
```

{% endstep %}

{% step %}
The command will output the token. Copy it immediately.
{% endstep %}

{% step %}
Store the token securely. You will need this token when setting up the InfluxDB MCP server in ilert.
{% endstep %}
{% endstepper %}

#### Create API token via REST API (InfluxDB 2.x)

You can also create an API token using the InfluxDB REST API:

```bash
curl -X POST "https://your-influxdb-instance:8086/api/v2/authorizations" \
  -H "Authorization: Token YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "orgID": "YOUR_ORG_ID",
    "description": "ilert-mcp-agent",
    "permissions": [
      {
        "action": "read",
        "resource": {
          "type": "buckets",
          "orgID": "YOUR_ORG_ID",
          "id": "YOUR_BUCKET_ID"
        }
      }
    ]
  }'
```

Replace:

* `YOUR_ADMIN_TOKEN` with an admin token
* `YOUR_ORG_ID` with your organization ID
* `YOUR_BUCKET_ID` with your bucket ID (or use `"*"` for all buckets)

#### Verify API token access

Before configuring the MCP server, verify that your API token works:

**For InfluxDB 2.x:**

```bash

# Test API token authentication
curl -H "Authorization: Token YOUR_API_TOKEN" \
  https://your-influxdb-instance:8086/api/v2/buckets

# Test query access (Flux)
curl -X POST "https://your-influxdb-instance:8086/api/v2/query?org=YOUR_ORG" \
  -H "Authorization: Token YOUR_API_TOKEN" \
  -H "Content-Type: application/vnd.flux" \
  --data-raw 'from(bucket:"your-bucket") |> range(start: -1h) |> limit(n:1)'
```

**For InfluxDB 1.x:**

```bash

# Test authentication
curl -u "ilert_agent:your-password" \
  "https://your-influxdb-instance:8086/query?q=SHOW DATABASES"
```

Replace `YOUR_API_TOKEN` with your actual token and `your-influxdb-instance` with your InfluxDB server URL.

{% hint style="info" %}
**Note:**

* For InfluxDB 2.x, you'll need both the API token and your organization name when configuring the MCP server
* For InfluxDB 1.x, you'll need the username and password
* Ensure your InfluxDB instance is accessible from the network where the MCP server will run
  {% endhint %}

#### Connect InfluxDB with agent

To connect InfluxDB with your AI SRE agent:

{% stepper %}
{% step %}
Navigate to **Agents** in the ilert navigation menu
{% endstep %}

{% step %}
Open the agent detail view for the agent you want to configure
{% endstep %}

{% step %}
Go to the **Tools** tab
{% endstep %}

{% step %}
Under the **ilert hosted MCP servers** section, locate the **InfluxDB** card
{% endstep %}

{% step %}
Click **Connect** on the InfluxDB card
{% endstep %}

{% step %}
In the connection dialog that appears:

* **Select connector:** Choose "Create new connector" (or select an existing connector if you have one)
* **Type:** Select **Bearer Token** from the dropdown
* **Secret name:** Enter a name for your connector (e.g., "InfluxDB Production" or "InfluxDB Main")
* **Secret value:** Paste the API token you created earlier
* **Host URL:** Enter your InfluxDB instance URL (e.g., `https://influxdb.example.com:8086`)
  {% endstep %}

{% step %}
Click **Connect** to complete the connection
{% endstep %}

{% step %}
After connecting, you can enable or disable specific tools needed for alert investigation, such as:

* `get_measurements` - Get measurements from InfluxDB to identify available measurements
* `query_time_series` - Query time series data from InfluxDB using Flux query language
  {% endstep %}
  {% endstepper %}

The InfluxDB integration is now connected and ready to use for root cause analysis.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ilert.com/ai-and-agents/mcp/hosted/influxdb.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
