Skip to content

Commit

Permalink
Add systeminfo
Browse files Browse the repository at this point in the history
  • Loading branch information
KristjanESPERANTO committed Jan 3, 2024
1 parent 5f7b56e commit 9ac84e3
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror².
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/#donate) With your help we can continue to improve the MagicMirror².

## [2.27.0] - Develop Branch (unreleased)

_This release is scheduled to be released on 2024-04-01._

### Added

- Output of system information to the console for troubleshooting (#3328).

### Updated

### Fixed
Expand Down
3 changes: 3 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const defaultModules = require(`${__dirname}/../modules/default/defaultmodules`)
global.version = require(`${__dirname}/../package.json`).version;
Log.log(`Starting MagicMirror: v${global.version}`);

// Log system information.
Utils.logSystemInformation();

// global absolute root path
global.root_path = path.resolve(`${__dirname}/../`);

Expand Down
22 changes: 22 additions & 0 deletions js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,34 @@
* MIT Licensed.
*/
const colors = require("colors/safe");
const Log = require("logger");
const si = require("systeminformation");

try {
global.electronVersion = require(`${__dirname}/../node_modules/electron/package.json`).version;
} catch (error) {
Log.error(`Can't find electron. Have you performed 'npm run install-mm'? ${error}`);
}

module.exports = {
colors: {
warn: colors.yellow,
error: colors.red,
info: colors.blue,
pass: colors.green
},

async logSystemInformation () {
try {
const staticData = await si.getStaticData();
let systemDataString = "The following lines provide information about your system and may be of interest when troubleshooting.";
systemDataString += `\n ### SYSTEM: manufacturer: ${staticData["system"]["manufacturer"]}; model: ${staticData["system"]["model"]}; raspberry: ${staticData["system"]["raspberry"]}; virtual: ${staticData["system"]["virtual"]}`;
systemDataString += `\n ### OS: platform: ${staticData["os"]["platform"]}; distro: ${staticData["os"]["distro"]}; release: ${staticData["os"]["release"]}`;
systemDataString += `\n ### VERSIONS: MagicMirror: ${global.version}; electron: ${global.electronVersion}; kernel: ${staticData["versions"]["kernel"]}; node: ${staticData["versions"]["node"]}; npm: ${staticData["versions"]["npm"]}; pm2: ${staticData["versions"]["pm2"]}; docker: ${staticData["versions"]["docker"]}`;
if (typeof staticData["dockerInfo"] !== "undefined") systemDataString += `\n ### DOCKER: containers: ${staticData["dockerInfo"]["containers"]}; operatingSystem: ${staticData["dockerInfo"]["operatingSystem"]}; osType: ${staticData["versions"]["osType"]}; architecture: ${staticData["versions"]["architecture"]}; serverVersion: ${staticData["versions"]["serverVersion"]}`;
Log.info(systemDataString);
} catch (e) {
Log.error(e);
}
}
};
28 changes: 27 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
"module-alias": "^2.2.3",
"moment": "^2.30.1",
"node-ical": "^0.17.1",
"socket.io": "^4.7.2"
"socket.io": "^4.7.2",
"systeminformation": "^5.21.22"
},
"lint-staged": {
"*": "prettier --write",
Expand Down

0 comments on commit 9ac84e3

Please sign in to comment.