updated docs

This commit is contained in:
Sebastian Hildebrandt
2020-03-08 23:26:54 +01:00
parent e75edb001b
commit cd972d01cd
3 changed files with 350 additions and 0 deletions
+162
View File
@@ -245,6 +245,54 @@
<td></td>
<td># changes up/down</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.networkInterfaces().then(data => console.log(data));</code></pre class="example">
<pre class="example">
[
{
iface: 'lo0',
ifaceName: 'lo0',
ip4: '127.0.0.1',
ip6: '::1',
mac: '',
internal: true,
virtual: false,
operstate: 'down',
type: 'wired',
duplex: 'full',
mtu: 16384,
speed: -1,
dhcp: false,
dnsSuffix: '',
ieee8021xAuth: '',
ieee8021xState: '',
carrierChanges: 0
},
{
iface: 'en0',
ifaceName: 'en0',
ip4: '192.168.0.27',
ip6: 'fe80::134a:1e43:abc5:d413',
mac: 'xx:xx:xx:xx:xx:xx',
internal: false,
virtual: false,
operstate: 'up',
type: 'wired',
duplex: 'full',
mtu: 1500,
speed: 1000,
dhcp: true,
dnsSuffix: '',
ieee8021xAuth: '',
ieee8021xState: '',
carrierChanges: 0
}, ...
]</pre>
</tr>
<tr>
<td>si.networkInterfaceDefault(cb)</td>
<td>: string</td>
@@ -255,6 +303,15 @@
<td>X</td>
<td>get name of default network interface</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.networkInterfaceDefault().then(data => console.log(data));</code></pre class="example">
<pre class="example">
eth0</pre>
</tr>
<tr>
<td>si.networkGatewayDefault(cb)</td>
<td>: string</td>
@@ -265,6 +322,15 @@
<td>X</td>
<td>get default network gateway</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.networkGatewayDefault().then(data => console.log(data));</code></pre class="example">
<pre class="example">
192.168.0.1</pre>
</tr>
<tr>
<td>si.networkStats(iface,cb)</td>
<td>[{...}]</td>
@@ -385,6 +451,48 @@
<td></td>
<td>interval length (for per second values)</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
setInterval(function() {
si.networkStats().then(data => {
console.log(data);
})
}, 1000)</code></pre class="example">
<pre class="example">
[
{ // first call
iface: 'en0',
operstate: 'up',
rx_bytes: 1752866207,
rx_dropped: 0,
rx_errors: 0,
tx_bytes: 180934681,
tx_dropped: 0,
tx_errors: 0,
rx_sec: -1,
tx_sec: -1,
ms: 0
}
]
[
{ // second call
iface: 'en0',
operstate: 'up',
rx_bytes: 1752866822,
rx_dropped: 0,
rx_errors: 0,
tx_bytes: 180939820,
tx_dropped: 0,
tx_errors: 0,
rx_sec: 624.3654822335026,
tx_sec: 5217.258883248731,
ms: 985
}
]...</pre>
</tr>
<tr>
<td>si.networkConnections(cb)</td>
<td>[{...}]</td>
@@ -475,6 +583,37 @@
<td></td>
<td>process name</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.networkConnections().then(data => console.log(data));</code></pre class="example">
<pre class="example">
[
{
protocol: 'tcp4',
localaddress: '192.168.0.27',
localport: '55788',
peeraddress: '163.128.xxx.xxx',
peerport: '443',
state: 'CLOSE_WAIT',
pid: 702,
process: ''
},
{
protocol: 'tcp4',
localaddress: '192.168.0.27',
localport: '55761',
peeraddress: '148.253.xxx.xxx',
peerport: '22',
state: 'ESTABLISHED',
pid: 7267,
process: ''
},
...
]</pre>
</tr>
</tbody>
</table>
<h2>Site availability, Internet Latency</h2>
@@ -542,6 +681,20 @@
<td>X</td>
<td>response time in ms</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.inetChecksite('google.com').then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
url: 'google.com',
ok: true,
status: 301,
ms: 82
}</pre>
</tr>
<tr>
<td>si.inetLatency(host, cb)</td>
<td>: number</td>
@@ -552,6 +705,15 @@
<td>X</td>
<td>response-time (ms) to external resource<br />host parameter is optional (default 8.8.8.8)</td>
</tr>
<tr class="example">
<td></td>
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.inetLatency().then(data => console.log(data));</code></pre class="example">
<pre class="example">
13.484</pre>
</tr>
</tbody>
</table>
<h4>Getting correct stats values</h4>