Coder Social home page Coder Social logo

systeminformation's Introduction

Hi My name is Sebastian

Hello

Hi, my name is Sebastian — founder of +innovations GmbH and besides consulting activities I mainly work on innovative projects for non-profit organizations.


  • 🌍  I'm based in Vienna - Austria 🇦🇹
  • 🖥️  I'm currently working on systeminformation
  • 🚀 And starting up a new fundraising platform campgn

As a full-stack developer I enjoy working on interesting and innovative projects. Since I use many open source tools I am happy to contribute to the community. If you want to support me, please feel free to Buy me a coffee.

Skills

JavaScript PHP TypeScript rlang HTML5 Angular CSS3 Sass Bootstrap Material UI NodeJS MySQL PostgreSQL MongoDB

Socials

Github Stats

sebhildebrandt's GitHub stats

Support Me

JetBrain

@JetBrain: Thank you for you support (providing software) JetBrain Request ID=01022024/13609235 ...

systeminformation's People

Contributors

effectrenan avatar jorgegonzalez avatar juancamp avatar juancampuzano avatar juanescarraga avatar mariacamilacubides avatar mily20001 avatar omgimalexis avatar plakak avatar sebhildebrandt avatar seniorquico avatar si458 avatar zprjk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

systeminformation's Issues

cpu.js Speed & Brand detection doesn't work with AMD processors

[path]\node_modules\systeminformation\lib\cpu.js:165
            result.speed = name.split('@')[1].trim();
                                             ^

