Skip to content

Commit a7c33dd

Browse files
committed
add host os information to monitoring data
1 parent 9e19932 commit a7c33dd

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/server/extension/monitoring-endpoint.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,34 @@ process.stdin.on('end', () => {
423423
return { ram, cpu, }
424424
}
425425

426+
function getHostOS() {
427+
try {
428+
const content = fs.readFileSync('/fylr/files/host-os-release', 'utf8');
429+
const lines = content.split('\n');
430+
const osInfo = {};
431+
432+
lines.forEach(line => {
433+
if (line.includes('=')) {
434+
let [key, value] = line.split('=');
435+
// Remove any surrounding quotes
436+
value = value.replace(/^"(.*)"$/, '$1');
437+
osInfo[key] = value;
438+
}
439+
});
440+
441+
return {
442+
id: osInfo['ID'],
443+
versionId: osInfo['VERSION_ID'],
444+
prettyName: osInfo['PRETTY_NAME'],
445+
codename: osInfo['VERSION_CODENAME'],
446+
};
447+
448+
} catch (error) {
449+
throwError("Fehler beim Auslesen des Host OS:" + error, '');
450+
return null;
451+
}
452+
}
453+
426454
function getPostgresVersion(dsn) {
427455
return new Promise(async (resolve, reject) => {
428456
try {
@@ -474,6 +502,10 @@ process.stdin.on('end', () => {
474502
// get ram, ram_quota, number of cpus, and cpu_quota
475503
result.assigned_hardware = getHardwareStats();
476504

505+
//////////////////////////////////////////////////////////////
506+
// get ram, ram_quota, number of cpus, and cpu_quota
507+
// result.host_data = getHostOS();
508+
477509
//////////////////////////////////////////////////////////////
478510
// check mysql-backups, a successfull backup from yesterday is wanted
479511
result.sqlbackups = infoData[11];

0 commit comments

Comments
 (0)