added NetBSD support
This commit is contained in:
parent
6eddcc2404
commit
c8c2786cb2
@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
||||
|
||||
| Version | Date | Comment |
|
||||
| -------------- | -------------- | -------- |
|
||||
| 4.7.0 | 2019-05-29 | partial netBSD support |
|
||||
| 4.6.1 | 2019-05-29 | get wmic path - fic windows |
|
||||
| 4.6.0 | 2019-05-27 | added `dockerInfo()` |
|
||||
| 4.5.1 | 2019-05-17 | updated docs |
|
||||
|
||||
@ -52,7 +52,7 @@ Lightweight collection of 40+ functions to retrieve detailed hardware, system an
|
||||
|
||||
- simple to use
|
||||
- get detailed information about system, cpu, baseboard, battery, memory, disks/filesystem, network, docker, software, services and processes
|
||||
- supports Linux, macOS, partial Windows, FreeBSD and SunOS support
|
||||
- supports Linux, macOS, partial Windows, FreeBSD, OpenBSD, NetBSD and SunOS support
|
||||
- no npm dependencies (for production)
|
||||
|
||||
### Installation
|
||||
@ -82,6 +82,7 @@ si.cpu()
|
||||
|
||||
(last 7 major and minor version releases)
|
||||
|
||||
- Version 4.7.0: partial NetBSD support
|
||||
- Version 4.6.0: added `dockerInfo()`
|
||||
- Version 4.5.0: `fsOpenFiles()` added open file descriptor count
|
||||
- Version 4.4.0: `dockerContainers()` added started, finished time
|
||||
@ -97,7 +98,7 @@ You can find all changes here: [detailed changelog][changelog-url]
|
||||
|
||||
[Node.js][nodejs-url] comes with some basic OS information, but I always wanted a little more. So I came up to write this little library. This library is still work in progress. It is supposed to be used as a backend/server-side library (will definilely not work within a browser). It requires node.js version 4.0 and above.
|
||||
|
||||
I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra, Mojave) and some Windows 7, Windows 10, FreeBSD and SunOS machines. Not all functions are supported on all operating systems. Have a look at the function reference in the docs to get further details.
|
||||
I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra, Mojave) and some Windows 7, Windows 10, FreeBSD, OpenBSD, NetBSD and SunOS machines. Not all functions are supported on all operating systems. Have a look at the function reference in the docs to get further details.
|
||||
|
||||
If you have comments, suggestions & reports, please feel free to contact me!
|
||||
|
||||
@ -723,7 +724,8 @@ Windows is a registered trademark of Microsoft Corporation. Node.js is a tradema
|
||||
Intel is a trademark of Intel Corporation, AMD is a trademark of Advanced Micro Devices Inc.,
|
||||
Raspberry Pi is a trademark of the Raspberry Pi Foundation, Debian is a trademark of the Debian Project,
|
||||
Ubuntu is a trademark of Canonical Ltd., FreeBSD is a registered trademark of The FreeBSD Foundation,
|
||||
Docker is a trademark of Docker, Inc., Sun, Solaris, OpenSolaris and registered trademarks of Sun Microsystems.
|
||||
NetBSD is a registered trademark of The NetBSD Foundation, Docker is a trademark of Docker, Inc., Sun,
|
||||
Solaris, OpenSolaris and registered trademarks of Sun Microsystems.
|
||||
|
||||
All other trademarks are the property of their respective owners.
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
<ul>
|
||||
<li>simple to use</li>
|
||||
<li>get detailed information about system, cpu, baseboard, battery, memory, disks/filesystem, network, docker, software, services and processes</li>
|
||||
<li>supports Linux, macOS, partial Windows, FreeBSD and SunOS support</li>
|
||||
<li>supports Linux, macOS, partial Windows, FreeBSD, OpenBSD, NetBSD and SunOS support</li>
|
||||
<li>no npm dependencies (for production)</li>
|
||||
</ul>
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
<p><a href="https://nodejs.org/en/" rel="nofollow">Node.js</a> comes with some basic OS information, but I always wanted a little more. So I came up to write this
|
||||
little library. This library is still work in progress. It is supposed to be used as a backend/server-side library (will definilely not work within a browser). It requires node.js version 4.0 and above.</p>
|
||||
|
||||
<p>I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra) and some Windows 7, Windows 10, FreeBSD and SunOS machines.
|
||||
<p>I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra) and some Windows 7, Windows 10, FreeBSD, OpenBSD, NetBSD and SunOS machines.
|
||||
Not all functions are supported on all operating systems. Have a look at the function reference in the docs to get further details.</p>
|
||||
<p>If you have comments, suggestions & reports, please feel free to contact me on <a href="https://github.com/sebhildebrandt/systeminformation/issues">github</a>!</p>
|
||||
<p>I also created a nice little command line tool called <a href="https://github.com/sebhildebrandt/mmon" rel="nofollow">mmon</a> (micro-monitor) for Linux and macOS, also available via <a href="https://github.com/sebhildebrandt/mmon" rel="nofollow">github</a> and <a href="https://npmjs.org/package/mmon" rel="nofollow">npm</a></p>
|
||||
|
||||
@ -80,6 +80,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">4.7.0</th>
|
||||
<td>2019-05-29</td>
|
||||
<td>partial NetBSD support</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">4.6.1</th>
|
||||
<td>2019-05-29</td>
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
}
|
||||
function typed() {
|
||||
var options = {
|
||||
strings: ["System and OS information library for node.js", "Get detailed hardware, system & OS information.", "For Linux, macOS, Windows, FreeBSD, SunOS"],
|
||||
strings: ["System and OS information library for node.js", "Get detailed hardware, system & OS information.", "For Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, SunOS"],
|
||||
typeSpeed: 60,
|
||||
loop: false,
|
||||
backDelay: 1200,
|
||||
@ -170,7 +170,7 @@
|
||||
<img class="logo" src="assets/logo.png">
|
||||
<div class="title">systeminformation</div>
|
||||
<div class="subtitle"><span id="typed"></span></div>
|
||||
<div class="version">Current Version: <span id="version">4.6.1</span></div>
|
||||
<div class="version">Current Version: <span id="version">4.7.0</span></div>
|
||||
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
|
||||
</div>
|
||||
<div class="down">
|
||||
@ -183,7 +183,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12 sectionheader index">
|
||||
<div class="title">Overview</div>
|
||||
<div class="subtitle">Lightweight collection of 40+ functions to retrieve detailed hardware, system and OS information. For Linux, macOS, partial Windows, FreeBSD and SunOS support</div>
|
||||
<div class="subtitle">Lightweight collection of 40+ functions to retrieve detailed hardware, system and OS information. For Linux, macOS, partial Windows, FreeBSD, OpenBSD, NetBSD and SunOS support</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center sectionheader index">
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
<li><strong>Raspberry Pi</strong> is a trademark of the Raspberry Pi Foundation</li>
|
||||
<li><strong>Debian</strong> is a trademark of the Debian Project</li>
|
||||
<li><strong>FreeBSD</strong> is a registered trademark of The FreeBSD Foundation</li>
|
||||
<li><strong>NetBSD</strong> is a registered trademark of The NetBSD Foundation</li>
|
||||
<li><strong>Docker</strong> is a trademark of Docker, Inc.</li>
|
||||
<li><strong>Ubuntu</strong> is a trademark of Canonical Ltd.</li>
|
||||
<li><strong>CentOS</strong> is a trademark of Read Hat Inc.</li>
|
||||
|
||||
@ -24,6 +24,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
module.exports = function (callback) {
|
||||
@ -101,7 +102,7 @@ module.exports = function (callback) {
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('sysctl hw.acpi.battery hw.acpi.acline', function (error, stdout) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
const batteries = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.units'), 10);
|
||||
|
||||
@ -25,6 +25,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _cpu_speed = '0.00';
|
||||
@ -355,7 +356,7 @@ function getCpu() {
|
||||
});
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
let modelline = '';
|
||||
let lines = [];
|
||||
if (os.cpus()[0] && os.cpus()[0].model) modelline = os.cpus()[0].model;
|
||||
@ -659,7 +660,7 @@ function cpuTemperature(callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('sysctl dev.cpu | grep temp', function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
@ -792,7 +793,7 @@ function cpuFlags(callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
||||
let flags = [];
|
||||
if (!error) {
|
||||
@ -870,7 +871,7 @@ function cpuCache(callback) {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
||||
let cache = [];
|
||||
if (!error) {
|
||||
|
||||
@ -24,6 +24,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
const NOT_SUPPORTED = 'not supported';
|
||||
@ -39,11 +40,11 @@ function fsSize(callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let data = [];
|
||||
if (_linux || _freebsd || _openbsd || _darwin) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||
let cmd = '';
|
||||
if (_darwin) cmd = 'df -lkP | grep ^/';
|
||||
if (_linux) cmd = 'df -lkPT | grep ^/';
|
||||
if (_freebsd || _openbsd) cmd = 'df -lkPT';
|
||||
if (_freebsd || _openbsd || _netbsd) cmd = 'df -lkPT';
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
@ -54,10 +55,10 @@ function fsSize(callback) {
|
||||
if (line && (line[0].startsWith('/')) || (line[6] && line[6] === '/')) {
|
||||
data.push({
|
||||
'fs': line[0],
|
||||
'type': ((_linux || _freebsd || _openbsd) ? line[1] : 'HFS'),
|
||||
'size': parseInt(((_linux || _freebsd || _openbsd) ? line[2] : line[1])) * 1024,
|
||||
'used': parseInt(((_linux || _freebsd || _openbsd) ? line[3] : line[2])) * 1024,
|
||||
'use': parseFloat((100.0 * ((_linux || _freebsd || _openbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd) ? line[2] : line[1])).toFixed(2)),
|
||||
'type': ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : 'HFS'),
|
||||
'size': parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024,
|
||||
'used': parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024,
|
||||
'use': parseFloat((100.0 * ((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2]) / ((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])).toFixed(2)),
|
||||
'mount': line[line.length - 1]
|
||||
});
|
||||
}
|
||||
@ -119,7 +120,7 @@ function fsOpenFiles(callback) {
|
||||
allocated: -1,
|
||||
available: -1
|
||||
};
|
||||
if (_freebsd || _openbsd || _darwin) {
|
||||
if (_freebsd || _openbsd || _netbsd || _darwin) {
|
||||
let cmd = 'sysctl -a | grep \'kern.*files\'';
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
@ -587,7 +588,7 @@ function disksIO(callback) {
|
||||
let wIO = 0;
|
||||
|
||||
if ((_disk_io && !_disk_io.ms) || (_disk_io && _disk_io.ms && Date.now() - _disk_io.ms >= 500)) {
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
// prints Block layer statistics for all mounted volumes
|
||||
// var cmd = "for mount in `lsblk | grep / | sed -r 's/│ └─//' | cut -d ' ' -f 1`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
|
||||
// var cmd = "for mount in `lsblk | grep / | sed 's/[│└─├]//g' | awk '{$1=$1};1' | cut -d ' ' -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done";
|
||||
@ -802,7 +803,7 @@ function diskLayout(callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _resolutionx = 0;
|
||||
@ -461,7 +462,7 @@ function graphics(callback) {
|
||||
});
|
||||
}
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
if (callback) { callback(result); }
|
||||
resolve(result);
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ let _platform = process.platform;
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
@ -139,7 +140,7 @@ function getDynamicData(srv, iface, callback) {
|
||||
let functionProcessed = (function () {
|
||||
let totalFunctions = 14;
|
||||
if (_windows) totalFunctions = 10;
|
||||
if (_freebsd || _openbsd) totalFunctions = 11;
|
||||
if (_freebsd || _openbsd || _netbsd) totalFunctions = 11;
|
||||
if (_sunos) totalFunctions = 6;
|
||||
|
||||
return function () {
|
||||
@ -203,7 +204,7 @@ function getDynamicData(srv, iface, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
if (!_openbsd && !_freebsd && !_sunos) {
|
||||
if (!_openbsd && !_freebsd && !_netbsd && !_sunos) {
|
||||
network.networkStats(iface).then(res => {
|
||||
data.networkStats = res;
|
||||
functionProcessed();
|
||||
@ -243,14 +244,14 @@ function getDynamicData(srv, iface, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
if (!_windows && !_openbsd && !_freebsd && !_sunos) {
|
||||
if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) {
|
||||
filesystem.fsStats().then(res => {
|
||||
data.fsStats = res;
|
||||
functionProcessed();
|
||||
});
|
||||
}
|
||||
|
||||
if (!_windows && !_openbsd && !_freebsd && !_sunos) {
|
||||
if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) {
|
||||
filesystem.disksIO().then(res => {
|
||||
data.disksIO = res;
|
||||
functionProcessed();
|
||||
|
||||
@ -23,6 +23,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
// --------------------------
|
||||
@ -42,7 +43,7 @@ function inetChecksite(url, callback) {
|
||||
if (url) {
|
||||
url = url.toLowerCase();
|
||||
let t = Date.now();
|
||||
if (_linux || _freebsd || _openbsd || _darwin || _sunos) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
|
||||
let args = ' -I --connect-timeout 5 -m 5 ' + url + ' 2>/dev/null | head -n 1 | cut -d " " -f2';
|
||||
let cmd = 'curl';
|
||||
exec(cmd + args, function (error, stdout) {
|
||||
@ -111,11 +112,11 @@ function inetLatency(host, callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let cmd;
|
||||
if (_linux || _freebsd || _openbsd || _darwin) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||
if (_linux) {
|
||||
cmd = 'ping -c 2 -w 3 ' + host + ' | grep rtt';
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
cmd = 'ping -c 2 -t 3 ' + host + ' | grep round-trip';
|
||||
}
|
||||
if (_darwin) {
|
||||
|
||||
@ -24,6 +24,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
const OSX_RAM_manufacturers = {
|
||||
@ -158,7 +159,7 @@ function mem(callback) {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('/sbin/sysctl -a | grep -E "hw.realmem|hw.physmem|vm.stats.vm.v_page_count|vm.stats.vm.v_wire_count|vm.stats.vm.v_active_count|vm.stats.vm.v_inactive_count|vm.stats.vm.v_cache_count|vm.stats.vm.v_free_count|vm.stats.vm.v_page_size"', function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
@ -260,7 +261,7 @@ function memLayout(callback) {
|
||||
|
||||
let result = [];
|
||||
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
exec('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL', function (error, stdout) {
|
||||
if (!error) {
|
||||
let devices = stdout.toString().split('Memory Device');
|
||||
|
||||
@ -26,6 +26,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _network = {};
|
||||
@ -58,11 +59,11 @@ function getDefaultNetworkInterface() {
|
||||
}
|
||||
}
|
||||
ifacename = ifacename || ifacenameFirst || '';
|
||||
if (_linux || _darwin || _freebsd || _openbsd || _sunos) {
|
||||
if (_linux || _darwin || _freebsd || _openbsd || _netbsd || _sunos) {
|
||||
let cmd = '';
|
||||
if (_linux) cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\'';
|
||||
if (_darwin) cmd = 'route get 0.0.0.0 2>/dev/null | grep interface: | awk \'{print $2}\'';
|
||||
if (_freebsd || _openbsd || _sunos) cmd = 'route get 0.0.0.0 | grep interface:';
|
||||
if (_freebsd || _openbsd || _netbsd || _sunos) cmd = 'route get 0.0.0.0 | grep interface:';
|
||||
let result = execSync(cmd);
|
||||
ifacename = result.toString().split('\n')[0];
|
||||
if (ifacename.indexOf(':') > -1) {
|
||||
@ -80,7 +81,7 @@ function getMacAddresses() {
|
||||
let iface = '';
|
||||
let mac = '';
|
||||
let result = {};
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
if (typeof pathToIp === 'undefined') {
|
||||
try {
|
||||
const lines = execSync('which ip').toString().split('\n');
|
||||
@ -384,7 +385,7 @@ function networkInterfaces(callback) {
|
||||
type = 'wireless';
|
||||
}
|
||||
}
|
||||
if (_darwin || _freebsd || _openbsd) {
|
||||
if (_darwin || _freebsd || _openbsd || _netbsd) {
|
||||
nics.forEach(nic => {
|
||||
if (nic.iface === dev) {
|
||||
mtu = nic.mtu;
|
||||
@ -595,7 +596,7 @@ function networkStatsSingle(iface) {
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
cmd = 'netstat -ibndI ' + iface;
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
@ -707,9 +708,9 @@ function networkConnections(callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let result = [];
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
let cmd = 'netstat -tuna | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"';
|
||||
if (_freebsd || _openbsd) cmd = 'netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"';
|
||||
if (_freebsd || _openbsd || _netbsd) cmd = 'netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"';
|
||||
exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
|
||||
@ -25,6 +25,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
const NOT_SUPPORTED = 'not supported';
|
||||
@ -220,7 +221,7 @@ function osInfo(callback) {
|
||||
//}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
|
||||
exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid', function (error, stdout) {
|
||||
if (!error) {
|
||||
@ -680,7 +681,7 @@ function uuid(callback) {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('kenv -q smbios.system.uuid', function (error, stdout) {
|
||||
if (!error) {
|
||||
result.os = stdout.toString().split('\n')[0].trim().toLowerCase();
|
||||
|
||||
@ -26,6 +26,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _processes_cpu = {
|
||||
@ -101,8 +102,8 @@ function services(srv, callback) {
|
||||
let dataSrv = [];
|
||||
let allSrv = [];
|
||||
|
||||
if (_linux || _freebsd || _openbsd || _darwin) {
|
||||
if ((_linux || _freebsd || _openbsd) && srv === '*') {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin) {
|
||||
if ((_linux || _freebsd || _openbsd || _netbsd) && srv === '*') {
|
||||
srv = '';
|
||||
let tmpsrv = execSync('service --status-all 2> /dev/null').toString().split('\n');
|
||||
for (const s of tmpsrv) {
|
||||
@ -560,9 +561,9 @@ function processes(callback) {
|
||||
let cmd = '';
|
||||
|
||||
if ((_processes_cpu.ms && Date.now() - _processes_cpu.ms >= 500) || _processes_cpu.ms === 0) {
|
||||
if (_linux || _freebsd || _openbsd || _darwin || _sunos) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
|
||||
if (_linux) cmd = 'export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,lstart:30,state:5,tty:15,user:20,command; unset LC_ALL';
|
||||
if (_freebsd || _openbsd) cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,lstart,state,tty,user,command; unset LC_ALL';
|
||||
if (_freebsd || _openbsd || _netbsd) cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,lstart,state,tty,user,command; unset LC_ALL';
|
||||
if (_darwin) cmd = 'export LC_ALL=C; ps -acxo pid,ppid,pcpu,pmem,pri,vsz,rss,nice,lstart,state,tty,user,command -r; unset LC_ALL';
|
||||
if (_sunos) cmd = 'ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm';
|
||||
exec(cmd, { maxBuffer: 1024 * 2000 }, function (error, stdout) {
|
||||
|
||||
@ -25,6 +25,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
function system(callback) {
|
||||
@ -41,7 +42,7 @@ function system(callback) {
|
||||
sku: '-',
|
||||
};
|
||||
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
exec('export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL', function (error, stdout) {
|
||||
// if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
@ -251,7 +252,7 @@ function bios(callback) {
|
||||
revision: '',
|
||||
};
|
||||
let cmd = '';
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
if (process.arch === 'arm') {
|
||||
cmd = 'cat /proc/cpuinfo | grep Serial';
|
||||
|
||||
@ -345,7 +346,7 @@ function baseboard(callback) {
|
||||
assetTag: '-',
|
||||
};
|
||||
let cmd = '';
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
if (process.arch === 'arm') {
|
||||
cmd = 'cat /proc/cpuinfo | grep Serial';
|
||||
// 'BCM2709', 'BCM2835', 'BCM2708' -->
|
||||
@ -485,7 +486,7 @@ function chassis(callback) {
|
||||
assetTag: '-',
|
||||
sku: '',
|
||||
};
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
if (_linux || _freebsd || _openbsd || _netbsd) {
|
||||
const cmd = `echo -n "chassis_asset_tag: "; cat /sys/devices/virtual/dmi/id/chassis_asset_tag 2>/dev/null; echo;
|
||||
echo -n "chassis_serial: "; cat /sys/devices/virtual/dmi/id/chassis_serial 2>/dev/null; echo;
|
||||
echo -n "chassis_type: "; cat /sys/devices/virtual/dmi/id/chassis_type 2>/dev/null; echo;
|
||||
|
||||
@ -23,6 +23,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
const _sunos = (_platform === 'sunos');
|
||||
|
||||
// --------------------------
|
||||
@ -211,7 +212,7 @@ function users(callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (_freebsd || _openbsd) {
|
||||
if (_freebsd || _openbsd || _netbsd) {
|
||||
exec('who; echo "---"; w -ih', function (error, stdout) {
|
||||
if (!error) {
|
||||
// lines / split
|
||||
|
||||
@ -25,6 +25,7 @@ const _darwin = (_platform === 'darwin');
|
||||
const _windows = (_platform === 'win32');
|
||||
const _freebsd = (_platform === 'freebsd');
|
||||
const _openbsd = (_platform === 'openbsd');
|
||||
const _netbsd = (_platform === 'netbsd');
|
||||
// const _sunos = (_platform === 'sunos');
|
||||
|
||||
let _cores = 0;
|
||||
@ -320,7 +321,7 @@ function getCodepage() {
|
||||
}
|
||||
return codepage;
|
||||
}
|
||||
if (_linux || _darwin || _freebsd || _openbsd) {
|
||||
if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
|
||||
if (!codepage) {
|
||||
try {
|
||||
const stdout = execSync('echo $LANG');
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
"osx",
|
||||
"windows",
|
||||
"freebsd",
|
||||
"openbsd",
|
||||
"netbsd",
|
||||
"cpu",
|
||||
"cpuload",
|
||||
"physical cores",
|
||||
@ -72,6 +74,7 @@
|
||||
"win32",
|
||||
"freebsd",
|
||||
"openbsd",
|
||||
"netbsd",
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user