Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

agentx

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agentx - npm Package Compare versions

Comparing version 1.8.1 to 1.8.2

49

lib/orders/system.js

@@ -9,2 +9,45 @@ 'use strict';

/*
* user nice system idle iowait irq softirq steal guest guest_nice
* cpu 74608 2520 24433 1117073 6176 4054 0 0 0 0
*
* Idle = idle + iowait + steal
* NonIdle = user + nice + system + irq + softirq + steal
* Total = Idle + NonIdle;
* cpu% = 1 - diffIdle / diffTotal
* this is a description for "steal", it is useful in a VM env.
* http://blog.scoutapp.com/articles/2013/07/25/understanding-cpu-steal-time-when-should-you-be-worried
*/
var calculateLinuxCPU = function () {
var raw = fs.readFileSync('/proc/stat');
if (!raw) {
return 0;
}
var lines = raw.toString().trim().split('\n');
for (var i = 0; i < lines.length; i++) {
if (lines[i].indexOf('cpu ') >= 0) {
var stat = lines[i].split(' ');
// [ 'cpu', '', '327248', '602', '82615', '1556436',
// '22886', '0', '134', '0', '0', '0' ]
stat.shift();
stat.shift();
var idle = parseInt(stat[3], 10) +
parseInt(stat[4], 10) + parseInt(stat[7], 10);
var total = 0;
for (var j = 0; j < 8; j++) {
total += parseInt(stat[j], 10);
}
var diffTotal = total - lastTotal;
var diffIdle = idle - lastIdle;
lastTotal = total;
lastIdle = idle;
return 1 - diffIdle / diffTotal;
}
}
return 0;
};
var calculateCPU = function () {

@@ -36,7 +79,7 @@ var cpus = os.cpus();

if (['MemFree', 'Buffers', 'Cached'].indexOf(pair[0]) >= 0) {
real_free += parseInt(pair[1]);
real_free += parseInt(pair[1], 10);
}
});
return real_free * 1024;
}
};

@@ -52,3 +95,3 @@ var status = function () {

load15: loadavg[2],
cpu: calculateCPU(),
cpu: os.type() === 'Linux' ? calculateLinuxCPU() : calculateCPU(),
cpu_count: os.cpus().length

@@ -55,0 +98,0 @@ };

2

package.json
{
"name": "agentx",
"version": "1.8.1",
"version": "1.8.2",
"description": "agentx is powered by alinode",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc