mirror of
https://github.com/hassio-addons/addon-glances.git
synced 2025-05-05 03:21:36 +00:00
add support influxdb2 (#311)Co-authored-by: Franck Nijhof <git@frenck.dev>
* add support influxdb2 * Tiny cleanup/styling --------- Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
eda9066b07
commit
a0a700b373
5 changed files with 97 additions and 33 deletions
|
@ -39,12 +39,20 @@ influxdb:
|
||||||
enabled: false
|
enabled: false
|
||||||
host: a0d7b954-influxdb
|
host: a0d7b954-influxdb
|
||||||
port: 8086
|
port: 8086
|
||||||
|
interval: 60
|
||||||
|
ssl: false
|
||||||
|
prefix: localhost
|
||||||
|
version: 1 # Either 1 or 2
|
||||||
|
|
||||||
|
# Version 1
|
||||||
username: glances
|
username: glances
|
||||||
password: "!secret glances_influxdb_password"
|
password: "!secret glances_influxdb_password"
|
||||||
database: glances
|
database: glances
|
||||||
prefix: localhost
|
|
||||||
interval: 60
|
# Version 2
|
||||||
ssl: false
|
token: "!secret glances_influxdb2_token"
|
||||||
|
bucket: glances
|
||||||
|
org: myorg
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note**: _This is just an example, don't copy and paste it! Create your own!_
|
**Note**: _This is just an example, don't copy and paste it! Create your own!_
|
||||||
|
@ -119,28 +127,6 @@ use `a0d7b954-influxdb` as the hostname._
|
||||||
|
|
||||||
The port on which InfluxDB is listening.
|
The port on which InfluxDB is listening.
|
||||||
|
|
||||||
#### Option `influxdb`: `username`
|
|
||||||
|
|
||||||
The username that you have created for Glances to authenticate against
|
|
||||||
InfluxDB.
|
|
||||||
|
|
||||||
#### Option `influxdb`: `password`
|
|
||||||
|
|
||||||
The password for the above username option.
|
|
||||||
|
|
||||||
#### Option `influxdb`: `database`
|
|
||||||
|
|
||||||
The name of the database to store all Glances information into.
|
|
||||||
|
|
||||||
**Note**: _It is strongly recommended to create a separate database for glances
|
|
||||||
and not store this in the same database name as Home Assistant._
|
|
||||||
|
|
||||||
#### Option `prefix`: `localhost`
|
|
||||||
|
|
||||||
The hostname to append for exported data.
|
|
||||||
|
|
||||||
**Note**: _For the Grafana Glances dashboard set this to `localhost`._
|
|
||||||
|
|
||||||
#### Option `influxdb`: `interval`
|
#### Option `influxdb`: `interval`
|
||||||
|
|
||||||
Defines the interval (in seconds) on how often Glances exports data to InfluxDB.
|
Defines the interval (in seconds) on how often Glances exports data to InfluxDB.
|
||||||
|
@ -151,6 +137,60 @@ Adding this option will allow SSL to be used on the InfluxDB connection. If not
|
||||||
set will default to `false` which is the required setting for the Community
|
set will default to `false` which is the required setting for the Community
|
||||||
InfluxDB add-on.
|
InfluxDB add-on.
|
||||||
|
|
||||||
|
#### Option `influxdb`: `prefix`
|
||||||
|
|
||||||
|
The hostname to append for exported data.
|
||||||
|
|
||||||
|
**Note**: _For the Grafana Glances dashboard set this to `localhost`._
|
||||||
|
|
||||||
|
#### Option `influxdb`: `version`
|
||||||
|
|
||||||
|
The influxdb version to connecting. Either **1** or **2**.
|
||||||
|
|
||||||
|
#### Option `influxdb`: `username`
|
||||||
|
|
||||||
|
> Applied to version 1 only
|
||||||
|
|
||||||
|
The username that you have created for Glances to authenticate against
|
||||||
|
InfluxDB.
|
||||||
|
|
||||||
|
#### Option `influxdb`: `password`
|
||||||
|
|
||||||
|
> Applied to version 1 only
|
||||||
|
|
||||||
|
The password for the above username option.
|
||||||
|
|
||||||
|
#### Option `influxdb`: `database`
|
||||||
|
|
||||||
|
> Applied to version 1 only
|
||||||
|
|
||||||
|
The name of the database to store all Glances information into.
|
||||||
|
|
||||||
|
**Note**: _It is strongly recommended to create a separate database for glances
|
||||||
|
and not store this in the same database name as Home Assistant._
|
||||||
|
|
||||||
|
#### Option `influxdb`: `token`
|
||||||
|
|
||||||
|
> Applied to version 2 only
|
||||||
|
|
||||||
|
An InfluxDB token with permissions to write to the given bucket. This should
|
||||||
|
look like `t9iHPiGQyg0ds4K1IlBrCyBsNGh71dkdR6u8Y9eeR37UzfGuFukFCdbMI4YA9EtKb4zr5coFXKw67tbBEP7CPw==`
|
||||||
|
|
||||||
|
#### Option `influxdb`: `bucket`
|
||||||
|
|
||||||
|
> Applied to version 1 only
|
||||||
|
|
||||||
|
The name of the bucket to store all Glances information into.
|
||||||
|
|
||||||
|
**Note**: _It is strongly recommended to create a separate bucket for glances
|
||||||
|
and not store this in the same bucket as Home Assistant._
|
||||||
|
|
||||||
|
#### Option `influxdb`: `organization`
|
||||||
|
|
||||||
|
> Applied to version 1 only
|
||||||
|
|
||||||
|
The InfluxDB organization that owns the given bucket.
|
||||||
|
|
||||||
## Adding Glances as a sensor into Home Assistant
|
## Adding Glances as a sensor into Home Assistant
|
||||||
|
|
||||||
The Home Assistant Glances sensor platform is consuming the system information
|
The Home Assistant Glances sensor platform is consuming the system information
|
||||||
|
|
|
@ -45,11 +45,16 @@ options:
|
||||||
enabled: false
|
enabled: false
|
||||||
host: a0d7b954-influxdb
|
host: a0d7b954-influxdb
|
||||||
port: 8086
|
port: 8086
|
||||||
|
interval: 60
|
||||||
|
ssl: false
|
||||||
|
version: 1
|
||||||
username: glances
|
username: glances
|
||||||
password: ""
|
password: ""
|
||||||
database: glances
|
database: glances
|
||||||
prefix: localhost
|
prefix: localhost
|
||||||
interval: 60
|
token: ""
|
||||||
|
bucket: glances
|
||||||
|
org: myorg
|
||||||
schema:
|
schema:
|
||||||
log_level: list(trace|debug|info|notice|warning|error|fatal)
|
log_level: list(trace|debug|info|notice|warning|error|fatal)
|
||||||
process_info: bool
|
process_info: bool
|
||||||
|
|
|
@ -2,6 +2,7 @@ bottle==0.12.25
|
||||||
docker==6.0.1
|
docker==6.0.1
|
||||||
glances==3.3.1.1
|
glances==3.3.1.1
|
||||||
influxdb==5.3.1
|
influxdb==5.3.1
|
||||||
|
influxdb-client==1.21.0
|
||||||
netifaces==0.11.0
|
netifaces==0.11.0
|
||||||
paho-mqtt==1.6.1
|
paho-mqtt==1.6.1
|
||||||
psutil==5.9.4
|
psutil==5.9.4
|
||||||
|
|
|
@ -21,17 +21,30 @@ fi
|
||||||
if bashio::config.true 'influxdb.enabled'; then
|
if bashio::config.true 'influxdb.enabled'; then
|
||||||
protocol='http'
|
protocol='http'
|
||||||
if bashio::config.true 'influxdb.ssl'; then
|
if bashio::config.true 'influxdb.ssl'; then
|
||||||
protocol='https'
|
protocol='https'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Modify the configuration
|
# Modify the configuration
|
||||||
|
if bashio::config.equals 'influxdb.version' '1'; then
|
||||||
|
{
|
||||||
|
echo "[influxb]"
|
||||||
|
echo "user=$(bashio::config 'influxdb.username')"
|
||||||
|
echo "password=$(bashio::config 'influxdb.password')"
|
||||||
|
echo "db=$(bashio::config 'influxdb.database')"
|
||||||
|
} >> /etc/glances.conf
|
||||||
|
elif bashio::config.equals 'influxdb.version' '2'; then
|
||||||
|
{
|
||||||
|
echo "[influxb2]"
|
||||||
|
echo "org=$(bashio::config 'influxdb.organization')"
|
||||||
|
echo "bucket=$(bashio::config 'influxdb.bucket')"
|
||||||
|
echo "token=$(bashio::config 'influxdb.token')"
|
||||||
|
} >> /etc/glances.conf
|
||||||
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "[influxdb]"
|
echo "protocol=${protocol}"
|
||||||
echo "host=$(bashio::config 'influxdb.host')"
|
echo "host=$(bashio::config 'influxdb.host')"
|
||||||
echo "port=$(bashio::config 'influxdb.port')"
|
echo "port=$(bashio::config 'influxdb.port')"
|
||||||
echo "user=$(bashio::config 'influxdb.username')"
|
|
||||||
echo "password=$(bashio::config 'influxdb.password')"
|
|
||||||
echo "db=$(bashio::config 'influxdb.database')"
|
|
||||||
echo "prefix=$(bashio::config 'influxdb.prefix')"
|
echo "prefix=$(bashio::config 'influxdb.prefix')"
|
||||||
echo "protocol=${protocol}"
|
|
||||||
} >> /etc/glances.conf
|
} >> /etc/glances.conf
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -10,9 +10,14 @@ if bashio::config.false 'influxdb.enabled'; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
options+=(-C /etc/glances.conf)
|
options+=(-C /etc/glances.conf)
|
||||||
options+=(--export influxdb)
|
|
||||||
options+=(--quiet)
|
options+=(--quiet)
|
||||||
|
|
||||||
|
if bashio::config.equals 'influxdb.version' '2'; then
|
||||||
|
options+=(--export influxdb2)
|
||||||
|
else
|
||||||
|
options+=(--export influxdb)
|
||||||
|
fi
|
||||||
|
|
||||||
options+=(--time "$(bashio::config 'refresh_time')")
|
options+=(--time "$(bashio::config 'refresh_time')")
|
||||||
|
|
||||||
if bashio::config.false 'process_info'; then
|
if bashio::config.false 'process_info'; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue