Comparing version 1.7.2 to 1.7.3
'use strict'; | ||
var os = require('os'); | ||
var fs = require('fs'); | ||
@@ -26,2 +27,16 @@ var lastTotal = 0; | ||
var getMemoryUsage = function () { | ||
var raw = fs.readFileSync('/proc/meminfo'); | ||
var usage = raw.toString().trim().split('\n'); | ||
var real_free = 0; | ||
usage.forEach(function(line) { | ||
var pair = line.split(':'); | ||
if (['MemFree', 'Buffers', 'Cached'].indexOf(pair[0]) >= 0) { | ||
real_free += parseInt(pair[1]); | ||
} | ||
}); | ||
return real_free * 1024; | ||
} | ||
var status = function () { | ||
@@ -32,3 +47,3 @@ var loadavg = os.loadavg(); | ||
totalmem: os.totalmem(), // in byte | ||
freemem: os.freemem(), // in byte | ||
freemem: os.type() === 'Linux' ? getMemoryUsage() : os.freemem(), // in byte | ||
load1: loadavg[0], | ||
@@ -35,0 +50,0 @@ load5: loadavg[1], |
{ | ||
"name": "agentx", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "agentx is powered by alinode", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35991
1193
12
2