pascalCase modifications, docs update, tests improvement

This commit is contained in:
Sebastian Hildebrandt 2021-01-19 10:25:49 +01:00
parent 2b534f365d
commit a289ad4e3e
21 changed files with 514 additions and 522 deletions

View File

@ -185,8 +185,8 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
| | manufacturer | X | X | X | X | | e.g. 'Intel(R)' |
| | brand | X | X | X | X | | e.g. 'Core(TM)2 Duo' |
| | speed | X | X | X | X | | in GHz e.g. '3.40' |
| | speedmin | X | | X | X | | in GHz e.g. '0.80' |
| | speedmax | X | X | X | X | | in GHz e.g. '3.90' |
| | speedMin | X | | X | X | | in GHz e.g. '0.80' |
| | speedMax | X | X | X | X | | in GHz e.g. '3.90' |
| | governor | X | | | | | e.g. 'powersave' |
| | cores | X | X | X | X | | # cores |
| | physicalCores | X | X | X | X | | # physical cores |
@ -213,7 +213,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
| | l1i | X | X | X | X | | L1I size |
| | l2 | X | X | X | X | | L2 size |
| | l3 | X | X | X | X | | L3 size |
| si.cpuCurrentspeed(cb) | {...} | X | X | X | X | X | current CPU speed (in GHz)|
| si.cpuCurrentSpeed(cb) | {...} | X | X | X | X | X | current CPU speed (in GHz)|
| | avg | X | X | X | X | X | avg CPU speed (all cores) |
| | min | X | X | X | X | X | min CPU speed (all cores) |
| | max | X | X | X | X | X | max CPU speed (all cores) |
@ -258,17 +258,17 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
| --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- |
| si.battery(cb) | {...} | X | X | X | X | | battery information |
| | hasbattery | X | X | X | X | | indicates presence of battery |
| | cyclecount | X | | X | | | numbers of recharges |
| | ischarging | X | X | X | X | | indicates if battery is charging |
| | designedcapacity | X | | X | X | | max capacity of battery (mWh) |
| | maxcapacity | X | | X | X | | max capacity of battery (mWh) |
| | currentcapacity | X | | X | X | | current capacity of battery (mWh) |
| | hasBattery | X | X | X | X | | indicates presence of battery |
| | cycleCount | X | | X | | | numbers of recharges |
| | isCharging | X | X | X | X | | indicates if battery is charging |
| | designedCapacity | X | | X | X | | max capacity of battery (mWh) |
| | maxCapacity | X | | X | X | | max capacity of battery (mWh) |
| | currentCapacity | X | | X | X | | current capacity of battery (mWh) |
| | capacityUnit | X | | X | X | | capacity unit (mWh) |
| | voltage | X | | X | X | | current voltage of battery (V) |
| | percent | X | X | X | X | | charging level in percent |
| | timeremaining | X | | X | | | minutes left (if discharging) |
| | acconnected | X | X | X | X | | AC connected |
| | timeRemaining | X | | X | | | minutes left (if discharging) |
| | acConnected | X | X | X | X | | AC connected |
| | type | X | | X | | | battery type |
| | model | X | | X | | | model |
| | manufacturer | X | | X | | | manufacturer |
@ -294,11 +294,11 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
| | ...[0].main | X | | X | X| | true if main monitor |
| | ...[0].builtin | X | | X | | | true if built in monitor |
| | ...[0].connection | X | | X | X | | e.g. DisplayPort or HDMI |
| | ...[0].sizex | X | | X | X | | size in mm horizontal |
| | ...[0].sizey | X | | X | X | | size in mm vertical |
| | ...[0].pixeldepth | X | | X | X | | color depth in bits |
| | ...[0].resolutionx | X | | X | X | | pixel horizontal |
| | ...[0].resolutiony | X | | X | X | | pixel vertical |
| | ...[0].sizeX | X | | X | X | | size in mm horizontal |
| | ...[0].sizeY | X | | X | X | | size in mm vertical |
| | ...[0].pixelDepth | X | | X | X | | color depth in bits |
| | ...[0].resolutionX | X | | X | X | | pixel horizontal |
| | ...[0].resolutionY | X | | X | X | | pixel vertical |
| | ...[0].currentResX | X | | X | X | | current pixel horizontal |
| | ...[0].currentResY | X | | X | X | | current pixel vertical |
| | ...[0].positionX | | | | X | | display position X |
@ -342,14 +342,14 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
| Function | Result object | Linux | BSD | Mac | Win | Sun | Comments |
| --------------- | ------------- | ----- | ------- | --- | --- | --- | -------- |
| si.currentLoad(cb) | {...} | X | | X | X | X | CPU-Load |
| | avgload | X | | X | | X | average load |
| | currentload | X | | X | X | X | CPU load in % |
| | currentload_user | X | | X | X | X | CPU load user in % |
| | currentload_system | X | | X | X | X | CPU load system in % |
| | currentload_nice | X | | X | X | X | CPU load nice in % |
| | currentload_idle | X | | X | X | X | CPU load idle in % |
| | currentload_irq | X | | X | X | X | CPU load system in % |
| | raw_currentload... | X | | X | X | X | CPU load raw values (ticks) |
| | avgLoad | X | | X | | X | average load |
| | currentLoad | X | | X | X | X | CPU load in % |
| | currentLoadUser | X | | X | X | X | CPU load user in % |
| | currentLoadSystem | X | | X | X | X | CPU load system in % |
| | currentLoadNice | X | | X | X | X | CPU load nice in % |
| | currentLoadIdle | X | | X | X | X | CPU load idle in % |
| | currentLoadIrq | X | | X | X | X | CPU load system in % |
| | rawCurrentLoad... | X | | X | X | X | CPU load raw values (ticks) |
| | cpus[] | X | | X | X | X | current loads per CPU in % + raw ticks |
| si.fullLoad(cb) | : integer | X | | X | X | | CPU full load since bootup in % |
| si.processes(cb) | {...} | X | X | X | X | X | # running processes |
@ -367,8 +367,8 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
| | ...[0].pcpus | X | X | | X | | process % CPU usage (system) |
| | ...[0].pmem | X | X | X | X | X | process memory % |
| | ...[0].priority | X | X | X | X | X | process priotity |
| | ...[0].mem_vsz | X | X | X | X | X | process virtual memory size |
| | ...[0].mem_rss | X | X | X | X | X | process mem resident set size |
| | ...[0].memVsz | X | X | X | X | X | process virtual memory size |
| | ...[0].memRss | X | X | X | X | X | process mem resident set size |
| | ...[0].nice | X | X | X | | X | process nice value |
| | ...[0].started | X | X | X | X | X | process start time |
| | ...[0].state | X | X | X | X | X | process state (e.g. sleeping) |
@ -541,10 +541,10 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
| | [0].ms | X | X | X | X | | interval length (for per second values) |
| si.networkConnections(cb) | [{...}] | X | X | X | X | | current network network connections<br>returns an array of all connections|
| | [0].protocol | X | X | X | X | | tcp or udp |
| | [0].localaddress | X | X | X | X | | local address |
| | [0].localport | X | X | X | X | | local port |
| | [0].peeraddress | X | X | X | X | | peer address |
| | [0].peerport | X | X | X | X | | peer port |
| | [0].localAddress | X | X | X | X | | local address |
| | [0].localPort | X | X | X | X | | local port |
| | [0].peerAddress | X | X | X | X | | peer address |
| | [0].peerPort | X | X | X | X | | peer port |
| | [0].state | X | X | X | X | | like ESTABLISHED, TIME_WAIT, ... |
| | [0].pid | X | X | X | X | | process ID |
| | [0].process | X | X | | | | process name |
@ -652,21 +652,21 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
| | [0].mounts | X | X | X | X | X | array of mounts |
| si.dockerContainerStats(ids, cb) | [{...}] | X | X | X | X | X | statistics for specific containers<br>container IDs: space or comma separated,<br>pass '*' for all containers|
| | [0].id | X | X | X | X | X | Container ID |
| | [0].mem_usage | X | X | X | X | X | memory usage in bytes |
| | [0].mem_limit | X | X | X | X | X | memory limit (max mem) in bytes |
| | [0].mem_percent | X | X | X | X | X | memory usage in percent |
| | [0].cpu_percent | X | X | X | X | X | cpu usage in percent |
| | [0].memUsage | X | X | X | X | X | memory usage in bytes |
| | [0].memLimit | X | X | X | X | X | memory limit (max mem) in bytes |
| | [0].memPercent | X | X | X | X | X | memory usage in percent |
| | [0].cpuPercent | X | X | X | X | X | cpu usage in percent |
| | [0].pids | X | X | X | X | X | number of processes |
| | [0].netIO.rx | X | X | X | X | X | received bytes via network |
| | [0].netIO.wx | X | X | X | X | X | sent bytes via network |
| | [0].blockIO.r | X | X | X | X | X | bytes read from BlockIO |
| | [0].blockIO.w | X | X | X | X | X | bytes written to BlockIO |
| | [0].cpu_stats | X | X | X | X | X | detailed cpu stats |
| | [0].percpu_stats | X | X | X | X | X | detailed per cpu stats |
| | [0].memory_stats | X | X | X | X | X | detailed memory stats |
| | [0].cpuStats | X | X | X | X | X | detailed cpu stats |
| | [0].percpuStats | X | X | X | X | X | detailed per cpu stats |
| | [0].memoryStats | X | X | X | X | X | detailed memory stats |
| | [0].networks | X | X | X | X | X | detailed network stats per interface |
| si.dockerContainerProcesses(id, cb) | [{...}] | X | X | X | X | X | array of processes inside a container |
| | [0].pid_host | X | X | X | X | X | process ID (host) |
| | [0].pidHost | X | X | X | X | X | process ID (host) |
| | [0].ppid | X | X | X | X | X | parent process ID |
| | [0].pgid | X | X | X | X | X | process group ID |
| | [0].user | X | X | X | X | X | effective user name |
@ -707,22 +707,22 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
| | [0].configFile | X | X | X | X | X | config file |
| | [0].snapshotFolder | X | X | X | X | X | snapshot folder |
| | [0].logFolder | X | X | X | X | X | log folder path |
| | [0].HPET | X | X | X | X | X | HPET |
| | [0].PAE | X | X | X | X | X | PAE |
| | [0].hpet | X | X | X | X | X | HPET |
| | [0].pae | X | X | X | X | X | PAE |
| | [0].longMode | X | X | X | X | X | long mode |
| | [0].tripleFaultReset | X | X | X | X | X | triple fault reset |
| | [0].APIC | X | X | X | X | X | APIC |
| | [0].X2APIC | X | X | X | X | X | X2APIC |
| | [0].ACPI | X | X | X | X | X | ACPI |
| | [0].IOAPIC | X | X | X | X | X | IOAPIC |
| | [0].biosAPICmode | X | X | X | X | X | BIOS APIC mode |
| | [0].apic | X | X | X | X | X | APIC |
| | [0].x2Apic | X | X | X | X | X | X2APIC |
| | [0].acpi | X | X | X | X | X | ACPI |
| | [0].ioApic | X | X | X | X | X | IOAPIC |
| | [0].biosApicMode | X | X | X | X | X | BIOS APIC mode |
| | [0].bootMenuMode | X | X | X | X | X | boot menu Mode |
| | [0].bootDevice1 | X | X | X | X | X | bootDevice1 |
| | [0].bootDevice2 | X | X | X | X | X | bootDevice2 |
| | [0].bootDevice3 | X | X | X | X | X | bootDevice3 |
| | [0].bootDevice4 | X | X | X | X | X | bootDevice4 |
| | [0].timeOffset | X | X | X | X | X | time Offset |
| | [0].RTC | X | X | X | X | X | RTC |
| | [0].rtc | X | X | X | X | X | RTC |
#### 16. "Get All / Observe" - functions

