improved SunOS support getStaticData(), getDynamicData()

This commit is contained in:
Sebastian Hildebrandt
2018-05-13 19:40:56 +02:00
parent 59a28eb1ca
commit f22a9ace3e
4 changed files with 43 additions and 24 deletions
+29 -20
View File
@@ -189,6 +189,7 @@ function getDynamicData(srv, iface, callback) {
let totalFunctions = 14;
if (_windows) totalFunctions = 10;
if (_freebsd || _openbsd) totalFunctions = 11;
if (_sunos) totalFunctions = 6;
return function () {
if (--totalFunctions === 0) {
@@ -244,53 +245,61 @@ function getDynamicData(srv, iface, callback) {
functionProcessed();
});
cpu.cpuTemperature().then(res => {
data.temp = res;
functionProcessed();
});
if (!_sunos) {
cpu.cpuTemperature().then(res => {
data.temp = res;
functionProcessed();
});
}
if (!_openbsd && !_freebsd) {
if (!_openbsd && !_freebsd && !_sunos) {
network.networkStats(iface).then(res => {
data.networkStats = res;
functionProcessed();
});
}
network.networkConnections().then(res => {
data.networkConnections = res;
functionProcessed();
});
if (!_sunos) {
network.networkConnections().then(res => {
data.networkConnections = res;
functionProcessed();
});
}
memory.mem().then(res => {
data.mem = res;
functionProcessed();
});
battery().then(res => {
data.battery = res;
functionProcessed();
});
if (!_sunos) {
battery().then(res => {
data.battery = res;
functionProcessed();
});
}
if (!_windows) {
if (!_windows && !_sunos) {
processes.services(srv).then(res => {
data.services = res;
functionProcessed();
});
}
filesystem.fsSize().then(res => {
data.fsSize = res;
functionProcessed();
});
if (!_sunos) {
filesystem.fsSize().then(res => {
data.fsSize = res;
functionProcessed();
});
}
if (!_windows && !_openbsd && !_freebsd) {
if (!_windows && !_openbsd && !_freebsd && !_sunos) {
filesystem.fsStats().then(res => {
data.fsStats = res;
functionProcessed();
});
}
if (!_windows && !_openbsd && !_freebsd) {
if (!_windows && !_openbsd && !_freebsd && !_sunos) {
filesystem.disksIO().then(res => {
data.disksIO = res;
functionProcessed();
+9
View File
@@ -254,6 +254,11 @@ function bios(callback) {
if (callback) { callback(result); }
resolve(result);
}
if (_sunos) {
result.vendor = 'Sun Microsystems';
if (callback) { callback(result); }
resolve(result);
}
if (_windows) {
// TODO: check BIOS windows
exec(util.getWmic() + ' bios get /value', opts, function (error, stdout) {
@@ -340,6 +345,10 @@ function baseboard(callback) {
resolve(result);
});
}
if (_sunos) {
if (callback) { callback(result); }
resolve(result);
}
if (_windows) {
exec(util.getWmic() + ' baseboard get /value', opts, function (error, stdout) {
if (!error) {