A small fast tool to get an overview of the system including load, storage usage, temperature and services.
git clone git@github.com:scratchcat1/sysstatus.git
cd sysstatus
cargo build
cargo run
or cargo run --release
cargo run -- -c /path/to/config.json
``` sysstatus 0.1.0
USAGE: sysstatus [OPTIONS]
FLAGS: -h, --help Prints help information -V, --version Prints version information
OPTIONS:
-c, --config-file-path
sysstatus
requires a configuration file to run, by default looking for $HOME/.config/sysstatus/config.json
.
To specify a config file manually use sysstatus -c /path/to/config.json
.
A default config can be generated with sysstatus --default-config
.
Colors must use values which deserialise to a colored::Color
, see the enum here.
Valid examples include "Black"
, "BrightCyan"
and {
"TrueColor": {
"r": 3,
"g": 4,
"b": 255
}
}
ConditionalColour
allows text colours to be selected dynamically depending on the value of the attribute. Each ConditionalColour
has a default colour and zero or more ColourLevel
resulting in a definition as follows:
json
{
"default_colour": "Green",
"levels": [
{
"min": 0.5,
"colour": "Yellow"
},
{
"min": 0.8,
"colour": "Red"
}
]
}
ConditionalColour
s are evaluated by selecting the furthest colour down the list for which the comparison value is greater than or equal to min
. The min
of each level must increase as the list is traversed or behaviour is undefined.
In the example: - 0.1 => Green - 0.49 => Green - 0.5 => Yellow - 0.7 => Yellow - 0.8 => Red - 10.0 => Red
``jsonc
{
"general_info": {
// ConditionalColour for load average. Comparison value = load / cores.
"load_avg": {
"default_colour": "Green",
"levels": [
{
"min": 0.5,
"colour": "Yellow"
},
{
"min": 0.8,
"colour": "Red"
}
]
},
// Conditional Colour for memory usage. Comparison value = used / total.
"memory": {
"default_colour": "Green",
"levels": [
{
"min": 0.7,
"colour": "Yellow"
},
{
"min": 0.9,
"colour": "Red"
}
]
},
// ConditionalColour for CPU frequency. Comparison value = CPU frequency in MHz.
"cpu_frequency": {
"default_colour": "Green",
"levels": [
{
"min": 2000,
"colour": "Yellow"
},
{
"min": 2400,
"colour": "Red"
}
]
}
},
"storage": {
// ConditionalColour for colouring the usage bars of storage usage. Comparison value = used / total.
"usage_colouring": {
"default_colour": "Green",
"levels": [
{
"min": 0.8,
"colour": "Yellow"
},
{
"min": 0.9,
"colour": "Red"
}
]
},
"exclude_prefixes": [
"/var/lib/docker/"
]
},
// ConditionalColour for temperature. Comparison value = temperature of component.
"temperature": {
"default_colour": "Green",
"levels": [
{
"min": 70,
"colour": "Yellow"
},
{
"min": 85,
"colour": "Red"
}
]
},
// Map of service names to service configurations
// The ending .service is not needed.
"services": {
"docker": {
// ConditionalColour for memory usage of service. Comparison value = memory usage in bytes.
"memory_usage": {
"default_colour": "White",
"levels": [
{
"min": 2000,
"colour": "Yellow"
},
{
"min": 2400,
"colour": "Red"
}
]
}
},
"ntp": {},
"ufw": {}
},
// Configuration for last login section.
"last_login": {
// Optionally only include logins which occur before a certain time.
// Accepts any value which
last --sinceaccepts e.g.
+5days,
yesterday`.
"since": "yesterday",
// Mapping of usernames to fetch the last logins for to the configuration for that user's last login.
"users": {
"pi": {
// Optionally limit the maximum number of logins shown of the user.
"max_lines": 4
},
"root": {
// Optionally set the colour of the username.
"username_colour": "Red"
}
}
}
} ```
This program is partly derived from rust-motd
particularly in regards to formatting and handling last login parsing.