This MagicMirror modules, shows the processor temperature, system load, available RAM, uptime and free disk space of localhost or a remote host.
Tested with:
- Raspberry Pi
- Ubuntu 18.04 (remote host)
- An installation of MagicMirror2
- npm
- async
- optional: ssh login without password on the remote host (https://www.linuxtrainingacademy.com/ssh-login-without-password/)
- optional: lm-sensors on the remote host (https://github.com/lm-sensors/lm-sensors)
Navigate into your MagicMirror's modules folder:
cd ~/MagicMirror/modules
Clone this repository:
git clone https://github.com/BenRoe/MMM-SystemStats
Navigate to the new MMM-SystemStats folder and install the node dependencies.
cd MMM-SystemStats/ && npm install
Configure the module in your config.js file.
Navigate into the MMM-SystemStats folder with cd ~/MagicMirror/modules/MMM-SystemStats and get the latest code from Github with git pull.
If you haven't changed the modules, this should work without any problems. Type git status to see your changes, if there are any, you can reset them with git reset --hard. After that, git pull should be possible.
To use this module, add it to the modules array in the config/config.js file:
modules: [
{
// basic configuration for local raspberry
module: 'MMM-SystemStats',
position: 'top_center', // This can be any of the regions.
// classes: 'small dimmed', // Add your own styling. OPTIONAL.
// header: 'System Stats', // Set the header text OPTIONAL
config: {
updateInterval: 10000, // every 10 seconds
align: 'right', // align labels
//header: 'System Stats', // This is optional
units: 'metric', // default, metric, imperial
view: 'textAndIcon',
},
},
{
// advanced configuration for remote host, e.g. ubuntu linux server
module: 'MMM-SystemStats',
position: 'top_center', // This can be any of the regions.
classes: 'small dimmed', // Add your own styling. OPTIONAL.
header: 'Ubuntu', // Set the header text OPTIONAL
config: {
updateInterval: 30000, // every 30 seconds
align: 'left', // align labels
label: 'icon',
host: 'hostname',
remoteUser: 'remoteuser',
freeSpaceCmd: "df -h|grep /dev/nvme0n1p2|awk '{print $4}'",
freeMemCmd: "free | awk '/^Speicher:/ {print $4*100/$2}'",
cpuTempCmd: "sensors | grep 'Package id 0'",
cpuTempReplace: [['Package id 0: +',''],['(high = +100.0°C, crit = +100.0°C)','']],
},
},
]The following properties can be configured:
| Option | Description |
|---|---|
updateInterval |
How often does the content needs to be fetched? (Milliseconds)
Possible values: 1000 - 86400000
Default value: 10000 (10 seconds)
|
animationSpeed |
Speed of the update animation. (Milliseconds)
Possible values: 0 - 5000
Default value: 0 (animation off)
|
language |
language id for text can be different from MM.
Default value: config.language
|
align |
Align the labels.
Possible values: left or right
Default value: right
|
label |
Show text labels with icons, only text, or only icons.
Possible values: textAndIcon, text or icon
Default value: textAndIcon
|
useSyslog |
log event to MMM-syslog?
Default value: false
|
thresholdCPUTemp |
upper-threshold for CPU Temp. If CPU Temp is more than this value, log to MMM-syslog if useSyslog=true. (celcius)
Default value: 70
|
baseURLSyslog |
URL base of MMM-syslog module
Default value: http://127.0.0.1:8080/syslog
|
| Option | Description |
|---|---|
host |
A name or address of the host to get the system stats from.
Only necessary if you want to get the stats from a remote host.
Default value: localhost
|
remoteUser |
The user to connect to the remote host.
Only used for host other then localhost.
User must be able to connect via ssh to remote host without entering a password, i.e. public key authentication must be setup.
Default value: stats
|
cpuTempCmd |
Command to get the cpu temperature.
Default value is for raspberry pi.
For usage with lm-sensors use something like "sensors | grep 'Package id 0'".
Example values: 'awk \'{printf("%.1f°C\\n",$1/1e3)}\' /sys/class/thermal/thermal_zone0/temp' for metric unit °C
'awk \'{printf("%.1f°F\\n",(($1*1.8)/1e3)+32)}\' /sys/class/thermal/thermal_zone0/temp' for imperial unit °F
'awk \'{printf("%.1f°K\\n",($1/1e3)+273.15)}\' /sys/class/thermal/thermal_zone0/temp' for absolute unit °K
Default value: '/opt/vc/bin/vcgencmd measure_temp'
|
sysLoadCmd |
Command to get the system load.
Default value is for raspberry pi.
Default value: 'cat /proc/loadavg'
|
freeMemCmd |
Command to get the free memory.
Default value is for raspberry pi.
For german language use "free | awk '/^Speicher:/ {print $4*100/$2}'".
Default value: "free | awk '/^Mem:/ {print $4*100/$2}'"
|
upTimeCmd |
Command to get the uptime.
Default value is for raspberry pi.
Default value: 'cat /proc/uptime'
|
freeSpaceCmd |
Command to get the free disc space.
Default value is for raspberry pi.
For other systems use something like "df -h|grep /dev/%your_disc%|awk '{print $4}'" and replace %your_disc% with an appropriate value.
Default value: "df -h|grep /dev/root|awk '{print $4}'"
|
cpuTempSplit |
A delimiter to split the result of the cpuTempCmd.
Default value is for raspberry pi.
Default value: ''
|
sysLoadSplit |
A delimiter to split the result of the sysLoadCmd.
Default value is for raspberry pi.
Default value: ' '
|
freeMemSplit |
A delimiter to split the result of the freeMemCmd.
Default value is for raspberry pi.
Default value: ''
|
upTimeSplit |
A delimiter to split the result of the upTimeCmd.
Default value is for raspberry pi.
Default value: ' '
|
freeSpaceSplit |
A delimiter to split the result of the freeSpaceCmd.
Default value is for raspberry pi.
Default value: ''
|
cpuTempReplace |
An Array of replacement pairs. Will be applied after the split to the result of the cpuTempCmd.
Default value is for raspberry pi.
For usage with lm-sensors use something like [['Package id 0: +',''],['(high = +100.0°C, crit = +100.0°C)','']].
Default value: [['temp=',''],['\'','\°']]
|
sysLoadReplace |
An Array of replacement pairs. Will be applied after the split to the result of the sysLoadCmd.
Default value is for raspberry pi.
Default value: []
|
freeMemReplace |
An Array of replacement pairs. Will be applied after the split to the result of the freeMemCmd.
Default value is for raspberry pi.
Default value: []
|
upTimeReplace |
An Array of replacement pairs. Will be applied after the split to the result of the upTimeCmd.
Default value is for raspberry pi.
Default value: []
|
freeSpaceReplace |
An Array of replacement pairs. Will be applied after the split to the result of the freeSpaceCmd.
Default value is for raspberry pi.
Default value: []
|
- better indication for the system load