View File

@ -78,7 +78,7 @@
</tr>
<tr>
<td></td>
<td>hasbattery</td>
<td>hasBattery</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -88,7 +88,7 @@
</tr>
<tr>
<td></td>
<td>cyclecount</td>
<td>cycleCount</td>
<td>X</td>
<td></td>
<td>X</td>
@ -98,7 +98,7 @@
</tr>
<tr>
<td></td>
<td>ischarging</td>
<td>isCharging</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -108,7 +108,7 @@
</tr>
<tr>
<td></td>
<td>designedcapacity</td>
<td>designedCapacity</td>
<td>X</td>
<td></td>
<td>X</td>
@ -118,7 +118,7 @@
</tr>
<tr>
<td></td>
<td>maxcapacity</td>
<td>maxCapacity</td>
<td>X</td>
<td></td>
<td>X</td>
@ -128,7 +128,7 @@
</tr>
<tr>
<td></td>
<td>currentcapacity</td>
<td>currentCapacity</td>
<td>X</td>
<td></td>
<td>X</td>
@ -168,7 +168,7 @@
</tr>
<tr>
<td></td>
<td>timeremaining</td>
<td>timeRemaining</td>
<td>X</td>
<td></td>
<td>X</td>
@ -178,7 +178,7 @@
</tr>
<tr>
<td></td>
<td>acconnected</td>
<td>acConnected</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -234,17 +234,17 @@
si.battery().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
hasbattery: true,
cyclecount: 35,
ischarging: false,
designedcapacity: 64958,
maxcapacity: 65865,
currentcapacity: 64856,
hasBattery: true,
cycleCount: 35,
isCharging: false,
designedCapacity: 64958,
maxCapacity: 65865,
currentCapacity: 64856,
voltage: 12.767,
capacityUnit: 'mWh',
percent: 100,
timeremaining: 551,
acconnected: false,
timeRemaining: 551,
acConnected: false,
type: 'Li-ion',
model: '',
manufacturer: 'Apple',

View File

@ -104,27 +104,27 @@
<td>X</td>
<td>X</td>
<td></td>
<td>in GHz e.g. '3.40'</td>
<td>in GHz e.g. 3.4</td>
</tr>
<tr>
<td></td>
<td>speedmin</td>
<td>speedMin</td>
<td>X</td>
<td></td>
<td>X</td>
<td>X</td>
<td></td>
<td>in GHz e.g. '0.80'</td>
<td>in GHz e.g. 0.8</td>
</tr>
<tr>
<td></td>
<td>speedmax</td>
<td>speedMax</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td></td>
<td>in GHz e.g. '3.90'</td>
<td>in GHz e.g. 3.9</td>
</tr>
<tr>
<td></td>
@ -342,9 +342,9 @@ si.cpu().then(data => console.log(data));</code></pre class="example">
stepping: '13',
revision: '',
voltage: '',
speed: '3.10',
speedmin: '0.80',
speedmax: '5.00',
speed: 3.1,
speedMin: 0.8,
speedMax: 5,
governor: 'powersave',
cores: 16,
physicalCores: 8,
@ -436,7 +436,7 @@ si.cpuCache().then(data => console.log(data));</code></pre class="example">
</pre>
</tr>
<tr>
<td>si.cpuCurrentspeed(cb)</td>
<td>si.cpuCurrentSpeed(cb)</td>
<td>{...}</td>
<td>X</td>
<td>X</td>
@ -490,7 +490,7 @@ si.cpuCache().then(data => console.log(data));</code></pre class="example">
<td colspan="7">
<h5>Example</h5>
<pre><code class="js">const si = require('systeminformation');
si.cpuCurrentspeed().then(data => console.log(data));</code></pre class="example">
si.cpuCurrentSpeed().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
min: 0.86,

View File

@ -738,7 +738,7 @@
</tr>
<tr>
<td></td>
<td>mem_usage</td>
<td>memUsage</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -748,7 +748,7 @@
</tr>
<tr>
<td></td>
<td>mem_limit</td>
<td>memLimit</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -758,7 +758,7 @@
</tr>
<tr>
<td></td>
<td>mem_percent</td>
<td>memPercent</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -768,7 +768,7 @@
</tr>
<tr>
<td></td>
<td>cpu_percent</td>
<td>cpuPercent</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -838,7 +838,7 @@
</tr>
<tr>
<td></td>
<td>cpu_stats</td>
<td>cpuStats</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -848,7 +848,7 @@
</tr>
<tr>
<td></td>
<td>percpu_stats</td>
<td>percpuStats</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -858,7 +858,7 @@
</tr>
<tr>
<td></td>
<td>memory_stats</td>
<td>memoryStats</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -888,7 +888,7 @@
</tr>
<tr>
<td></td>
<td>[0].pid_host</td>
<td>[0].pidHost</td>
<td>X</td>
<td>X</td>
<td>X</td>

View File