TypeError: Cannot read property 'trim' of undefined
    at [path]\node_modules\systeminformation\lib\cpu.js:165:46
    at ChildProcess.exithandler (child_process.js:197:7)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at maybeClose (internal/child_process.js:899:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

This happens because the name string describing AMD processors doesn't contain the necessary data.
Sample name: 'AMD FX(tm)-8320 Eight-Core Processor'

Error installing - Failed at node-gyp rebuild

I get this while installing.

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Owner\Documents\GitHub\eth\node_modules\systeminformation
gyp ERR! node -v v6.9.4
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "systeminformation" "--save"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the systeminformation package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs systeminformation
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls systeminformation
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Owner\Documents\GitHub\eth\npm-debug.log`

Using Raspbian on a Raspberry pi zero W doesn't retrieve any graphics info

Hi,

I'm currently using your package for retrieval of the graphics information of the system. On my windows device I get the information I need ( resolution of all connected displays). On my raspberry pi zero W on the other hand I get the following:

{
"controllers": [],
"displays": [
{
"connection": "default",
"main": false,
"builtin": false
}
]
}

Behavior of si.fsSize() ?

Hi Sebastian,

It seems to me that fsSize reports accurately only the first disk if finds, e.g., /dev/sda. In the output below I see partitions /dev/sda1 and /dev/sda3, but not /dev/sda2. I also don't see /dev/sda (the disk itself as opposed to its partitions.) Nor is the /dev/mapper data correct. Finally, devices /dev/sdb and /dev/sdc do not appear at all.

Am I missing something in my use of fsSize? If not, is this something that you can, without too much difficulty, enhance to include all disks and partitions?

As always, thank you.

-Paul

> si.fsSize(function(d) {console.log(d)} )
Promise { <pending> }
> [ { fs: '/dev/sda3',
    size: 14793351168,
    used: 4366913536,
    use: 29.52,
    mount: '/' },
  { fs: '/dev/sda1',
    size: 251575296,
    used: 108223488,
    use: 43.02,
    mount: '/boot' },
  { fs: '/dev/mapper/data_vg-data',
    size: NaN,
    used: NaN,
    use: NaN,
    mount: '/dev/mapper/data_vg-data' },
  { fs: '/dev/mapper/data2_vg-data2',
    size: NaN,
    used: NaN,
    use: NaN,
    mount: '/dev/mapper/data2_vg-data2' } ]

On this particular host (a CentOS6 VMware VM), the disks are as follows (this via fdisk):

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a3b96

Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xdded8033


Disk /dev/sdc: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x921b17e3

And here, a bit redundantly, is the output from 'fdisk -l' which also shows the partitions:

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a3b96

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          33      262144   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              33        2073    16384000   82  Linux swap / Solaris
/dev/sda3            2073        3917    14810112   83  Linux

Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdc: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/data2_vg-data2: 268.4 GB, 268431261696 bytes
255 heads, 63 sectors/track, 32634 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/data_vg-data: 107.4 GB, 107369988096 bytes
255 heads, 63 sectors/track, 13053 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

"mem is not a function" using si.getAllData()

Hello, I get this error when using si.getAllData():

node_modules/systeminformation/lib/index.js:267
      mem().then(res => {
      ^

TypeError: mem is not a function
    at process.nextTick (node_modules/systeminformation/lib/index.js:267:7)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

I'm on Arch Linux (4.7.2-1-ARCH #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016 x86_64 GNU/Linux), Node v8.1.2, "systeminformation": "^3.23.3" in package.json.

npm install failure

Hi Sebastian,

Perhaps I did something wrong, but npm install systeminformation --save appears not to work:

I am attaching file npm-debug.log.

npm-debug.txt

Also, here is the console output (though run without --save option):

[root@pb_stap251 ecxmon]# npm install systeminformation

> [email protected] install /home/ecxcc/ecxmon/node_modules/systeminformation
> node-gyp rebuild

make: Entering directory `/home/ecxcc/ecxmon/node_modules/systeminformation/build'
  SOLINK_MODULE(target) Release/obj.target/none.node
make: g++: Command not found
make: *** [Release/obj.target/none.node] Error 127
make: Leaving directory `/home/ecxcc/ecxmon/node_modules/systeminformation/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 2.6.32-642.11.1.el6.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ecxcc/ecxmon/node_modules/systeminformation
gyp ERR! node -v v7.2.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 2.6.32-642.11.1.el6.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "systeminformation"
npm ERR! node v7.2.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the systeminformation package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs systeminformation
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls systeminformation
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ecxcc/ecxmon/npm-debug.log

I am still able to run because I again downloaded 3.11.0 instead of 3.17.0.

Please let me know what's going on here; thanks!

Cordially,

Paul

Race condition?

Hi Sebastian,

This issue appears to be similar to #14 which you fixed for us last November.

But in this case it is si.processes() - and not si.currentLoad() - that may prove problematic. I say "may" because I am always willing to allow that this problem is of my making.

My web browser client is presenting 2 d3.js plots simultaneously. In the Node.js backend this is realized as two "overlapped" (roughly concurrent) calls to si.processes(). I will paste in the code below.

If I display the process CPU utilization plot by itself, data values returned by si.processes() seem fine. But if I display both process CPU utilization & the process memory utilization plots at the same time, then the data returned by si.processes() assumes quite a few incorrect values. E.g., "Infinity", "NaN", and negative CPU utilizations.

In the code below, the 2 "collector" functions, one for CPU utilization, the other for memory, run "concurrently" (well, not really, but in the Node.js idiom). Each calls si.processes() and then calls function getProcessesOfInterest .

Thanks for your help.

Cordially,

Paul

function collectorProcessCpuUtil(monSessState, publisher)
{
    var cmdProgress = {
       entity: 'process',
       cpu_util: -1,                                                                               
       sid: monSessState.monSid,
       timestamp: (new Date).getTime(),
    };

    var mo = getMetricEntryFromSubDoc(monSessState.subDoc, cmdProgress.entity + '.cpu_util');     
    mo.push = true;   
   
    si.processes().then(data => getProcessesOfInterest('cpu_util', data, cmdProgress, publisher, false))                            
	          .catch(error => logMsg('info', 'process cpu_util si.processes error=' + error));
}


function collectorProcessMemUtil(monSessState, publisher)
{
    var cmdProgress = {
       entity: 'process',
       mem_util: -1,                                                                               
       sid: monSessState.monSid,
       timestamp: (new Date).getTime(),
    };
    
    var mo = getMetricEntryFromSubDoc(monSessState.subDoc, cmdProgress.entity + '.mem_util');     
    mo.push = true;   

    si.processes().then(data => getProcessesOfInterest('mem_util', data, cmdProgress, publisher, false))                            
	          .catch(error => logMsg('info', 'process mem_util si.processes error=' + error));
}


function getProcessesOfInterest(cmdId, data, cmdProgress, publisher, useProcessCache) 
{
	var nodeIp = app.get('localIp');
	var monSessState = app.get(cmdProgress.sid);
	
	var pCache = arrayToHash(data.list, 'pid'); 
	var numCores = monSessState.cpuInfo.cores;   // always 4
	
	var mo = getMetricEntryFromSubDoc(monSessState.subDoc, 'process.' + cmdId);
	var valAr = [];

	mo.pids.forEach(function(wantedPid){
		if ( pCache[wantedPid] )                                                                               // FTI we found pid that caller's interested in                                
		{
			var proc = pCache[wantedPid];                                                                  // get process object given us by si.processes
			
			if ( cmdId == 'cpu_util' )
			{				
			    var temp = parseFloat(numCores*proc.pcpu/100);
			    valAr.push({pid: wantedPid, util: parseFloat(numCores*proc.pcpu/100).toFixed(2)});         // ut returned by si is divided by # cores; undo that to present simpler metric
			}
			
			if ( cmdId == 'mem_util' )
			{
			    var temp = parseFloat(proc.pmem/100);
			    valAr.push({pid: wantedPid, util: parseFloat(proc.pmem/100).toFixed(2)});  				
			}
		}
	});

	cmdProgress[cmdId] = [{time: cmdProgress.timestamp, data: valAr}];
	publisher(cmdProgress);
}

Missing Validation in osInfo (Windows)

I was trying your lib (btw, nice job) and in the osInfo function you missed a validation for Windows logo that throws:

C:\Users\Fxckdead\Desktop\testing\node_modules\systeminformation\lib\osinfo.js:43
  distro = distro.toLowerCase();
                 ^

TypeError: Cannot read property 'toLowerCase' of undefined
    at getLogoFile (C:\Users\Fxckdead\Desktop\testing\node_modules\systeminformation\lib\osinfo.js:43:18)

In that line i can see:

// Get logo filename of OS distribution

function getLogoFile(distro) {
  distro = distro.toLowerCase(); // <-- THIS LINE 

For the windows version you don't send the distro param, so toLowerCase is not an string:

197    if (_windows) {
198        result.logofile = getLogoFile();

I can't send a pull request right now, but its an easy fix.

Change in content of si.processes?

Hi Sebastian,

It looks to me that the list array within the data returned by si.processes() no longer contains a proper command property. In fact, it looks to me as if the command property might contain the userid under which the process is running.

I'm fairly certain that I used to use the command property to help me identify processes of interest, e.g., various startup flags, etc.

I am using 3.17.0 version of si.

Can you confirm my findings?

Thanks.

-Paul

use of new si.blockDevices(cb)

Hello again, Sebastian,

I can't get this to work. I tested in the Node.js REPL (see below).

This is a CentOS 6 VM.

Am I doing something wrong?

In the meantime, I will try it on an Ubuntu 16 VM.

Thanks.

-Paul

[root@localhost ecxmon]# nano package.json
[root@localhost ecxmon]# npm install --save
[email protected] /home/ecxcc/ecxmon
└── [email protected]

[root@localhost ecxmon]# node
> var si = require('systeminformation')
undefined
> si.blockDevices(function(d) { console.log(d) } )
Promise { <pending> }
> []

> si.blockDevices(function(d) { console.log(d) } )
Promise { <pending> }
> []

> si.version()
'3.11.0'
>

JSON.parse error for octal character

It seems that si.blockDevices() doesn't handle octal string.
My node program was exited abnormally when this error occurs.

Is there any way to avoid this error when using si.blockDevices()?

{"name":"sda1" ,"type":"part" ,"size":"471859200" ,"fstype":"ntfs" ,"mountpoint":"" ,"uuid":"E29E89789E8945CF" ,"rota":"0" ,"ro":"0" ,"rm":"0" ,"tran":"" ,"serial":"" ,"label":"\xeb\xb3\xb5\xea\xb5\xac" ,"model":"" ,"owner":"root"}
                                                                                                                                                                                  ^

SyntaxError: Unexpected token x in JSON at position 178
    at JSON.parse (<anonymous>)
    at lines.filter.forEach (/snapshot/home/nemoux/nemosolution/nemocloud/admin-backend/node_modules/systeminformation/lib/filesystem.js:153:21)
    at Array.forEach (native)
    at parseBlk (/snapshot/home/nemoux/nemosolution/nemocloud/admin-backend/node_modules/systeminformation/lib/filesystem.js:152:37)
    at /snapshot/home/nemoux/nemosolution/nemocloud/admin-backend/node_modules/systeminformation/lib/filesystem.js:205:20
    at ChildProcess.exithandler (child_process.js:202:7)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:192:7)
    at maybeClose (internal/child_process.js:890:16)

Thank you in advance.

How to use import systeminformation on react.js project

Hi,
I can't import this syteminformation.js on my react.js project. I worked this on Mac OS 10.11.6.
After run 'npm install systeminformation --save" command, I added a line in my line:
import si from 'systeminformation';

Then I got issue:
ERROR in ./ ~ /systeminformation/lib/cpu.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../build/Release/smc in /Users/pascal/Sites/key/keytabs/node_modules/systeminformation/lib
@ ./ ~ /systeminformation/lib/cpu.js 251:18-49

Please help me how to fix this issue.

Data is not accurate

Hi,
I found out that some data is not accurate, for example the loadavg and the cpu used by process (pcpu) have different values if you compare with top or htop command

CPU Usage in %

Hello,
I liked your project.
But I'm kind of dumb and I do not know how to make my code look just like you.
Could you please review and include my code in your next version?
Thank you

exec("cat /proc/stat | grep cpu", function(error, stdout) {
                let lines = stdout.toString().trim().split('\n');
                lines.splice(0, 1);
                lines.forEach(function(line, index) {
                    let sline = line.split('\ ')
                    let pline = {
                        core: sline[0],
                        user: parseInt(sline[1]),
                        nice: parseInt(sline[2]),
                        system: parseInt(sline[3]),
                        idle: parseInt(sline[4]),
                        iowait: parseInt(sline[5])
                    };
                    let totalTime = pline.user + pline.nice + pline.system + pline.idle + pline.iowait;
                    pline.user = Number((pline.user * 100) / totalTime).toFixed(3);
                    pline.nice = Number((pline.nice * 100) / totalTime).toFixed(3);
                    pline.system = Number((pline.system * 100) / totalTime).toFixed(3);
                    pline.idle = Number((pline.idle * 100) / totalTime).toFixed(3);
                    pline.iowait = Number((pline.iowait * 100) / totalTime).toFixed(3);
                    lines[index] = pline;
                });
                resolve(lines);
            };

Permissions

It'd be really nice to have some flag indicating level of privilleges, especially for getAllData or maybe even autodetect because currently lib is crashing with EACCES on my os if not run as root.

Error: EACCES: permission denied, open '/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq'

typescript definitions

The best option is to maintain this with the library instead of having a @types package IMO.
We can provide a d.ts or convert the project to typescript, I prefer the last option but I can contribute to the first one too.

Don't Returns Mac's

node 8.4
Ubuntu 17.10

  { iface: 'wlx803f5d20b751',
    ip4: '192.168.0.17',
    ip6: '',
    mac: '00:00:00:00:00:00',
    internal: false },
  { iface: 'docker0',
    ip4: '172.17.0.1',
    ip6: '',
    mac: '00:00:00:00:00:00',
    internal: false },
  { iface: 'br-79bf4b77c82a',
    ip4: '172.19.0.1',
    ip6: '',
    mac: '00:00:00:00:00:00',
    internal: false } ]

Not reliable `getFirstExternalNetworkInterface` function

Hi, I'm reading the code of your library and I think you are using the getFirstExternalNetworkInterface function to get the current active interface in the system to start monitoring the data transfer speed.

If I'm correct about this, there's a problem with that function and is not reliable.

Note: I'm using OS X

If I have my WiFi connection active and I'm also connected to wired using the thunderbolt port the os.networkInterfaces() execution will return this:

{
  lo0: [
    { 
      address: '::1',
      netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
      family: 'IPv6',
      mac: '00:00:00:00:00:00',
      scopeid: 0,
      internal: true
    },
    {
      address: '127.0.0.1',
      netmask: '255.0.0.0',
      family: 'IPv4',
      mac: '00:00:00:00:00:00',
      internal: true
    },
    {
      address: 'fe80::1',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: '00:00:00:00:00:00',
      scopeid: 1,
      internal: true
    }
  ],
  en0: [
    {
      address: 'fe80::bae8:56ff:fe44:f972',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: 'b8:e8:56:44:f9:72',
      scopeid: 4,
      internal: false
    },
    {
      address: '10.229.128.75',
      netmask: '255.255.0.0',
      family: 'IPv4',
      mac: 'b8:e8:56:44:f9:72',
      internal: false
    }
  ],
  awdl0: [
    {
      address: 'fe80::c4ff:94ff:feae:e2e2',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: 'c6:ff:94:ae:e2:e2',
      scopeid: 8,
      internal: false
    }
  ],
  utun1: [
    {
      address: 'fe80::d006:2732:5299:2715',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: '00:00:00:00:00:00',
      scopeid: 11,
      internal: false
    }
  ],
  en5: [
    {
      address: 'fe80::ca2a:14ff:fe4c:1543',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: 'c8:2a:14:4c:15:43',
      scopeid: 12,
      internal: false
    },
    {
      address: '10.225.128.233',
      netmask: '255.255.0.0',
      family: 'IPv4',
      mac: 'c8:2a:14:4c:15:43',
      internal: false
    }
  ]
}

With this data, the getFirstExternalNetworkInterface will return en0 as the active interface which is correct, but if I turn off my WiFi device and and execute the os.networkInterfaces() method again the output will be this:

{
  lo0: [
    { 
      address: '::1',
      netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
      family: 'IPv6',
      mac: '00:00:00:00:00:00',
      scopeid: 0,
      internal: true
    },
    {
      address: '127.0.0.1',
      netmask: '255.0.0.0',
      family: 'IPv4',
      mac: '00:00:00:00:00:00',
      internal: true
    },
    {
      address: 'fe80::1',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: '00:00:00:00:00:00',
      scopeid: 1,
      internal: true
    }
  ],
  utun1: [
    {
      address: 'fe80::d006:2732:5299:2715',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: '00:00:00:00:00:00',
      scopeid: 11,
      internal: false
    }
  ],
  en5: [
    {
      address: 'fe80::ca2a:14ff:fe4c:1543',
      netmask: 'ffff:ffff:ffff:ffff::',
      family: 'IPv6',
      mac: 'c8:2a:14:4c:15:43',
      scopeid: 12,
      internal: false
    },
    {
      address: '10.225.128.233',
      netmask: '255.255.0.0',
      family: 'IPv4',
      mac: 'c8:2a:14:4c:15:43',
      internal: false
    }
  ]
}

And the getFirstExternalNetworkInterface will return utun1 as the active interface which is incorrect, since the current active interface is en5.

I see two problems here...

  • You are relaying in the internal === false value to determine which is the active interface
  • You are trying to get the first value of an object which is a non-ordered structure

cpuTemperature not returning anything on OSX or Windows

Hi Sebastian,

First off thanks for putting this package together, I have enjoyed working with it the last couple of days.

Unfortunately, I have noticed that cpuTemperature is not returning anything. I have tested on OSX and Windows 10 and have confirmed with other system apps that both devices have a temp monitor running and reporting.

Cheers,

systeminformation not installing on Windows

Here is the debug log:
npm_debug_log.txt

I ran the command "npm install systeminformation --save" but ended up getting these errors:

$ npm install systeminformation --save
npm WARN package.json [email protected] license should be a valid SPDX license expression

[email protected] install D:\GamingHub\Gamempire\node_modules\systeminformation
node-gyp rebuild

D:\GamingHub\Gamempire\node_modules\systeminformation>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. [D:\GamingHub\Gamempire\node_modules\systeminformation\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\GamingHub\Gamempire\node_modules\systeminformation
gyp ERR! node -v v4.6.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "systeminformation" "--save"
npm ERR! node v4.6.1
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the systeminformation package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs systeminformation
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls systeminformation
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:\GamingHub\Gamempire\npm-debug.log

At first, there was also a python error, trying to run 3.3.0 which isn't supported in this module so I renamed my python 3.3.0 exe file to python3 so it recognized my 2.7.8 version. But now, I'm not sure what to do. I also tried to download it through github and put the module in my node_module folder but that didn't work, got this error:

Error: Cannot find module '../build/Release/smc' from 'D:\GamingHub\Gamempire\node_modules\systeminformation\lib'

si.cpuTemperatue is not a function

Does this mean that it's not supported by the cpu/os?

The error:

(node:9740) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: si.cpuTemperatue is not a function

My code:

    private getTemperature(): Promise<number> {
        return new Promise<number>((resolve, reject) => {
            si.cpuTemperatue(resolve);
        });
    }

OS: Microsoft Windows 10 Pro

CentOS 7 problems

Hi,

First, thank you very much for this fine piece of work! It's been a great help to me.

I was today experimenting with the several docker APIs offered by your module and it seems that two of them don't work in CentOS 7. I presume that this is perhaps more a systemd issue than anything else.

In response to, for example, si.dockerContainers('all', function(d) { console.log(d); }) I see:

Promise { <pending> }
> []

I get the same empty promise array in response to .dockerAll(cb). But .dockerContainerStats(ctrID, cb) seems to work fine.

All API calls work properly on CentOS 6 (and on Ubuntu 16.04).

Do these phenomena comport with your experience? If this is a valid new issue, is it something that can be fixed without too much work?

Thank you again.

Cordially,

Paul

Not all ifaces detected, users problem

So i just tried new version of systeminformation.

It doesn't crash without root - that's great. But few things don't look entirely correct:

networkStats:

sys.networkInterfaces(function(s){console.log(s)})
Promise { <pending> }
> [ { iface: 'lo', ip4: '127.0.0.1', ip6: '::1', internal: true },
{ iface: 'br0',
ip4: '192.168.1.3',
ip6: 'fe80::f66d:4ff:fe97:cc1c',
internal: false },
{ iface: 'vmnet1',
ip4: '172.16.56.1',
ip6: 'fe80::250:56ff:fec0:1',
internal: false },
{ iface: 'vmnet8',
ip4: '192.168.99.1',
ip6: 'fe80::250:56ff:fec0:8',
internal: false } ]

whereas:

lapsio@linux-qzuq ~> ip link list
1: lo: ...
2: eno1: ... <- missing
3: br0: ...
4: vmnet1:...
5: vmnet8: ...

I just checked and os.networkInterfaces is also missing eno1

And .users() returns empty array now on my machine.

Here's result of command you use, I hope it helps:
http://pastebin.com/YW41Dpma

I found it quite confusing that .services without srv argument return nothing instead of all and those "-1"s in many places also look confusing. I followed code and considering _disk_io.ms doesn't seem to be set anywhere they're like hardcoded?

Latest version is too cool

Your package.json says you support node >= 4 but you're using ES6 features not supported by node 4.x

/opt/agent/server/node_modules/systeminformation/lib/internet.js:59
              const { statusCode } = res;

Problem at linux with other locales than english

Hi,

Your work is great, only have one problem at some of my clients, they have a german locale at console. So there is only one problem at filesystem.js line #594 where you execute lshw to get disks. You are looking for the key "logical name" but i get at the clients "Logischer Name" cause of german locale. So i can't force them all to set console locale to english as default. Sure i can tell all they must have installed english as secondary locale.

The only real problem is that i get an error 'cat /sys/block/' + logical + '/queue/rotational' cause logical is empty at my case and so the dir it tries to cat does not exist.

At least i need a fix for checking if the dir exists before cat'ing it (think those two lines are not to hard to you so i don't have to send a pull request ;) )

But much better would be a solution to get the devices at systems with other default locale than english too. I'm 100% sure at the moment how to solve this, but maybe you have an idea :)

not sure if it's possible to maybe forcing the console output to english (like i said, i can install a second locale), but maybe you/we find a solution where it's not important which locale is installed (maybe catching it not by key, catching it by something like substring with /dev/?... just one more idea ;) )

greetings
Chris

Units for the different properties

I'd like to know what unit si.mem.total uses, and maybe add it to the readme.

I thought it was bytes, but when I used si.mem, I got

8494383104
Which in GB is 8.49~
While Windows tells me that I have 8.00

Thanks in advance.

UnhandledPromiseRejectionWarning

Hi! Great package, really appreciate your work!

It works without problems on my PC and even Raspberry PI 2 :) , but I have problem while running this simple test program on my laptop:

var si = require('systeminformation');

si.getStaticData(function (data) {
    console.log(data);
});

In the console instead of static informations about by laptop I get this:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: not supported
Any idea what may cause this error? My laptop is Samsung QX310, running on Windows 10 Pro (same version as on my PC), maybe it's something about my laptops hardware? :|

windows: add si.processes

This command will show you a list of running processes. Required powershell@v3.

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "get-wmiobject win32_process | select ProcessId, Name, @{Name='StartTime'; Expression = { $_.ConvertToDateTime($_.CreationDate) }} | convertto-json -compress"

Fields:

Field process property description
ProcessId [0].pid process pid
Priority [0].priority process priotity
PageFileUsage [0].mem_vsz process virtual memory size in kb
WorkingSetSize [0].mem_rss process mem resident set size in bytes
@{Name='StartTime'; Expression = { $_.ConvertToDateTime($_.CreationDate) }} [0].started process start time
@{Name='Owner'; Expression = { $_.GetOwner().User }} [0].user user who started process (note: this operation is very slow)
CommandLine [0].command process starting command
UserModeTime - cpu user time in 100-nanosecond units
KernelModeTime - cpu system time is 100-nanosecond units

How to convert 100-nanosecond units to ms

CPU usage in % ([0].pcpu) can be calculated like this:

cpu = (UserModeTime + KernelModeTime) / (now - StartTime) * 100

You can see this fields in action in my package process-list

Enhancement request

Hi Sebastian,

When you are able to address issue #21 might you be able to make a modest (I think) enhancement to the list of process properties returned by si.processes(cb)?

Specifically, could that list include for each returned process object not only pcpu, but its decomposition into system (kernel) CPU utilization and user CPU utilization?

Not that you need it, but vide: http://unix.stackexchange.com/questions/132035/obtain-user-and-kernel-time-of-a-running-process

Thanks.

-Paul

si.currentLoad race conditions?

Hi Sebastian,

Before I start posting massive debug log output, are you aware of any potential race issues with this (or any other) si call?

The basic conditions & sequence are as follows:

  1. backend https server (Node.js, express.js) periodically (every 5 seconds) drive si.currentLoad using promise idiom (see below).
  2. client 1 web browser connects
  3. data pushed back to client 1 looks correct
  4. client 2 web browser connects
  5. data pushed back to client 2 looks incorrect
si.currentLoad().then(data => parseCpuLoadInfo('cpu_util', data, cmdProgress, responder))      
                         .catch(error => logMsg('info', 'si.currentLoad error=' + error));

When item 4 above says "incorrect", I mean that the several metrics returned by this call (currentload, currentload_system, currentload_user, currentload_nice) are either null or incoherent, e.g., the client 1 data shows currentload of 1.004 but 5 seconds later currentload for client 2 shows 100. Note that there is nothing else running on the node. It might of some interest to note that the avgload property never shows a null or incoherent value, even if the other properties in the object do.

I realize that this could very well be my problem but, for the moment I don't see what I'm doing that might be causing this.

So I'd be grateful for any light you can shed on this.

Thanks.

-Paul

question about list returned by si.processes()

Hi Sebastian,

Happy New Year & hope you are well.

The process object returned under si.processes().list contains a 'pcpu' (percent CPU utilization) field. How should I interpret this number on a multi-core machine?

I here have in mind the difference between the top command's Irix (the default, I think) and Solaris modes. In the former, %CPU is not divided by the number of cores; in the latter it is.

As always, thanks for your help.

Cordially,

Paul

si.diskLayout on CentOS 7 (systemd-based)

Hi Sebastian,

Using 3.17.2 on CentOS 7 si.diskLayout(cb) returns an empty (pending) promise which is never fulfilled, e.g.,

[root@localhost ecxmon]# node
> var si = require('systeminformation')
undefined
> si.diskLayout(function(d) {console.log(d)})
Promise { <pending> }
> []

FWIW si.memLayout() works. I haven't tried on a non-systemd platform.

Thanks.

-Paul

Temperature Returns Innacurate Data

Using cputemperature to measure the temperature of my CPU, I get these values:

{ main: -172.86666666666667, cores: [ -273.2, -273.2, 27.8 ], max: -1 }

My CPU only has two cores but it is indicated that there are three.

Also, I haven't checked using any other software, but I'm fairly sure my CPU isn't at Absolute Zero.

Is this an issue with the sensors on my CPU?

SocketIO

Hi,
First of all congratulations for this amazing project.
I have two questions:
1ºDo you have any example using socket io for real-time monitor?
2ºUsing si.processes(cb) how can I get only the running proccess?

Best regards

networkStats rx_sec, tx_sec always at -1 & fsStats rx_sec, wx_sec always at 0

Hey, thanks for your great module!

I tried on two different Ubuntu 16.04 machines, with both node 4.4.5 and 6.2.1.
The realtime metrics for networkStats and fsStats don't seem to work.

Exemple output:

…
networkStats: 
 { iface: 'eth0',
   operstate: 'unknown',
   rx: 0,
   tx: 0,
   rx_sec: -1,
   tx_sec: -1 },
…
fsStats: { rx: 455069696, wx: 4253657088, rx_sec: 0, wx_sec: 0 },
…

Laptop apparently doesn't use a battery.

When I execute the following code my laptop that runs on a battery, it returns "false".

var si = require('systeminformation');
si.battery(function (battery) {
console.log(battery.hasbattery);
});

I am using a Dell Laptop running Windows 10 using the latest version of System Information. Any ideas?

hard disk serial number

can you add support to hard disk serial number?

in windows the command is -
"wmic diskdrive get serialnumber"

it's different from -
"wmic logicaldisk get VolumeSerialNumber"

si.users() is broken

si.users() seems to be broken with node v4.0.0. See error below:

systeminformation/lib/index.js:683
    result.users = [];
    ^

ReferenceError: result is not defined

SWAP is NaN

Because free in version 3.3.10 doesn't display -/+ buffers/cache any more, there's only two columns and line 3 (for swap) just doesn't exist.

A simple fix could be to count number of lines and act consequently…

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.