Add limitation to TimescaleDB export for diskio, not working for the moment

This commit is contained in:
nicolargo 2025-11-01 16:43:56 +01:00
parent bdd66c56d3
commit 54068209b3
5 changed files with 679 additions and 4561 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@ be added as a column in the table (named key_id) and added to the timescaledb.se
Current limitations
-------------------
Sensors and Fs plugins are not supported by the TimescaleDB exporter.
Sensors, Fs and DiskIO plugins are not supported by the TimescaleDB exporter.
In the cpu plugin, the user field is exported as user_cpu (user_percpu in the percpu plugin)
because user is a reserved keyword in PostgreSQL.

View File

@ -83,6 +83,9 @@ class Export(GlancesExport):
if isinstance(value, bool):
return str(value).upper()
if isinstance(value, (list, tuple)):
# Special case for list of one boolean
if len(value) == 1 and isinstance(value[0], bool):
return str(value[0]).upper()
return ', '.join([f"'{v}'" for v in value])
if isinstance(value, str):
return f"'{value}'"
@ -95,8 +98,8 @@ class Export(GlancesExport):
return False
# Get all the stats & limits
# Current limitation with sensors and fs plugins because fields list is not the same
self._last_exported_list = [p for p in self.plugins_to_export(stats) if p not in ['sensors', 'fs']]
# @TODO: Current limitation with sensors, fs and diskio plugins because fields list is not the same
self._last_exported_list = [p for p in self.plugins_to_export(stats) if p not in ['sensors', 'fs', 'diskio']]
all_stats = stats.getAllExportsAsDict(plugin_list=self.last_exported_list())
all_limits = stats.getAllLimitsAsDict(plugin_list=self.last_exported_list())
@ -159,6 +162,9 @@ class Export(GlancesExport):
continue
# Export stats to TimescaleDB
# logger.info(plugin)
# logger.info(f"Segmented by: {segmented_by}")
# logger.info(list(zip(creation_list, values_list[0])))
self.export(plugin, creation_list, segmented_by, values_list)
return True

View File

@ -33,7 +33,6 @@ docker exec timescaledb-for-glances psql -d "postgres://postgres:password@localh
echo "Glances to export system stats to TimescaleDB (duration: ~ 20 seconds)"
.venv/bin/python -m glances --config ./conf/glances.conf --export timescaledb --stop-after 10 --quiet
docker exec timescaledb-for-glances psql -d "postgres://postgres:password@localhost/glances" -c "SELECT * from cpu;" --csv > /tmp/timescaledb-for-glances_cpu.csv
.venv/bin/python ./tests-data/tools/csvcheck.py -i /tmp/timescaledb-for-glances_cpu.csv -l 9