### InfluxDB Add-on Configuration Example Source: https://github.com/hassio-addons/addon-influxdb/blob/main/influxdb/DOCS.md An example YAML configuration for the InfluxDB Home Assistant add-on. This snippet demonstrates how to set various options including log level, authentication, reporting, SSL settings, and environment variables. Ensure to customize these settings for your specific needs and restart the add-on after changes. ```yaml log_level: info auth: true reporting: true ssl: true certfile: fullchain.pem keyfile: privkey.pem envvars: - name: INFLUXDB_HTTP_LOG_ENABLED value: "true" ``` -------------------------------- ### Install InfluxDB Add-on in Home Assistant Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Steps to install the InfluxDB add-on from the Home Assistant Community Add-ons repository. This involves navigating to the Add-on Store, searching for InfluxDB, installing it, and then starting the add-on. ```yaml # Add-on installation steps: # 1. Navigate to Settings > Add-ons > Add-on Store # 2. Search for "InfluxDB" in the Community Add-ons repository # 3. Click "Install" # 4. Start the add-on # 5. Click "OPEN WEB UI" to access Chronograf ``` -------------------------------- ### Example Grafana InfluxQL Query Panel Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt This is an example of an InfluxQL query used within a Grafana panel to visualize time-series data. It demonstrates selecting the mean of a 'value' field from the 'temperature' measurement, filtering by 'room' and a time range, and grouping by time intervals. ```sql SELECT mean("value") FROM "temperature" WHERE "room" = 'living_room' AND $timeFilter GROUP BY time(5m) fill(null) ``` -------------------------------- ### Manage InfluxDB Databases via HTTP API (Bash) Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt An example using `curl` to create a new database in InfluxDB via its HTTP API. This demonstrates the necessary POST request, authentication, and the InfluxQL command for database creation. ```bash # Create a new database curl -X POST "http://localhost:8086/query" \ -u "admin:admin_password" \ --data-urlencode "q=CREATE DATABASE mydb" ``` -------------------------------- ### Configure InfluxDB Log Level Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Examples of setting the `log_level` configuration option for the InfluxDB add-on. This controls the verbosity of the add-on's logging output, with options ranging from `trace` to `fatal`. ```yaml # Set to debug for troubleshooting log_level: debug # Set to warning for production (reduces log noise) log_level: warning ``` -------------------------------- ### Configure InfluxDB SSL Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Example configuration for enabling HTTPS on the InfluxDB Chronograf web interface. This requires setting `ssl: true` and providing paths to the `certfile` and `keyfile`. ```yaml # Enable SSL with Let's Encrypt certificates ssl: true certfile: fullchain.pem keyfile: privkey.pem ``` -------------------------------- ### Query Data from InfluxDB via HTTP API (Bash) Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Examples using `curl` to query data from InfluxDB using both InfluxQL and Flux languages via the HTTP API. Includes authentication, database specification, and time range filtering. ```bash # Query using InfluxQL curl -G "http://localhost:8086/query" \ -u "homeassistant:your_password" \ --data-urlencode "db=homeassistant" \ --data-urlencode "q=SELECT * FROM temperature WHERE time > now() - 1h" # Query with Flux (if enabled) curl -X POST "http://localhost:8086/api/v2/query" \ -u "homeassistant:your_password" \ -H "Content-Type: application/vnd.flux" \ --data 'from(bucket: "homeassistant") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "temperature")' ``` -------------------------------- ### Write Data to InfluxDB via HTTP API (Bash) Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Examples using `curl` to write data points to InfluxDB via its HTTP API. Demonstrates writing a single point and multiple points in a single request, including authentication and specifying the database. ```bash # Write a single point to the database curl -X POST "http://localhost:8086/write?db=homeassistant" \ -u "homeassistant:your_password" \ --data-binary "temperature,room=living_room value=23.5 $(date +%s)000000000" # Write multiple points in a single request curl -X POST "http://localhost:8086/write?db=homeassistant" \ -u "homeassistant:your_password" \ --data-binary ' temperature,room=living_room value=23.5 temperature,room=bedroom value=21.2 humidity,room=living_room value=45.0 ' ``` -------------------------------- ### Configure Home Assistant InfluxDB Integration Source: https://github.com/hassio-addons/addon-influxdb/blob/main/influxdb/DOCS.md This snippet shows the configuration required in Home Assistant's configuration.yaml file to connect to an InfluxDB instance. It specifies the host, port, database name, username, password, and other connection parameters. ```yaml influxdb: host: a0d7b954-influxdb port: 8086 database: homeassistant username: homeassistant password: max_retries: 3 default_measurement: state ``` -------------------------------- ### Configure InfluxDB Authentication Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Demonstrates the `auth` configuration option for the InfluxDB add-on. It shows how to enable or disable user authentication for InfluxDB, with enabling authentication being the recommended setting. ```yaml # Recommended: Enable authentication auth: true # Not recommended: Disable authentication (for testing only) auth: false ``` -------------------------------- ### Backup and Restore InfluxDB Databases (influxd) Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt These commands use the `influxd` utility to perform backup and restore operations for InfluxDB databases. They require access to the RPC service port (8088) and specify the host, port, and backup directory. Operations include backing up all databases, a specific database, and restoring from a backup. ```bash influxd backup -portable -host localhost:8088 /share/influxdb_backup influxd backup -portable -host localhost:8088 -database homeassistant /share/influxdb_backup influxd restore -portable -host localhost:8088 /share/influxdb_backup influxd restore -portable -host localhost:8088 -database homeassistant /share/influxdb_backup ``` -------------------------------- ### Configure InfluxDB Environment Variables Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Shows how to set custom InfluxDB environment variables using the `envvars` configuration option. This allows for advanced configuration of InfluxDB, such as enabling HTTP logging or setting query limits. ```yaml # Example: Configure HTTP logging and query limits envvars: - name: INFLUXDB_HTTP_LOG_ENABLED value: "true" - name: INFLUXDB_COORDINATOR_MAX_SELECT_POINT value: "0" - name: INFLUXDB_DATA_CACHE_MAX_MEMORY_SIZE value: "1073741824" ``` -------------------------------- ### Manage InfluxDB Retention Policies and Databases (curl) Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt These commands use curl to interact with the InfluxDB HTTP API for managing retention policies and databases. They require the InfluxDB host, port, and authentication credentials. The commands demonstrate creating a retention policy, showing databases, and listing measurements within a specific database. ```bash curl -X POST "http://localhost:8086/query" \ -u "admin:admin_password" \ --data-urlencode "q=CREATE RETENTION POLICY \"30_days\" ON \"homeassistant\" DURATION 30d REPLICATION 1 DEFAULT" curl -G "http://localhost:8086/query" \ -u "admin:admin_password" \ --data-urlencode "q=SHOW DATABASES" curl -G "http://localhost:8086/query" \ -u "admin:admin_password" \ --data-urlencode "db=homeassistant" \ --data-urlencode "q=SHOW MEASUREMENTS" ``` -------------------------------- ### Manage InfluxDB Users and Permissions (curl) Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt These bash commands utilize curl to manage user accounts and their permissions within InfluxDB. They demonstrate creating a new user with a password, granting read access to a specific database, and granting all privileges to a user. Authentication with an admin user is required. ```bash curl -X POST "http://localhost:8086/query" \ -u "admin:admin_password" \ --data-urlencode "q=CREATE USER grafana WITH PASSWORD 'secure_password'" curl -X POST "http://localhost:8086/query" \ -u "admin:admin_password" \ --data-urlencode "q=GRANT READ ON homeassistant TO grafana" curl -X POST "http://localhost:8086/query" \ -u "admin:admin_password" \ --data-urlencode "q=GRANT ALL PRIVILEGES TO homeassistant" ``` -------------------------------- ### Grafana InfluxDB Datasource Configuration (YAML) Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt This YAML snippet defines the configuration for an InfluxDB data source within Grafana. It specifies the data source name, type, URL, database details, and user credentials. Sensitive information like the password should be handled securely using `secureJsonData`. ```yaml apiVersion: 1 datasources: - name: InfluxDB type: influxdb access: proxy url: http://a0d7b954-influxdb:8086 database: homeassistant user: grafana secureJsonData: password: your_grafana_user_password jsonData: httpMode: GET ``` -------------------------------- ### InfluxDB HTTP API - Database Management Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Endpoints for managing databases within InfluxDB, such as creating new databases. ```APIDOC ## POST /query (for Database Management) ### Description Manages databases within InfluxDB, including creating new ones. ### Method POST ### Endpoint `/query` ### Parameters #### Query Parameters - **q** (string) - Required - The database management command (e.g., `CREATE DATABASE mydb`). #### Authentication Requires authentication with appropriate privileges (e.g., admin user). ### Request Example ```bash # Create a new database curl -X POST "http://localhost:8086/query" \ -u "admin:admin_password" \ --data-urlencode "q=CREATE DATABASE mydb" ``` ### Response #### Success Response (200 OK) Indicates the command was successfully executed. #### Error Response (4xx/5xx) Details about the error during database management. ``` -------------------------------- ### InfluxDB Add-on Port Configuration (YAML) Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt This YAML configuration snippet defines the network ports exposed by the InfluxDB add-on. It maps host ports to container ports for the InfluxDB HTTP API (8086) and the RPC service (8088). The web interface port (80) is noted as handled by ingress. ```yaml ports: 80/tcp: null # Web interface (handled by ingress, not required externally) 8086/tcp: 8086 # InfluxDB HTTP API 8088/tcp: 8088 # RPC service for backup and restore ``` -------------------------------- ### InfluxDB HTTP API - Query Data Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Endpoints for querying data from the InfluxDB database using InfluxQL or Flux. ```APIDOC ## GET/POST /query ### Description Queries data from the InfluxDB database using InfluxQL or Flux. ### Method GET (for InfluxQL with URL parameters) POST (for Flux or complex InfluxQL queries) ### Endpoint `/query` ### Parameters #### Query Parameters (for GET requests) - **db** (string) - Required - The name of the database to query. - **q** (string) - Required - The InfluxQL query string. #### Request Body (for POST requests) - **db** (string) - Required - The name of the database to query. - **q** (string) - Required - The InfluxQL query string. - **data** (string) - Required for Flux - The Flux query string. ### Request Example ```bash # Query using InfluxQL curl -G "http://localhost:8086/query" \ -u "homeassistant:your_password" \ --data-urlencode "db=homeassistant" \ --data-urlencode "q=SELECT * FROM temperature WHERE time > now() - 1h" # Query with Flux (POST request) curl -X POST "http://localhost:8086/api/v2/query" \ -u "homeassistant:your_password" \ -H "Content-Type: application/vnd.flux" \ --data 'from(bucket: "homeassistant") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "temperature")' ``` ### Response #### Success Response (200 OK) - **results** (array) - An array of query results. #### Response Example (InfluxQL) ```json { "results": [ { "statement_id": 0, "series": [ { "name": "temperature", "columns": ["time", "room", "value"], "values": [ ["2023-10-27T10:00:00Z", "living_room", 23.5], ["2023-10-27T10:05:00Z", "living_room", 23.6] ] } ] } ] } ``` #### Error Response (4xx/5xx) Details about the error during query execution. ``` -------------------------------- ### InfluxDB HTTP API - Write Data Source: https://context7.com/hassio-addons/addon-influxdb/llms.txt Endpoints for writing data points to the InfluxDB database. Supports writing single or multiple points in a single request. ```APIDOC ## POST /write ### Description Writes data points to the InfluxDB database. ### Method POST ### Endpoint `/write?db=` ### Parameters #### Query Parameters - **db** (string) - Required - The name of the database to write to. #### Request Body - **data** (string) - Required - The data points in InfluxDB line protocol format. ### Request Example ```bash # Write a single point curl -X POST "http://localhost:8086/write?db=homeassistant" \ -u "homeassistant:your_password" \ --data-binary "temperature,room=living_room value=23.5 $(date +%s)000000000" # Write multiple points curl -X POST "http://localhost:8086/write?db=homeassistant" \ -u "homeassistant:your_password" \ --data-binary 'temperature,room=living_room value=23.5 temperature,room=bedroom value=21.2 humidity,room=living_room value=45.0' ``` ### Response #### Success Response (204 No Content) Indicates the data was successfully written. #### Error Response (4xx/5xx) Details about the error during data writing. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.