Configuration¶
powermonitor works without a config file, but you can create ~/.powermonitor/config.toml to customize the TUI, SQLite database path, CLI defaults, and logging level.
Create a default config¶
The command creates a commented config file and refuses to overwrite an existing file.
Show the effective config¶
This prints the config file path, whether the file exists, the database path, and the effective values after defaults are applied.
Validate the config file¶
Validation checks TOML syntax, supported sections, supported keys, and value ranges before you launch the TUI.
Config file format¶
# powermonitor configuration file
[tui]
interval = 1.0 # Data collection interval in seconds
stats_limit = 100 # Number of readings for statistics
chart_limit = 60 # Number of readings to display in chart
[database]
path = "~/.powermonitor/powermonitor.db" # Database file location
[cli]
default_history_limit = 20 # Default limit for history command
default_export_limit = 1000 # Default limit for export command
[logging]
level = "INFO" # DEBUG, INFO, WARNING, or ERROR
Precedence¶
Configuration priority is:
- CLI arguments
~/.powermonitor/config.toml- Built-in defaults
For example, powermonitor --interval 0.5 overrides [tui].interval for that run only.
Common examples¶
Store data in Documents¶
Collect every two seconds¶
Keep larger default command windows¶
Enable debug logs by default¶
Valid values¶
| Setting | Type | Rule |
|---|---|---|
tui.interval |
number | Must be positive |
tui.stats_limit |
integer | Must be positive |
tui.chart_limit |
integer | Must be positive |
database.path |
string | ~ is expanded |
cli.default_history_limit |
integer | Must be positive |
cli.default_export_limit |
integer | Must be positive |
logging.level |
string | DEBUG, INFO, WARNING, or ERROR |
Very short intervals below 0.1 seconds are accepted but trigger a performance warning.