@ -317,7 +317,7 @@ si.diskLayout().then(data => console.log(data));</code></pre class="example">
</tr>
<tr>
<td></td>
<td>[0].fstype</td>
<td>[0].fsType</td>
<td>X</td>
<td></td>
<td>X</td>
@ -426,7 +426,7 @@ si.blockDevices().then(data => console.log(data));</code></pre class="example">
{
name: 'nvme0n1',
type: 'disk',
fstype: '',
fsType: '',
mount: '',
size: 1024209543168,
physical: 'SSD',

View File

@ -180,14 +180,16 @@ si.get(valueObject).then(data => console.log(data));</code></pre class="example"
stepping: '10',
revision: '',
voltage: '',
speed: '2.80',
speedmin: '2.80',
speedmax: '2.80',
speed: 2.8,
speedMin: 2.8,
speedMax: 2.80,
governor: '',
cores: 8,
physicalCores: 4,
processors: 1,
socket: '',
flags: 'fpu vme de ...',
virtualization: true,
cache: { l1d: 32768, l1i: 32768, l2: 262144, l3: 8388608 }
},
osInfo: {

View File

@ -144,7 +144,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - sub device ID</td>
<td>(optional nvidia-smi) - sub device ID</td>
</tr>
<tr>
<td></td>
@ -154,7 +154,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - driver version</td>
<td>(optional nvidia-smi) - driver version</td>
</tr>
<tr>
<td></td>
@ -164,7 +164,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - name</td>
<td>(optional nvidia-smi) - name</td>
</tr>
<tr>
<td></td>
@ -174,7 +174,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - PCI bus ID</td>
<td>(optional nvidia-smi) - PCI bus ID</td>
</tr>
<tr>
<td></td>
@ -184,17 +184,17 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - fan speed</td>
<td>(optional nvidia-smi) - fan speed</td>
</tr>
<tr>
<td></td>
<td>...[0].memory total</td>
<td>...[0].memoryTotal</td>
<td>X</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - memory total</td>
<td>(optional nvidia-smi) - memory total</td>
</tr>
<tr>
<td></td>
@ -204,7 +204,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - memory used</td>
<td>(optional nvidia-smi) - memory used</td>
</tr>
<tr>
<td></td>
@ -214,7 +214,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - memory free</td>
<td>(optional nvidia-smi) - memory free</td>
</tr>
<tr>
<td></td>
@ -224,7 +224,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - utilization GPU</td>
<td>(optional nvidia-smi) - utilization GPU</td>
</tr>
<tr>
<td></td>
@ -234,7 +234,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - utilization memory</td>
<td>(optional nvidia-smi) - utilization memory</td>
</tr>
<tr>
<td></td>
@ -244,7 +244,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - temperature GPU</td>
<td>(optional nvidia-smi) - temperature GPU</td>
</tr>
<tr>
<td></td>
@ -254,7 +254,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - temperature memory</td>
<td>(optional nvidia-smi) - temperature memory</td>
</tr>
<tr>
<td></td>
@ -264,7 +264,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - power draw</td>
<td>(optional nvidia-smi) - power draw</td>
</tr>
<tr>
<td></td>
@ -274,7 +274,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - power limit</td>
<td>(optional nvidia-smi) - power limit</td>
</tr>
<tr>
<td></td>
@ -284,7 +284,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - clock core</td>
<td>(optional nvidia-smi) - clock core</td>
</tr>
<tr>
<td></td>
@ -294,7 +294,7 @@
<td></td>
<td>X</td>
<td></td>
<td>(pptional nvidia-smi) - clock memory</td>
<td>(optional nvidia-smi) - clock memory</td>
</tr>
<tr>
<td></td>
@ -368,7 +368,7 @@
</tr>
<tr>
<td></td>
<td>...[0].sizex</td>
<td>...[0].sizeX</td>
<td>X</td>
<td></td>
<td>X</td>
@ -378,7 +378,7 @@
</tr>
<tr>
<td></td>
<td>...[0].sizey</td>
<td>...[0].sizeY</td>
<td>X</td>
<td></td>
<td>X</td>
@ -388,7 +388,7 @@
</tr>
<tr>
<td></td>
<td>...[0].pixeldepth</td>
<td>...[0].pixelDepth</td>
<td>X</td>
<td></td>
<td>X</td>
@ -398,7 +398,7 @@
</tr>
<tr>
<td></td>
<td>...[0].resolutionx</td>
<td>...[0].resolutionX</td>
<td>X</td>
<td></td>
<td>X</td>
@ -408,7 +408,7 @@
</tr>
<tr>
<td></td>
<td>...[0].resolutiony</td>
<td>...[0].resolutionY</td>
<td>X</td>
<td></td>
<td>X</td>
@ -490,11 +490,11 @@ si.graphics().then(data => console.log(data));</code></pre class="example">
main: true,
builtin: false,
connection: 'Internal',
sizex: null,
sizey: null,
pixeldepth: 24,
resolutionx: 2560,
resolutiony: 1600,
sizeX: null,
sizeY: null,
pixelDepth: 24,
resolutionX: 2560,
resolutionY: 1600,
currentResX: 2560,
currentResY: 1600,
positionX: 0,

View File

@ -540,7 +540,7 @@ setInterval(function() {
</tr>
<tr>
<td></td>
<td>[0].localaddress</td>
<td>[0].localAddress</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -550,7 +550,7 @@ setInterval(function() {
</tr>
<tr>
<td></td>
<td>[0].localport</td>
<td>[0].localPort</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -560,7 +560,7 @@ setInterval(function() {
</tr>
<tr>
<td></td>
<td>[0].peeraddress</td>
<td>[0].peerAddress</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -570,7 +570,7 @@ setInterval(function() {
</tr>
<tr>
<td></td>
<td>[0].peerport</td>
<td>[0].peerPort</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -618,20 +618,20 @@ si.networkConnections().then(data => console.log(data));</code></pre class="exam
[
{
protocol: 'tcp4',
localaddress: '192.168.0.27',
localport: '55788',
peeraddress: '163.128.xxx.xxx',
peerport: '443',
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',
localAddress: '192.168.0.27',
localPort: '55761',
peerAddress: '148.253.xxx.xxx',
peerPort: '22',
state: 'ESTABLISHED',
pid: 7267,
process: ''

View File

@ -78,7 +78,7 @@
</tr>
<tr>
<td></td>
<td>avgload</td>
<td>avgLoad</td>
<td>X</td>
<td></td>
<td>X</td>
@ -88,7 +88,7 @@
</tr>
<tr>
<td></td>
<td>currentload</td>
<td>currentLoad</td>
<td>X</td>
<td></td>
<td>X</td>
@ -98,7 +98,7 @@
</tr>
<tr>
<td></td>
<td>currentload_user</td>
<td>currentLoadUser</td>
<td>X</td>
<td></td>
<td>X</td>
@ -108,7 +108,7 @@
</tr>
<tr>
<td></td>
<td>currentload_system</td>
<td>currentLoadSystem</td>
<td>X</td>
<td></td>
<td>X</td>
@ -118,7 +118,7 @@
</tr>
<tr>
<td></td>
<td>currentload_nice</td>
<td>currentLoadNice</td>
<td>X</td>
<td></td>
<td>X</td>
@ -128,7 +128,7 @@
</tr>
<tr>
<td></td>
<td>currentload_idle</td>
<td>currentLoadIdle</td>
<td>X</td>
<td></td>
<td>X</td>
@ -138,7 +138,7 @@
</tr>
<tr>
<td></td>
<td>currentload_irq</td>
<td>currentLoadIrq</td>
<td>X</td>
<td></td>
<td>X</td>
@ -148,7 +148,7 @@
</tr>
<tr>
<td></td>
<td>raw_currentload...</td>
<td>rawCurrentLoad...</td>
<td>X</td>
<td></td>
<td>X</td>
@ -174,33 +174,33 @@
si.currentLoad().then(data => console.log(data));</code></pre class="example">
<pre class="example">
{
avgload: 0.23,
currentload: 4.326328800988875,
currentload_user: 2.595797280593325,
currentload_system: 1.73053152039555,
currentload_nice: 0,
currentload_idle: 95.67367119901112,
currentload_irq: 0,
raw_currentload: 350,
raw_currentload_user: 210,
raw_currentload_system: 140,
raw_currentload_nice: 0,
raw_currentload_idle: 7740,
raw_currentload_irq: 0,
avgLoad: 0.23,
currentLoad: 4.326328800988875,
currentLoadUser: 2.595797280593325,
currentLoadSystem: 1.73053152039555,
currentLoadNice: 0,
currentLoadIdle: 95.67367119901112,
currentLoadIrq: 0,
rawCurrentLoad: 350,
rawCurrentLoadUser: 210,
rawCurrentLoadSystem: 140,
rawCurrentLoadNice: 0,
rawCurrentLoadIdle: 7740,
rawCurrentLoadIrq: 0,
cpus: [
{
load: 13.725490196078432,
load_user: 7.8431372549019605,
load_system: 5.88235294117647,
load_nice: 0,
load_idle: 86.27450980392157,
load_irq: 0,
raw_load: 140,
raw_load_user: 80,
raw_load_system: 60,
raw_load_nice: 0,
raw_load_idle: 880,
raw_load_irq: 0
loadUser: 7.8431372549019605,
loadSystem: 5.88235294117647,
loadNice: 0,
loadIdle: 86.27450980392157,
loadIrq: 0,
rawLoad: 140,
rawLoadUser: 80,
rawLoadSystem: 60,
rawLoadNice: 0,
rawLoadIdle: 880,
rawLoadIrq: 0
},
...
]
@ -368,7 +368,7 @@ si.currentLoad().then(data => console.log(data));</code></pre class="example">
</tr>
<tr>
<td></td>
<td>...[0].mem_vsz</td>
<td>...[0].memVsz</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -378,7 +378,7 @@ si.currentLoad().then(data => console.log(data));</code></pre class="example">
</tr>
<tr>
<td></td>
<td>...[0].mem_rss</td>
<td>...[0].memRss</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -489,8 +489,8 @@ si.processes().then(data => console.log(data));</code></pre class="example">
pcpus: 0.00420463676138747,
pmem: 0,
priority: 19,
mem_vsz: 166144,
mem_rss: 10684,
memVsz: 166144,
memRss: 10684,
nice: 0,
started: '2020-02-08 10:18:15',
state: 'sleeping',

View File

@ -278,7 +278,7 @@
</tr>
<tr>
<td></td>
<td>[0].HPET</td>
<td>[0].hpet</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -288,7 +288,7 @@
</tr>
<tr>
<td></td>
<td>[0].PAE</td>
<td>[0].pae</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -318,7 +318,7 @@
</tr>
<tr>
<td></td>
<td>[0].APIC</td>
<td>[0].apic</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -328,7 +328,7 @@
</tr>
<tr>
<td></td>
<td>[0].X2APIC</td>
<td>[0].x2Apic</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -338,7 +338,7 @@
</tr>
<tr>
<td></td>
<td>[0].ACPI</td>
<td>[0].acpi</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -348,7 +348,7 @@
</tr>
<tr>
<td></td>
<td>[0].IOAPIC</td>
<td>[0].ioApic</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -358,7 +358,7 @@
</tr>
<tr>
<td></td>
<td>[0].biosAPICmode</td>
<td>[0].biosApicMode</td>
<td>X</td>
<td>X</td>
<td>X</td>
@ -428,7 +428,7 @@
</tr>
<tr>
<td></td>
<td>[0].RTC</td>
<td>[0].rtc</td>
<td>X</td>
<td>X</td>
<td>X</td>

View File

@ -32,17 +32,17 @@ module.exports = function (callback) {
return new Promise((resolve) => {
process.nextTick(() => {
let result = {
hasbattery: false,
cyclecount: 0,
ischarging: false,
designedcapacity: 0,
maxcapacity: 0,
currentcapacity: 0,
hasBattery: false,
cycleCount: 0,
isCharging: false,
designedCapacity: 0,
maxCapacity: 0,
currentCapacity: 0,
voltage: 0,
capacityUnit: '',
percent: 0,
timeremaining: null,
acconnected: true,
timeRemaining: null,
acConnected: true,
type: '',
model: '',
manufacturer: '',
@ -61,18 +61,18 @@ module.exports = function (callback) {
if (!error) {
let lines = stdout.toString().split('\n');
result.ischarging = (util.getValue(lines, 'POWER_SUPPLY_STATUS', '=').toLowerCase() === 'charging');
result.acconnected = result.ischarging;
result.isCharging = (util.getValue(lines, 'POWER_SUPPLY_STATUS', '=').toLowerCase() === 'charging');
result.acConnected = result.isCharging;
result.voltage = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_VOLTAGE_NOW', '='), 10) / 1000000.0;
result.capacityUnit = result.voltage ? 'mWh' : 'mAh';
result.cyclecount = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CYCLE_COUNT', '='), 10);
result.maxcapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL', '='), 10) / 1000.0 / (result.voltage || 1));
result.designedcapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL_DESIGN', '='), 10) / 1000.0 / (result.voltage || 1)) | result.maxcapacity;
result.currentcapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10) / 1000.0 / (result.voltage || 1));
if (!result.maxcapacity) {
result.maxcapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL', '='), 10) / 1000.0;
result.designcapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL_DESIGN', '='), 10) / 1000.0 | result.maxcapacity;
result.currentcapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10) / 1000.0;
result.cycleCount = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CYCLE_COUNT', '='), 10);
result.maxCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL', '='), 10) / 1000.0 / (result.voltage || 1));
result.designedCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL_DESIGN', '='), 10) / 1000.0 / (result.voltage || 1)) | result.maxcapacity;
result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10) / 1000.0 / (result.voltage || 1));
if (!result.maxCapacity) {
result.maxCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL', '='), 10) / 1000.0;
result.designCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL_DESIGN', '='), 10) / 1000.0 | result.maxCapacity;
result.currentCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10) / 1000.0;
}
const percent = util.getValue(lines, 'POWER_SUPPLY_CAPACITY', '=');
const energy = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10);
@ -80,19 +80,19 @@ module.exports = function (callback) {
const current = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CURRENT_NOW', '='), 10);
result.percent = parseInt('0' + percent, 10);
if (result.maxcapacity && result.currentcapacity) {
result.hasbattery = true;
if (result.maxCapacity && result.currentCapacity) {
result.hasBattery = true;
if (!percent) {
result.percent = 100.0 * result.currentcapacity / result.maxcapacity;
result.percent = 100.0 * result.currentCapacity / result.maxCapacity;
}
}
if (result.ischarging) {
result.hasbattery = true;
if (result.isCharging) {
result.hasBattery = true;
}
if (energy && power) {
result.timeremaining = Math.floor(energy / power * 60);
} else if (current && result.currentcapacity) {
result.timeremaining = Math.floor(result.currentcapacity / current * 60);
result.timeRemaining = Math.floor(energy / power * 60);
} else if (current && result.currentCapacity) {
result.timeRemaining = Math.floor(result.currentCapacity / current * 60);
}
result.type = util.getValue(lines, 'POWER_SUPPLY_TECHNOLOGY', '=');
result.model = util.getValue(lines, 'POWER_SUPPLY_MODEL_NAME', '=');
@ -115,12 +115,12 @@ module.exports = function (callback) {
let lines = stdout.toString().split('\n');
const batteries = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.units'), 10);
const percent = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.life'), 10);
result.hasbattery = (batteries > 0);
result.cyclecount = null;
result.ischarging = util.getValue(lines, 'hw.acpi.acline') !== '1';
result.acconnected = result.ischarging;
result.maxcapacity = null;
result.currentcapacity = null;
result.hasBattery = (batteries > 0);
result.cycleCount = null;
result.isCharging = util.getValue(lines, 'hw.acpi.acline') !== '1';
result.acConnected = result.isCharging;
result.maxCapacity = null;
result.currentCapacity = null;
result.capacityUnit = 'unknown';
result.percent = batteries ? percent : null;
if (callback) { callback(result); }
@ -132,12 +132,12 @@ module.exports = function (callback) {
exec('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|BatterySerialNumber|TimeRemaining|Voltage"; pmset -g batt | grep %', function (error, stdout) {
if (stdout) {
let lines = stdout.toString().replace(/ +/g, '').replace(/"+/g, '').replace(/-/g, '').split('\n');
result.cyclecount = parseInt('0' + util.getValue(lines, 'cyclecount', '='), 10);
result.cycleCount = parseInt('0' + util.getValue(lines, 'cyclecount', '='), 10);
result.voltage = parseInt('0' + util.getValue(lines, 'voltage', '='), 10) / 1000.0;
result.capacityUnit = result.voltage ? 'mWh' : 'mAh';
result.maxcapacity = Math.round(parseInt('0' + util.getValue(lines, 'maxcapacity', '='), 10) * (result.voltage || 1));
result.currentcapacity = Math.round(parseInt('0' + util.getValue(lines, 'currentcapacity', '='), 10) * (result.voltage || 1));
result.designedcapacity = Math.round(parseInt('0' + util.getValue(lines, 'DesignCapacity', '='), 10) * (result.voltage || 1));
result.maxCapacity = Math.round(parseInt('0' + util.getValue(lines, 'maxcapacity', '='), 10) * (result.voltage || 1));
result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'currentcapacity', '='), 10) * (result.voltage || 1));
result.designedCapacity = Math.round(parseInt('0' + util.getValue(lines, 'DesignCapacity', '='), 10) * (result.voltage || 1));
result.manufacturer = 'Apple';
result.serial = util.getValue(lines, 'BatterySerialNumber', '=');
let percent = null;
@ -150,18 +150,18 @@ module.exports = function (callback) {
}
}
if (parts && parts[1]) {
result.ischarging = (parts[1].trim() === 'charging');
result.acconnected = (parts[1].trim() !== 'discharging');
result.isCharging = (parts[1].trim() === 'charging');
result.acConnected = (parts[1].trim() !== 'discharging');
} else {
result.ischarging = util.getValue(lines, 'ischarging', '=').toLowerCase() === 'yes';
result.acconnected = result.ischarging;
result.isCharging = util.getValue(lines, 'ischarging', '=').toLowerCase() === 'yes';
result.acConnected = result.isCharging;
}
if (result.maxcapacity && result.currentcapacity) {
result.hasbattery = true;
if (result.maxCapacity && result.currentCapacity) {
result.hasBattery = true;
result.type = 'Li-ion';
result.percent = percent !== null ? percent : Math.round(100.0 * result.currentcapacity / result.maxcapacity);
if (!result.ischarging) {
result.timeremaining = parseInt('0' + util.getValue(lines, 'TimeRemaining', '='), 10);
result.percent = percent !== null ? percent : Math.round(100.0 * result.currentCapacity / result.maxCapacity);
if (!result.isCharging) {
result.timeRemaining = parseInt('0' + util.getValue(lines, 'TimeRemaining', '='), 10);
}
}
}
@ -192,15 +192,15 @@ module.exports = function (callback) {
// 11 = "Partially Charged"
if (status && status != '10') {
const statusValue = parseInt(status);
result.hasbattery = true;
result.maxcapacity = parseInt(util.getValue(lines, 'DesignCapacity', '=') || 0);
result.designcapacity = parseInt(util.getValue(lines, 'DesignCapacity', '=') || 0);
result.hasBattery = true;
result.maxCapacity = parseInt(util.getValue(lines, 'DesignCapacity', '=') || 0);
result.designCapacity = parseInt(util.getValue(lines, 'DesignCapacity', '=') || 0);
result.voltage = parseInt(util.getValue(lines, 'DesignVoltage', '=') || 0) / 1000.0;
result.capacityUnit = 'mWh';
result.percent = parseInt(util.getValue(lines, 'EstimatedChargeRemaining', '=') || 0);
result.currentcapacity = parseInt(result.maxcapacity * result.percent / 100);
result.ischarging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || (!(statusValue === 3) && !(statusValue === 1) && result.percent < 100);
result.acconnected = result.ischarging || statusValue === 2;
result.currentCapacity = parseInt(result.maxcapacity * result.percent / 100);
result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || (!(statusValue === 3) && !(statusValue === 1) && result.percent < 100);
result.acConnected = result.ischarging || statusValue === 2;
}
}
if (callback) { callback(result); }

View File

@ -39,18 +39,18 @@ let _current_cpu = {
load: 0,
tick: 0,
ms: 0,
currentload: 0,
currentload_user: 0,
currentload_system: 0,
currentload_nice: 0,
currentload_idle: 0,
currentload_irq: 0,
raw_currentload: 0,
raw_currentload_user: 0,
raw_currentload_system: 0,
raw_currentload_nice: 0,
raw_currentload_idle: 0,
raw_currentload_irq: 0
currentLoad: 0,
currentLoadUser: 0,
currentLoadSystem: 0,
currentLoadNice: 0,
currentLoadIdle: 0,
currentLoadIrq: 0,
rawCurrentLoad: 0,
rawCurrentLoadUser: 0,
rawCurrentLoadSystem: 0,
rawCurrentLoadNice: 0,
rawCurrentLoadIdle: 0,
rawCurrentLoadIrq: 0
};
let _cpus = [];
let _corecount = 0;
@ -889,7 +889,7 @@ function getCpuCurrentSpeedSync() {
}
}
function cpuCurrentspeed(callback) {
function cpuCurrentSpeed(callback) {
return new Promise((resolve) => {
process.nextTick(() => {
@ -909,7 +909,7 @@ function cpuCurrentspeed(callback) {
});
}
exports.cpuCurrentspeed = cpuCurrentspeed;
exports.cpuCurrentSpeed = cpuCurrentSpeed;
// --------------------------
// CPU - temperature
@ -1357,7 +1357,7 @@ function getLoad() {
return new Promise((resolve) => {
process.nextTick(() => {
let loads = os.loadavg().map(function (x) { return x / util.cores(); });
let avgload = parseFloat((Math.max.apply(Math, loads)).toFixed(2));
let avgLoad = parseFloat((Math.max.apply(Math, loads)).toFixed(2));
let result = {};
let now = Date.now() - _current_cpu.ms;
@ -1379,54 +1379,54 @@ function getLoad() {
totalNice += cpu.nice;
totalIdle += cpu.idle;
totalIrq += cpu.irq;
let tmp_tick = (_cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0);
let tmp_load = (_cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0);
let tmp_user = (_cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0);
let tmp_system = (_cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0);
let tmp_nice = (_cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0);
let tmp_idle = (_cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0);
let tmp_irq = (_cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0);
let tmpTick = (_cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0);
let tmpLoad = (_cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0);
let tmpUser = (_cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0);
let tmpSystem = (_cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0);
let tmpNice = (_cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0);
let tmpIdle = (_cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0);
let tmpIrq = (_cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0);
_cpus[i] = cpu;
_cpus[i].totalTick = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].idle;
_cpus[i].totalLoad = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq;
_cpus[i].currentTick = _cpus[i].totalTick - tmp_tick;
_cpus[i].load = (_cpus[i].totalLoad - tmp_load);
_cpus[i].load_user = (_cpus[i].user - tmp_user);
_cpus[i].load_system = (_cpus[i].sys - tmp_system);
_cpus[i].load_nice = (_cpus[i].nice - tmp_nice);
_cpus[i].load_idle = (_cpus[i].idle - tmp_idle);
_cpus[i].load_irq = (_cpus[i].irq - tmp_irq);
_cpus[i].currentTick = _cpus[i].totalTick - tmpTick;
_cpus[i].load = (_cpus[i].totalLoad - tmpLoad);
_cpus[i].loadUser = (_cpus[i].user - tmpUser);
_cpus[i].loadSystem = (_cpus[i].sys - tmpSystem);
_cpus[i].loadNice = (_cpus[i].nice - tmpNice);
_cpus[i].loadIdle = (_cpus[i].idle - tmpIdle);
_cpus[i].loadIrq = (_cpus[i].irq - tmpIrq);
cores[i] = {};
cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100;
cores[i].load_user = _cpus[i].load_user / _cpus[i].currentTick * 100;
cores[i].load_system = _cpus[i].load_system / _cpus[i].currentTick * 100;
cores[i].load_nice = _cpus[i].load_nice / _cpus[i].currentTick * 100;
cores[i].load_idle = _cpus[i].load_idle / _cpus[i].currentTick * 100;
cores[i].load_irq = _cpus[i].load_irq / _cpus[i].currentTick * 100;
cores[i].raw_load = _cpus[i].load;
cores[i].raw_load_user = _cpus[i].load_user;
cores[i].raw_load_system = _cpus[i].load_system;
cores[i].raw_load_nice = _cpus[i].load_nice;
cores[i].raw_load_idle = _cpus[i].load_idle;
cores[i].raw_load_irq = _cpus[i].load_irq;
cores[i].loadUser = _cpus[i].load_user / _cpus[i].currentTick * 100;
cores[i].loadSystem = _cpus[i].load_system / _cpus[i].currentTick * 100;
cores[i].loadNice = _cpus[i].load_nice / _cpus[i].currentTick * 100;
cores[i].loadIdle = _cpus[i].load_idle / _cpus[i].currentTick * 100;
cores[i].loadIrq = _cpus[i].load_irq / _cpus[i].currentTick * 100;
cores[i].rawLoad = _cpus[i].load;
cores[i].rawLoadUser = _cpus[i].loadUser;
cores[i].rawLoadSystem = _cpus[i].loadSystem;
cores[i].rawLoadNice = _cpus[i].loadNice;
cores[i].rawLoadIdle = _cpus[i].loadIdle;
cores[i].rawLoadIrq = _cpus[i].loadIrq;
}
let totalTick = totalUser + totalSystem + totalNice + totalIrq + totalIdle;
let totalLoad = totalUser + totalSystem + totalNice + totalIrq;
let currentTick = totalTick - _current_cpu.tick;
result = {
avgload: avgload,
currentload: (totalLoad - _current_cpu.load) / currentTick * 100,
currentload_user: (totalUser - _current_cpu.user) / currentTick * 100,
currentload_system: (totalSystem - _current_cpu.system) / currentTick * 100,
currentload_nice: (totalNice - _current_cpu.nice) / currentTick * 100,
currentload_idle: (totalIdle - _current_cpu.idle) / currentTick * 100,
currentload_irq: (totalIrq - _current_cpu.irq) / currentTick * 100,
raw_currentload: (totalLoad - _current_cpu.load),
raw_currentload_user: (totalUser - _current_cpu.user),
raw_currentload_system: (totalSystem - _current_cpu.system),
raw_currentload_nice: (totalNice - _current_cpu.nice),
raw_currentload_idle: (totalIdle - _current_cpu.idle),
raw_currentload_irq: (totalIrq - _current_cpu.irq),
avgLoad: avgLoad,
currentLoad: (totalLoad - _current_cpu.load) / currentTick * 100,
currentLoadUser: (totalUser - _current_cpu.user) / currentTick * 100,
currentLoadSystem: (totalSystem - _current_cpu.system) / currentTick * 100,
currentLoadNice: (totalNice - _current_cpu.nice) / currentTick * 100,
currentLoadIdle: (totalIdle - _current_cpu.idle) / currentTick * 100,
currentLoadIrq: (totalIrq - _current_cpu.irq) / currentTick * 100,
rawCurrentLoad: (totalLoad - _current_cpu.load),
rawCurrentLoadUser: (totalUser - _current_cpu.user),
rawCurrentLoadSystem: (totalSystem - _current_cpu.system),
rawCurrentLoadNice: (totalNice - _current_cpu.nice),
rawCurrentLoadIdle: (totalIdle - _current_cpu.idle),
rawCurrentLoadIrq: (totalIrq - _current_cpu.irq),
cpus: cores
};
_current_cpu = {
@ -1438,50 +1438,50 @@ function getLoad() {
tick: totalTick,
load: totalLoad,
ms: _current_cpu.ms,
currentload: result.currentload,
currentload_user: result.currentload_user,
currentload_system: result.currentload_system,
currentload_nice: result.currentload_nice,
currentload_idle: result.currentload_idle,
currentload_irq: result.currentload_irq,
raw_currentload: result.raw_currentload,
raw_currentload_user: result.raw_currentload_user,
raw_currentload_system: result.raw_currentload_system,
raw_currentload_nice: result.raw_currentload_nice,
raw_currentload_idle: result.raw_currentload_idle,
raw_currentload_irq: result.raw_currentload_irq,
currentLoad: result.currentLoad,
currentLoadUser: result.currentLoadUser,
currentLoadSystem: result.currentLoadSystem,
currentLoadNice: result.currentLoadNice,
currentLoadIdle: result.currentLoadIdle,
currentLoadIrq: result.currentLoadIrq,
rawCurrentLoad: result.rawCurrentLoad,
rawCurrentLoadUser: result.rawCurrentLoadUser,
rawCurrentLoadSystem: result.rawCurrentLoadSystem,
rawCurrentLoadNice: result.rawCurrentLoadNice,
rawCurrentLoadIdle: result.rawCurrentLoadIdle,
rawCurrentLoadIrq: result.rawCurrentLoadIrq,
};
} else {
let cores = [];
for (let i = 0; i < _corecount; i++) {
cores[i] = {};
cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100;
cores[i].load_user = _cpus[i].load_user / _cpus[i].currentTick * 100;
cores[i].load_system = _cpus[i].load_system / _cpus[i].currentTick * 100;
cores[i].load_nice = _cpus[i].load_nice / _cpus[i].currentTick * 100;
cores[i].load_idle = _cpus[i].load_idle / _cpus[i].currentTick * 100;
cores[i].load_irq = _cpus[i].load_irq / _cpus[i].currentTick * 100;
cores[i].raw_load = _cpus[i].load;
cores[i].raw_load_user = _cpus[i].load_user;
cores[i].raw_load_system = _cpus[i].load_system;
cores[i].raw_load_nice = _cpus[i].load_nice;
cores[i].raw_load_idle = _cpus[i].load_idle;
cores[i].raw_load_irq = _cpus[i].load_irq;
cores[i].loadUser = _cpus[i].loadUser / _cpus[i].currentTick * 100;
cores[i].loadSystem = _cpus[i].loadSystem / _cpus[i].currentTick * 100;
cores[i].loadNice = _cpus[i].loadNice / _cpus[i].currentTick * 100;
cores[i].loadIdle = _cpus[i].loadIdle / _cpus[i].currentTick * 100;
cores[i].loadIrq = _cpus[i].loadIrq / _cpus[i].currentTick * 100;
cores[i].rawLoad = _cpus[i].load;
cores[i].rawLoadUser = _cpus[i].loadUser;
cores[i].rawLoadSystem = _cpus[i].loadSystem;
cores[i].rawLoadNice = _cpus[i].loadNice;
cores[i].rawLoadIdle = _cpus[i].loadIdle;
cores[i].rawLoadIrq = _cpus[i].loadIrq;
}
result = {
avgload: avgload,
avgLoad: avgLoad,
currentload: _current_cpu.currentload,
currentload_user: _current_cpu.currentload_user,
currentload_system: _current_cpu.currentload_system,
currentload_nice: _current_cpu.currentload_nice,
currentload_idle: _current_cpu.currentload_idle,
currentload_irq: _current_cpu.currentload_irq,
raw_currentload: _current_cpu.raw_currentload,
raw_currentload_user: _current_cpu.raw_currentload_user,
raw_currentload_system: _current_cpu.raw_currentload_system,
raw_currentload_nice: _current_cpu.raw_currentload_nice,
raw_currentload_idle: _current_cpu.raw_currentload_idle,
raw_currentload_irq: _current_cpu.raw_currentload_irq,
currentloadUser: _current_cpu.currentloadUser,
currentloadSystem: _current_cpu.currentloadSystem,
currentloadNice: _current_cpu.currentloadNice,
currentloadIdle: _current_cpu.currentloadIdle,
currentloadIrq: _current_cpu.currentloadIrq,
rawCurrentload: _current_cpu.rawCurrentload,
rawCurrentloadUser: _current_cpu.rawCurrentloadUser,
rawCurrentloadSystem: _current_cpu.rawCurrentloadSystem,
rawCurrentloadNice: _current_cpu.rawCurrentloadNice,
rawCurrentloadIdle: _current_cpu.rawCurrentloadIdle,
rawCurrentloadIrq: _current_cpu.rawCurrentloadIrq,
cpus: cores
};
}

View File

@ -379,10 +379,10 @@ function dockerContainerStatsSingle(containerID) {
containerID = containerID || '';
let result = {
id: containerID,
mem_usage: 0,
mem_limit: 0,
mem_percent: 0,
cpu_percent: 0,
memUsage: 0,
memLimit: 0,
memPercent: 0,
cpuPercent: 0,
pids: 0,
netIO: {
rx: 0,
@ -406,30 +406,19 @@ function dockerContainerStatsSingle(containerID) {
_docker_socket.getStats(containerID, data => {
try {
let stats = data;
/**
* @namespace
* @property {Object} memory_stats
* @property {number} memory_stats.usage
* @property {number} memory_stats.limit
* @property {Object} cpu_stats
* @property {Object} pids_stats
* @property {number} pids_stats.current
* @property {Object} networks
* @property {Object} blkio_stats
*/
if (!stats.message) {
result.mem_usage = (stats.memory_stats && stats.memory_stats.usage ? stats.memory_stats.usage : 0);
result.mem_limit = (stats.memory_stats && stats.memory_stats.limit ? stats.memory_stats.limit : 0);
result.mem_percent = (stats.memory_stats && stats.memory_stats.usage && stats.memory_stats.limit ? stats.memory_stats.usage / stats.memory_stats.limit * 100.0 : 0);
result.cpu_percent = (stats.cpu_stats && stats.precpu_stats ? docker_calcCPUPercent(stats.cpu_stats, stats.precpu_stats) : 0);
result.memUsage = (stats.memory_stats && stats.memory_stats.usage ? stats.memory_stats.usage : 0);
result.memLimit = (stats.memory_stats && stats.memory_stats.limit ? stats.memory_stats.limit : 0);
result.memPercent = (stats.memory_stats && stats.memory_stats.usage && stats.memory_stats.limit ? stats.memory_stats.usage / stats.memory_stats.limit * 100.0 : 0);
result.cpuPercent = (stats.cpu_stats && stats.precpu_stats ? docker_calcCPUPercent(stats.cpu_stats, stats.precpu_stats) : 0);
result.pids = (stats.pids_stats && stats.pids_stats.current ? stats.pids_stats.current : 0);
result.restartCount = (dataInspect.RestartCount ? dataInspect.RestartCount : 0);
if (stats.networks) result.netIO = docker_calcNetworkIO(stats.networks);
if (stats.blkio_stats) result.blockIO = docker_calcBlockIO(stats.blkio_stats);
result.cpu_stats = (stats.cpu_stats ? stats.cpu_stats : {});
result.precpu_stats = (stats.precpu_stats ? stats.precpu_stats : {});
result.memory_stats = (stats.memory_stats ? stats.memory_stats : {});
result.cpuStats = (stats.cpu_stats ? stats.cpu_stats : {});
result.precpuStats = (stats.precpu_stats ? stats.precpu_stats : {});
result.memoryStats = (stats.memory_stats ? stats.memory_stats : {});
result.networks = (stats.networks ? stats.networks : {});
}
} catch (err) {
@ -493,7 +482,7 @@ function dockerContainerProcesses(containerID, callback) {
data.Processes.forEach(process => {
result.push({
pid_host: (pos_pid >= 0 ? process[pos_pid] : ''),
pidHost: (pos_pid >= 0 ? process[pos_pid] : ''),
ppid: (pos_ppid >= 0 ? process[pos_ppid] : ''),
pgid: (pos_pgid >= 0 ? process[pos_pgid] : ''),
user: (pos_user >= 0 ? process[pos_user] : ''),
@ -535,16 +524,16 @@ function dockerAll(callback) {
result.forEach(function (element) {
dockerContainerStats(element.id).then(res => {
// include stats in array
element.mem_usage = res[0].mem_usage;
element.mem_limit = res[0].mem_limit;
element.mem_percent = res[0].mem_percent;
element.cpu_percent = res[0].cpu_percent;
element.memUsage = res[0].memUsage;
element.memLimit = res[0].memLimit;
element.memPercent = res[0].memPercent;
element.cpuPercent = res[0].cpuPercent;
element.pids = res[0].pids;
element.netIO = res[0].netIO;
element.blockIO = res[0].blockIO;
element.cpu_stats = res[0].cpu_stats;
element.precpu_stats = res[0].precpu_stats;
element.memory_stats = res[0].memory_stats;
element.cpuStats = res[0].cpuStats;
element.precpuStats = res[0].precpuStats;
element.memoryStats = res[0].memoryStats;
element.networks = res[0].networks;
dockerContainerProcesses(element.id).then(processes => {

View File

@ -54,16 +54,16 @@ function fsSize(callback) {
line = line.replace(/ +/g, ' ').split(' ');
if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0))) {
const fs = line[0];
const fstype = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0]));
const fsType = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0]));
const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024;
const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024;
const available = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[4] : line[3])) * 1024;
const use = parseFloat((100.0 * (used / (used + available))).toFixed(2));
const mount = line[line.length - 1];
if (!data.find(el => (el.fs === fs && el.type === fstype))) {
if (!data.find(el => (el.fs === fs && el.type === fsType))) {
data.push({
fs,
type: fstype,
type: fsType,
size,
used,
available,
@ -233,7 +233,7 @@ function parseDevices(lines) {
name: '',
identifier: '',
type: 'disk',
fstype: '',
fsType: '',
mount: '',
size: 0,
physical: 'HDD',
@ -253,7 +253,7 @@ function parseDevices(lines) {
}
if ('PROTOCOL' === parts[0]) devices[i].protocol = parts[1];
if ('DISKSIZE' === parts[0]) devices[i].size = parseBytes(parts[1]);
if ('FILESYSTEMPERSONALITY' === parts[0]) devices[i].fstype = parts[1];
if ('FILESYSTEMPERSONALITY' === parts[0]) devices[i].fsType = parts[1];
if ('MOUNTPOINT' === parts[0]) devices[i].mount = parts[1];
if ('VOLUMEUUID' === parts[0]) devices[i].uuid = parts[1];
if ('READ-ONLYMEDIA' === parts[0] && parts[1] === 'Yes') devices[i].physical = 'CD/DVD';
@ -280,7 +280,7 @@ function parseBlk(lines) {
data.push({
'name': disk.name,
'type': disk.type,
'fstype': disk.fstype,
'fsType': disk.fsType,
'mount': disk.mountpoint,
'size': parseInt(disk.size),
'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')),
@ -304,7 +304,7 @@ function parseBlk(lines) {
function blkStdoutToObject(stdout) {
return stdout.toString()
.replace(/NAME=/g, '{"name":')
.replace(/FSTYPE=/g, ',"fstype":')
.replace(/FSTYPE=/g, ',"fsType":')
.replace(/TYPE=/g, ',"type":')
.replace(/SIZE=/g, ',"size":')
.replace(/MOUNTPOINT=/g, ',"mountpoint":')
@ -382,7 +382,7 @@ function blockDevices(callback) {
name: util.getValue(lines, 'name', '='),
identifier: util.getValue(lines, 'caption', '='),
type: 'disk',
fstype: util.getValue(lines, 'filesystem', '=').toLowerCase(),
fsType: util.getValue(lines, 'filesystem', '=').toLowerCase(),
mount: util.getValue(lines, 'caption', '='),
size: util.getValue(lines, 'size', '='),
physical: (drivetype >= 0 && drivetype <= 6) ? drivetypes[drivetype] : drivetypes[0],
@ -770,14 +770,14 @@ function diskLayout(callback) {
try {
const outJSON = JSON.parse(out);
if (outJSON && {}.hasOwnProperty.call(outJSON, 'blockdevices')) {
devices = outJSON.blockdevices.filter(item => { return (item.group === 'disk' || item.type === 'disk') && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fstype === null && item.parttype === null)); });
devices = outJSON.blockdevices.filter(item => { return (item.group === 'disk' || item.type === 'disk') && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fsType === null && item.parttype === null)); });
}
} catch (e) {
// fallback to older version of lsblk
const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL').toString();
let lines = blkStdoutToObject(out2).split('\n');
const data = parseBlk(lines);
devices = data.filter(item => { return (item.group === 'disk' || item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mountpoint === '' && item.label === '' && item.fstype === '')); });
devices = data.filter(item => { return (item.group === 'disk' || item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mountpoint === '' && item.label === '' && item.fsType === '')); });
}
devices.forEach((device) => {
let mediumType = '';

View File

@ -30,10 +30,10 @@ const _openbsd = (_platform === 'openbsd');
const _netbsd = (_platform === 'netbsd');
const _sunos = (_platform === 'sunos');
let _resolutionx = 0;
let _resolutiony = 0;
let _pixeldepth = 0;
let _refreshrate = 0;
let _resolutionX = 0;
let _resolutionY = 0;
let _pixelDepth = 0;
let _refreshRate = 0;
const videoTypes = {
'-2': 'UNINITIALIZED',
@ -78,11 +78,11 @@ function graphics(callback) {
main: false,
builtin: false,
connection: '',
sizex: null,
sizey: null,
pixeldepth: null,
resolutionx: null,
resolutiony: null,
sizeX: null,
sizeY: null,
pixelDepth: null,
resolutionX: null,
resolutionY: null,
currentResX: null,
currentResY: null,
positionX: 0,
@ -116,11 +116,11 @@ function graphics(callback) {
main: false,
builtin: false,
connection: '',
sizex: null,
sizey: null,
pixeldepth: null,
resolutionx: null,
resolutiony: null,
sizeX: null,
sizeY: null,
pixelDepth: null,
resolutionX: null,
resolutionY: null,
currentResX: null,
currentResY: null,
positionX: 0,
@ -162,23 +162,23 @@ function graphics(callback) {
currentDisplay.main = false;
currentDisplay.builtin = false;
currentDisplay.connection = '';
currentDisplay.sizex = null;
currentDisplay.sizey = null;
currentDisplay.sizeX = null;
currentDisplay.sizeY = null;
currentDisplay.positionX = 0;
currentDisplay.positionY = 0;
currentDisplay.pixeldepth = null;
currentDisplay.pixelDepth = null;
}
}
if (4 === level) { // display controller details level
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('resolution') !== -1) {
let resolution = parts[1].split('x');
currentDisplay.resolutionx = (resolution.length > 1 ? parseInt(resolution[0]) : 0);
currentDisplay.resolutiony = (resolution.length > 1 ? parseInt(resolution[1]) : 0);
currentDisplay.currentResX = currentDisplay.resolutionx;
currentDisplay.currentResY = currentDisplay.resolutiony;
currentDisplay.resolutionX = (resolution.length > 1 ? parseInt(resolution[0]) : 0);
currentDisplay.resolutionY = (resolution.length > 1 ? parseInt(resolution[1]) : 0);
currentDisplay.currentResX = currentDisplay.resolutionX;
currentDisplay.currentResY = currentDisplay.resolutionY;
}
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('pixeldepth') !== -1) currentDisplay.pixeldepth = parseInt(parts[1]); // in BIT
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('framebufferdepth') !== -1) currentDisplay.pixeldepth = parseInt(parts[1]); // in BIT
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('pixeldepth') !== -1) currentDisplay.pixelDepth = parseInt(parts[1]); // in BIT
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('framebufferdepth') !== -1) currentDisplay.pixelDepth = parseInt(parts[1]); // in BIT
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('maindisplay') !== -1 && parts[1].replace(/ +/g, '').toLowerCase() === 'yes') currentDisplay.main = true;
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('built-in') !== -1 && parts[1].replace(/ +/g, '').toLowerCase() === 'yes') {
currentDisplay.vendor = 'Apple';
@ -505,11 +505,11 @@ function graphics(callback) {
main: false,
builtin: false,
connection: '',
sizex: null,
sizey: null,
pixeldepth: null,
resolutionx: null,
resolutiony: null,
sizeX: null,
sizeY: null,
pixelDepth: null,
resolutionX: null,
resolutionY: null,
currentResX: null,
currentResY: null,
positionX: 0,
@ -530,10 +530,10 @@ function graphics(callback) {
if (edid.substr(start, 6) === '000000') {
start += 36;
}
result.resolutionx = parseInt('0x0' + edid.substr(start + 8, 1) + edid.substr(start + 4, 2));
result.resolutiony = parseInt('0x0' + edid.substr(start + 14, 1) + edid.substr(start + 10, 2));
result.sizex = parseInt('0x0' + edid.substr(start + 28, 1) + edid.substr(start + 24, 2));
result.sizey = parseInt('0x0' + edid.substr(start + 29, 1) + edid.substr(start + 26, 2));
result.resolutionX = parseInt('0x0' + edid.substr(start + 8, 1) + edid.substr(start + 4, 2));
result.resolutionX = parseInt('0x0' + edid.substr(start + 14, 1) + edid.substr(start + 10, 2));
result.sizeX = parseInt('0x0' + edid.substr(start + 28, 1) + edid.substr(start + 24, 2));
result.sizeY = parseInt('0x0' + edid.substr(start + 29, 1) + edid.substr(start + 26, 2));
// monitor name
start = edid.indexOf('000000fc00'); // find first "Monitor Description Data"
if (start >= 0) {
@ -565,11 +565,11 @@ function graphics(callback) {
main: false,
builtin: false,
connection: '',
sizex: null,
sizey: null,
pixeldepth: null,
resolutionx: null,
resolutiony: null,
sizeX: null,
sizeY: null,
pixelDepth: null,
resolutionX: null,
resolutionY: null,
currentResX: null,
currentResY: null,
positionX: 0,
@ -583,7 +583,7 @@ function graphics(callback) {
for (let i = 1; i < lines.length; i++) { // start with second line
if ('' !== lines[i].trim()) {
if (' ' !== lines[i][0] && '\t' !== lines[i][0] && lines[i].toLowerCase().indexOf(' connected ') !== -1) { // first line of new entry
if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizex !== -1 || currentDisplay.pixeldepth !== -1 || currentDisplay.resolutionx !== -1) { // push last display to array
if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizeX !== null || currentDisplay.pixelDepth !== null || currentDisplay.resolutionX !== null) { // push last display to array
displays.push(currentDisplay);
currentDisplay = {
vendor: '',
@ -591,11 +591,11 @@ function graphics(callback) {
main: false,
builtin: false,
connection: '',
sizex: null,
sizey: null,
pixeldepth: null,
resolutionx: null,
resolutiony: null,
sizeX: null,
sizeY: null,
pixelDepth: null,
resolutionX: null,
resolutionY: null,
currentResX: null,
currentResY: null,
positionX: 0,
@ -618,11 +618,11 @@ function graphics(callback) {
let edid_decoded = parseLinesLinuxEdid(edid_raw);
currentDisplay.vendor = edid_decoded.vendor;
currentDisplay.model = edid_decoded.model;
currentDisplay.resolutionx = edid_decoded.resolutionx;
currentDisplay.resolutiony = edid_decoded.resolutiony;
currentDisplay.sizex = edid_decoded.sizex;
currentDisplay.sizey = edid_decoded.sizey;
currentDisplay.pixeldepth = depth;
currentDisplay.resolutionX = edid_decoded.resolutionX;
currentDisplay.resolutionY = edid_decoded.resolutionY;
currentDisplay.sizeX = edid_decoded.sizeX;
currentDisplay.sizeY = edid_decoded.sizeY;
currentDisplay.pixelDepth = depth;
is_edid = false;
}
}
@ -650,7 +650,7 @@ function graphics(callback) {
}
// pushen displays
if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizex !== -1 || currentDisplay.pixeldepth !== -1 || currentDisplay.resolutionx !== -1) { // still information there
if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizeX !== null || currentDisplay.pixelDepth !== null || currentDisplay.resolutionX !== null) { // still information there
displays.push(currentDisplay);
}
return displays;
@ -691,11 +691,11 @@ function graphics(callback) {
main: true,
builtin: false,
connection: 'HDMI',
sizex: null,
sizey: null,
pixeldepth: null,
resolutionx: parseInt(parts[0], 10),
resolutiony: parseInt(parts[1], 10),
sizeX: null,
sizeY: null,
pixelDepth: null,
resolutionX: parseInt(parts[0], 10),
resolutionY: parseInt(parts[1], 10),
currentResX: null,
currentResY: null,
positionX: 0,
@ -847,23 +847,23 @@ function graphics(callback) {
result.displays = parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections);
if (result.displays.length === 1) {
if (_resolutionx) {
result.displays[0].resolutionx = _resolutionx;
if (_resolutionX) {
result.displays[0].resolutionX = _resolutionX;
if (!result.displays[0].currentResX) {
result.displays[0].currentResX = _resolutionx;
result.displays[0].currentResX = _resolutionX;
}
}
if (_resolutiony) {
result.displays[0].resolutiony = _resolutiony;
if (_resolutionY) {
result.displays[0].resolutionY = _resolutionY;
if (result.displays[0].currentResY === 0) {
result.displays[0].currentResY = _resolutiony;
result.displays[0].currentResY = _resolutionY;
}
}
if (_pixeldepth) {
result.displays[0].pixeldepth = _pixeldepth;
if (_pixelDepth) {
result.displays[0].pixelDepth = _pixelDepth;
}
if (_refreshrate && !result.displays[0].refreshrate) {
result.displays[0].currentRefreshRate = _refreshrate;
if (_refreshRate && !result.displays[0].refreshRate) {
result.displays[0].currentRefreshRate = _refreshRate;
}
}
@ -909,10 +909,10 @@ function graphics(callback) {
vramDynamic: (util.getValue(lines, 'VideoMemoryType', '=') === '2'),
subDeviceId
});
_resolutionx = util.toInt(util.getValue(lines, 'CurrentHorizontalResolution', '=')) || _resolutionx;
_resolutiony = util.toInt(util.getValue(lines, 'CurrentVerticalResolution', '=')) || _resolutiony;
_refreshrate = util.toInt(util.getValue(lines, 'CurrentRefreshRate', '=')) || _refreshrate;
_pixeldepth = util.toInt(util.getValue(lines, 'CurrentBitsPerPixel', '=')) || _pixeldepth;
_resolutionX = util.toInt(util.getValue(lines, 'CurrentHorizontalResolution', '=')) || _resolutionX;
_resolutionY = util.toInt(util.getValue(lines, 'CurrentVerticalResolution', '=')) || _resolutionY;
_refreshRate = util.toInt(util.getValue(lines, 'CurrentRefreshRate', '=')) || _refreshRate;
_pixelDepth = util.toInt(util.getValue(lines, 'CurrentBitsPerPixel', '=')) || _pixelDepth;
}
}
}
@ -924,15 +924,15 @@ function graphics(callback) {
let vendor = '';
let model = '';
let deviceID = '';
let resolutionx = 0;
let resolutiony = 0;
let resolutionX = 0;
let resolutionY = 0;
if (dsections && dsections.length) {
let linesDisplay = dsections[0].split(os.EOL);
vendor = util.getValue(linesDisplay, 'MonitorManufacturer', '=');
model = util.getValue(linesDisplay, 'Name', '=');
deviceID = util.getValue(linesDisplay, 'PNPDeviceID', '=').replace(/&amp;/g, '&').toLowerCase();
resolutionx = util.toInt(util.getValue(linesDisplay, 'ScreenWidth', '='));
resolutiony = util.toInt(util.getValue(linesDisplay, 'ScreenHeight', '='));
resolutionX = util.toInt(util.getValue(linesDisplay, 'ScreenWidth', '='));
resolutionY = util.toInt(util.getValue(linesDisplay, 'ScreenHeight', '='));
}
for (let i = 0; i < ssections.length; i++) {
if (ssections[i].trim() !== '') {
@ -950,8 +950,8 @@ function graphics(callback) {
const bitsPerPixel = util.getValue(linesScreen, 'BitsPerPixel');
const bounds = util.getValue(linesScreen, 'Bounds').replace('{', '').replace('}', '').split(',');
const primary = util.getValue(linesScreen, 'Primary');
const sizex = util.getValue(linesMonitor, 'MaxHorizontalImageSize');
const sizey = util.getValue(linesMonitor, 'MaxVerticalImageSize');
const sizeX = util.getValue(linesMonitor, 'MaxHorizontalImageSize');
const sizeY = util.getValue(linesMonitor, 'MaxVerticalImageSize');
const instanceName = util.getValue(linesMonitor, 'InstanceName').toLowerCase();
const videoOutputTechnology = util.getValue(linesConnection, 'VideoOutputTechnology');
const deviceName = util.getValue(linesScreen, 'DeviceName');
@ -970,11 +970,11 @@ function graphics(callback) {
main: primary.toLowerCase() === 'true',
builtin: videoOutputTechnology === '2147483648',
connection: videoOutputTechnology && videoTypes[videoOutputTechnology] ? videoTypes[videoOutputTechnology] : '',
resolutionx: util.toInt(util.getValue(bounds, 'Width', '=')),
resolutiony: util.toInt(util.getValue(bounds, 'Height', '=')),
sizex: sizex ? parseInt(sizex, 10) : null,
sizey: sizey ? parseInt(sizey, 10) : null,
pixeldepth: bitsPerPixel,
resolutionX: util.toInt(util.getValue(bounds, 'Width', '=')),
resolutionY: util.toInt(util.getValue(bounds, 'Height', '=')),
sizeX: sizeX ? parseInt(sizeX, 10) : null,
sizeY: sizeY ? parseInt(sizeY, 10) : null,
pixelDepth: bitsPerPixel,
currentResX: util.toInt(util.getValue(bounds, 'Width', '=')),
currentResY: util.toInt(util.getValue(bounds, 'Height', '=')),
positionX: util.toInt(util.getValue(bounds, 'X', '=')),
@ -987,13 +987,13 @@ function graphics(callback) {
vendor,
model,
main: true,
resolutionx,
resolutiony,
sizex: null,
sizey: null,
pixeldepth: null,
currentResX: resolutionx,
currentResY: resolutiony,
sizeX: null,
sizeY: null,
resolutionX,
resolutionY,
pixelDepth: null,
currentResX: resolutionX,
currentResY: resolutionY,
positionX: 0,
positionY: 0
});

118
lib/index.d.ts vendored
View File

@ -228,17 +228,17 @@ export namespace Systeminformation {
}
interface BatteryData {
hasbattery: boolean;
cyclecount: number;
ischarging: boolean;
hasBattery: boolean;
cycleCount: number;
isCharging: boolean;
voltage: number;
designedcapacity: number;
maxcapacity: number;
currentcapacity: number;
designedCapacity: number;
maxCapacity: number;
currentCapacity: number;
capacityUnit: string;
percent: number;
timeremaining: number,
acconnected: boolean;
timeRemaining: number,
acConnected: boolean;
type: string;
model: string;
manufacturer: string;
@ -282,11 +282,11 @@ export namespace Systeminformation {
main: boolean;
builtin: boolean;
connection: string;
sizex: number;
sizey: number;
pixeldepth: number;
resolutionx: number;
resolutiony: number;
sizeX: number;
sizeY: number;
pixelDepth: number;
resolutionX: number;
resolutionY: number;
currentResX: number;
currentResY: number;
positionX: number;
@ -381,7 +381,7 @@ export namespace Systeminformation {
name: string;
identifier: string;
type: string;
fstype: string;
fsType: string;
mount: string;
size: number;
physical: string;
@ -453,10 +453,10 @@ export namespace Systeminformation {
interface NetworkConnectionsData {
protocol: string;
localaddress: string;
localport: string;
peeraddress: string;
peerport: string;
localAddress: string;
localPort: string;
peerAddress: string;
peerPort: string;
state: string;
pid: number;
process: string;
@ -485,35 +485,35 @@ export namespace Systeminformation {
// 7. Current Load, Processes & Services
interface CurrentLoadData {
avgload: number;
currentload: number;
currentload_user: number;
currentload_system: number;
currentload_nice: number;
currentload_idle: number;
currentload_irq: number;
raw_currentload: number;
raw_currentload_user: number;
raw_currentload_system: number;
raw_currentload_nice: number;
raw_currentload_idle: number;
raw_currentload_irq: number;
avgLoad: number;
currentLoad: number;
currentLoadUser: number;
currentLoadSystem: number;
currentLoadNice: number;
currentLoadIdle: number;
currentLoadIrq: number;
rawCurrentLoad: number;
rawCurrentLoadUser: number;
rawCurrentLoadSystem: number;
rawCurrentLoadNice: number;
rawCurrentLoadIdle: number;
rawCurrentLoadIrq: number;
cpus: CurrentLoadCpuData[];
}
interface CurrentLoadCpuData {
load: number;
load_user: number;
load_system: number;
load_nice: number;
load_idle: number;
load_irq: number;
raw_load: number;
raw_load_user: number;
raw_load_system: number;
raw_load_nice: number;
raw_load_idle: number;
raw_load_irq: number;
loadUser: number;
loadSystem: number;
loadNice: number;
loadIdle: number;
loadIrq: number;
rawLoad: number;
rawLoadUser: number;
rawLoadSystem: number;
rawLoadNice: number;
rawLoadIdle: number;
rawLoadIrq: number;
}
interface ProcessesData {
@ -534,8 +534,8 @@ export namespace Systeminformation {
pcpus: number;
pmem: number;
priority: number;
mem_vsz: number;
mem_rss: number;
memVsz: number;
memRss: number;
nice: number;
started: string,
state: string;
@ -645,10 +645,10 @@ export namespace Systeminformation {
interface DockerContainerStatsData {
id: string;
mem_usage: number;
mem_limit: number;
mem_percent: number;
cpu_percent: number;
memUsage: number;
memLimit: number;
memPercent: number;
cpuPercent: number;
netIO: {
rx: number;
wx: number;
@ -658,9 +658,9 @@ export namespace Systeminformation {
w: number;
};
restartCount: number;
cpu_stats: any;
precpu_stats: any;
memory_stats: any,
cpuStats: any;
precpuStats: any;
memoryStats: any,
networks: any;
}
@ -687,22 +687,22 @@ export namespace Systeminformation {
configFile: string;
snapshotFolder: string;
logFolder: string;
HPET: boolean;
PAE: boolean;
hpet: boolean;
pae: boolean;
longMode: boolean;
tripleFaultReset: boolean;
APIC: boolean;
X2APIC: boolean;
ACPI: boolean;
IOAPIC: boolean;
biosAPICmode: string;
apic: boolean;
x2Apic: boolean;
acpi: boolean;
ioApic: boolean;
biosApicMode: string;
bootMenuMode: string;
bootDevice1: string;
bootDevice2: string;
bootDevice3: string;
bootDevice4: string;
timeOffset: string;
RTC: string;
rtc: string;
}
interface PrinterData {

View File

@ -181,8 +181,8 @@ function getDynamicData(srv, iface, callback) {
data.node = process.versions.node;
data.v8 = process.versions.v8;
cpu.cpuCurrentspeed().then(res => {
data.cpuCurrentspeed = res;
cpu.cpuCurrentSpeed().then(res => {
data.cpuCurrentSpeed = res;
functionProcessed();
});
@ -445,7 +445,7 @@ exports.uuid = osInfo.uuid;
exports.cpu = cpu.cpu;
exports.cpuFlags = cpu.cpuFlags;
exports.cpuCache = cpu.cpuCache;
exports.cpuCurrentspeed = cpu.cpuCurrentspeed;
exports.cpuCurrentSpeed = cpu.cpuCurrentSpeed;
exports.cpuTemperature = cpu.cpuTemperature;
exports.currentLoad = cpu.currentLoad;
exports.fullLoad = cpu.fullLoad;

View File

@ -564,8 +564,8 @@ function processes(callback) {
pcpus: 0,
pmem: pmem,
priority: priority,
mem_vsz: vsz,
mem_rss: rss,
memVsz: vsz,
memRss: rss,
nice: nice,
started: started,
state: state,
@ -623,8 +623,8 @@ function processes(callback) {
pcpus: 0,
pmem: pmem,
priority: 0,
mem_vsz: parseInt(parts[2]),
mem_rss: parseInt(parts[3]),
memVsz: parseInt(parts[2]),
memRss: parseInt(parts[3]),
nice: parseInt(parts[4]),
started: started,
state: (parts[6] === 'R' ? 'running' : (parts[6] === 'S' ? 'sleeping' : (parts[6] === 'T' ? 'stopped' : (parts[6] === 'W' ? 'paging' : (parts[6] === 'X' ? 'dead' : (parts[6] === 'Z' ? 'zombie' : ((parts[6] === 'D' || parts[6] === 'U') ? 'blocked' : 'unknown'))))))),
@ -800,8 +800,8 @@ function processes(callback) {
pcpus: 0,
pmem: mem / os.totalmem() * 100,
priority: parseInt(util.getValue(lines, 'Priority', '=', true), 10),
mem_vsz: parseInt(util.getValue(lines, 'PageFileUsage', '=', true), 10),
mem_rss: Math.floor(parseInt(util.getValue(lines, 'WorkingSetSize', '=', true), 10) / 1024),
memVsz: parseInt(util.getValue(lines, 'PageFileUsage', '=', true), 10),
memRss: Math.floor(parseInt(util.getValue(lines, 'WorkingSetSize', '=', true), 10) / 1024),
nice: 0,
started: parseTimeWin(util.getValue(lines, 'CreationDate', '=', true)),
state: (!statusValue ? _winStatusValues[0] : _winStatusValues[statusValue]),

View File

@ -74,22 +74,22 @@ function vboxInfo(callback) {
configFile: util.getValue(lines, 'Config file'),
snapshotFolder: util.getValue(lines, 'Snapshot folder'),
logFolder: util.getValue(lines, 'Log folder'),
HPET: util.getValue(lines, 'HPET') === 'enabled',
PAE: util.getValue(lines, 'PAE') === 'enabled',
hpet: util.getValue(lines, 'HPET') === 'enabled',
pae: util.getValue(lines, 'PAE') === 'enabled',
longMode: util.getValue(lines, 'Long Mode') === 'enabled',
tripleFaultReset: util.getValue(lines, 'Triple Fault Reset') === 'enabled',
APIC: util.getValue(lines, 'APIC') === 'enabled',
X2APIC: util.getValue(lines, 'X2APIC') === 'enabled',
ACPI: util.getValue(lines, 'ACPI') === 'enabled',
IOAPIC: util.getValue(lines, 'IOAPIC') === 'enabled',
biosAPICmode: util.getValue(lines, 'BIOS APIC mode'),
apic: util.getValue(lines, 'APIC') === 'enabled',
x2Apic: util.getValue(lines, 'X2APIC') === 'enabled',
acpi: util.getValue(lines, 'ACPI') === 'enabled',
ioApic: util.getValue(lines, 'IOAPIC') === 'enabled',
biosApicMode: util.getValue(lines, 'BIOS APIC mode'),
bootMenuMode: util.getValue(lines, 'Boot menu mode'),
bootDevice1: util.getValue(lines, 'Boot Device 1'),
bootDevice2: util.getValue(lines, 'Boot Device 2'),
bootDevice3: util.getValue(lines, 'Boot Device 3'),
bootDevice4: util.getValue(lines, 'Boot Device 4'),
timeOffset: util.getValue(lines, 'Time offset'),
RTC: util.getValue(lines, 'RTC'),
rtc: util.getValue(lines, 'RTC'),
});
});

View File

@ -20,7 +20,8 @@ function test(f) {
else if (f === 'h') { si.bluetoothDevices().then(data => { if (data !== null) { resolve({ data, title: 'Bluetooth' }); } else { resolve('not_supported') } }) }
else if (f === 'i') { si.inetLatency().then(data => { if (data !== null) { resolve({ data, title: 'Internet Latency' }); } else { resolve('not_supported') } }) }
else if (f === 'I') { si.inetChecksite('www.plus-innovations.com').then(data => { if (data !== null) { resolve({ data, title: 'Internet Check Site' }); } else { resolve('not_supported') } }) }
else if (f === 'l') { si.cpuCurrentspeed().then(data => { if (data !== null) { resolve({ data, title: 'CPU Current Speed' }); } else { resolve('not_supported') } }) }
else if (f === 'j') { si.cpuCurrentSpeed().then(data => { if (data !== null) { resolve({ data, title: 'CPU Current Speed' }); } else { resolve('not_supported') } }) }
else if (f === 'l') { si.currentLoad().then(data => { if (data !== null) { resolve({ data, title: 'CPU Current Load' }); } else { resolve('not_supported') } }) }
else if (f === 'L') { si.fullLoad().then(data => { if (data !== null) { resolve({ data, title: 'CPU Full Load' }); } else { resolve('not_supported') } }) }
else if (f === 'm') { si.mem().then(data => { if (data !== null) { resolve({ data, title: 'Memory' }); } else { resolve('not_supported') } }) }
else if (f === 'M') { si.memLayout().then(data => { if (data !== null) { resolve({ data, title: 'Memory Layout' }); } else { resolve('not_supported') } }) }

View File

@ -16,18 +16,18 @@ function printHeader() {
function printMenu() {
console.log('');
console.log('┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐');
console.log('│ a ... Audio h ... Bluetooth S ... Shell 1 ... NET Iface Default ? ... Get Object │');
console.log('│ b ... BIOS i ... INET Latency t ... time 2 ... NET Gateway Default , ... All Static │');
console.log('│ B ... Baseboard I ... INET Check Site T ... CPU Temperature 3 ... NET Interfaces . ... All Dynamic │');
console.log('│ C ... Chassis l ... CPU Load u ... USB 4 ... NET Stats / ... All │');
console.log('│ c ... CPU L ... Full Load U ... UUID 5 ... NET Connections │');
console.log('│ d ... DiskLayout m ... Memory v ... Versions │');
console.log('│ D ... DiskIO M ... MEM Layout V ... Virtual Box 6 ... Docker Info │');
console.log('│ e ... Block Devices o ... OS Info w ... WIFI networks 7 ... Docker Container │');
console.log('│ E ... Open Files p ... Processes y ... System 8 ... Docker Cont Stats │');
console.log('│ f ... FS Size P ... Process Load Y ... Battery 9 ... Docker Cont Proc │');
console.log('│ F ... FS Stats r ... Printer z ... Users 0 ... Docker All │');
console.log('│ g ... Graphics s ... Services q >>> QUIT │');
console.log('│ a ... Audio h ... Bluetooth s ... Services 1 ... NET Iface Default ? ... Get Object │');
console.log('│ b ... BIOS i ... INET Latency S ... Shell 2 ... NET Gateway Default , ... All Static │');
console.log('│ B ... Baseboard I ... INET Check Site t ... time 3 ... NET Interfaces . ... All Dynamic │');
console.log('│ C ... Chassis j ... CPU Current Speed T ... CPU Temperature 4 ... NET Stats / ... All │');
console.log('│ c ... CPU l ... CPU Current Load u ... USB 5 ... NET Connections │');
console.log('│ d ... DiskLayout L ... Full Load U ... UUID │');
console.log('│ D ... DiskIO m ... Memory v ... Versions 6 ... Docker Info │');
console.log('│ e ... Block Devices M ... MEM Layout V ... Virtual Box 7 ... Docker Container │');
console.log('│ E ... Open Files o ... OS Info w ... WIFI networks 8 ... Docker Cont Stats │');
console.log('│ f ... FS Size p ... Processes y ... System 9 ... Docker Cont Proc │');
console.log('│ F ... FS Stats P ... Process Load Y ... Battery 0 ... Docker All │');
console.log('│ g ... Graphics r ... Printer z ... Users q >>> QUIT │');
console.log('└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘');
}