🔨Add optional configuration for history_size

This commit is contained in:
Paul Sinclair 2020-05-10 21:12:52 -04:00
parent dbe6d21d70
commit aef593030f
No known key found for this signature in database
GPG key ID: 779C7A23E1AA845D
3 changed files with 13 additions and 0 deletions

View file

@ -120,6 +120,11 @@ The private key file to use for SSL.
**Note**: _The file MUST be stored in `/ssl/`, which is the default_ **Note**: _The file MUST be stored in `/ssl/`, which is the default_
### Option: `history_size`
If specified changes the time Glances will retain data. Default if not set is
28800: 1 day with 1 point every 3 seconds.
### Option group `influxdb` ### Option group `influxdb`
--- ---

View file

@ -51,6 +51,7 @@
"ssl": "bool", "ssl": "bool",
"certfile": "str", "certfile": "str",
"keyfile": "str", "keyfile": "str",
"history_size": "int?",
"influxdb": { "influxdb": {
"enabled": "bool", "enabled": "bool",
"host": "str", "host": "str",

View file

@ -17,6 +17,13 @@ else
cp /etc/glances.conf /config/glances/ cp /etc/glances.conf /config/glances/
fi fi
# Set History Size
history_size=28800
if bashio::config.exists 'history_size'; then
history_size=$(bashio::config 'history_size')
fi
sed -i "s#history_size=28800#history_size=${history_size}#g" /etc/glances.conf
# Export Glances data to InfluxDB # Export Glances data to InfluxDB
if bashio::config.true 'influxdb.enabled'; then if bashio::config.true 'influxdb.enabled'; then
protocol='http' protocol='http'