Comparing version 1.8.4 to 1.8.5
@@ -23,6 +23,6 @@ 'use strict'; | ||
!cfg.reportInterval) { | ||
console.log('配置文件:'); | ||
console.log('\n配置文件:'); | ||
console.log(JSON.stringify(cfg, null, 2)); | ||
console.log('请检查配置文件, 确保以下参数配置:'); | ||
console.log(' server, appid, secret, cmddir, logdir, heartbeatInterval, reconnectDelay, reportInterval'); | ||
console.log('请检查配置文件, 确保以下参数配置正确:'); | ||
console.log(' server, appid, secret, cmddir, logdir, heartbeatInterval, reconnectDelay, reportInterval\n'); | ||
process.send({type: 'suicide'}); | ||
@@ -29,0 +29,0 @@ process.exit(1); |
@@ -21,3 +21,3 @@ 'use strict'; | ||
this.server = config.server; | ||
} else if (config.server.indexOf('agentserver.node.aliyun.com') === 0) { | ||
} else if (config.server.indexOf('agentserver.node.aliyun.com') === 0) { | ||
this.server = 'wss://' + config.server + '/'; | ||
@@ -24,0 +24,0 @@ } else { |
@@ -70,2 +70,13 @@ 'use strict'; | ||
var getLoadAvg = function () { | ||
const load = fs.readFileSync('/proc/loadavg', 'utf8').trim(); | ||
const reg = /(\d.\d+)\s+(\d.\d+)\s+(\d.\d+)/ | ||
const loads = load.match(reg); | ||
if (loads) { | ||
return [Number(loads[1]), Number(loads[2]), Number(loads[3])]; | ||
} else { | ||
return os.loadavg(); | ||
} | ||
}; | ||
var getTotalMemory = function () { | ||
@@ -99,11 +110,12 @@ var raw = fs.readFileSync('/proc/meminfo'); | ||
var status = function () { | ||
var loadavg = os.loadavg(); | ||
const is_linux = os.type() === 'Linux'; | ||
const loadavg = is_linux ? getLoadAvg() : os.loadavg(); | ||
return { | ||
uptime: os.uptime(), // in ms | ||
totalmem: os.type() === 'Linux' ? getTotalMemory() : os.totalmem(), // in byte | ||
freemem: os.type() === 'Linux' ? getMemoryUsage() : os.freemem(), // in byte | ||
totalmem: is_linux ? getTotalMemory() : os.totalmem(), // in byte | ||
freemem: is_linux ? getMemoryUsage() : os.freemem(), // in byte | ||
load1: loadavg[0], | ||
load5: loadavg[1], | ||
load15: loadavg[2], | ||
cpu: os.type() === 'Linux' ? calculateLinuxCPU() : calculateCPU(), | ||
cpu: is_linux ? calculateLinuxCPU() : calculateCPU(), | ||
cpu_count: os.cpus().length | ||
@@ -110,0 +122,0 @@ }; |
{ | ||
"name": "agentx", | ||
"version": "1.8.4", | ||
"version": "1.8.5", | ||
"description": "agentx is powered by alinode", | ||
@@ -16,7 +16,7 @@ "scripts": { | ||
"dependencies": { | ||
"ws": "^1.1.4", | ||
"ws": "^1.1.5", | ||
"nounou": "^1.2.1", | ||
"debug": "*", | ||
"through2": "^2.0.0", | ||
"split2": "^2.0.0" | ||
"debug": "^3.1.0", | ||
"through2": "^2.0.3", | ||
"split2": "^2.2.0" | ||
}, | ||
@@ -28,4 +28,4 @@ "devDependencies": { | ||
"mm": "^2.2.0", | ||
"mocha": "*", | ||
"rewire": "~2.5.1" | ||
"mocha": "^3", | ||
"rewire": "^2.5.2" | ||
}, | ||
@@ -32,0 +32,0 @@ "files": [ |
@@ -5,2 +5,3 @@ #!/usr/bin/env node | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
@@ -15,4 +16,5 @@ var nounou = require('nounou'); | ||
console.log('参数错误。用法示例:'); | ||
console.log(' agentx <config.json>'); | ||
console.log(' agentx -v'); | ||
console.log(' agentx <config.json> start agentx with config.json'); | ||
console.log(' agentx -v --version display agentx version'); | ||
console.log(' agentx -h --help display this help and exit\n'); | ||
}; | ||
@@ -25,3 +27,3 @@ | ||
if (argv[0] === '-v') { | ||
if (argv[0] === '-v' || argv[0] === '--version') { | ||
console.log(require('./package.json').version); | ||
@@ -31,2 +33,13 @@ process.exit(0); | ||
if (argv[0] === '-h' || argv[0] === '--help') { | ||
printUsage(); | ||
process.exit(0); | ||
} | ||
if (!fs.existsSync(argv[0])) { | ||
console.log('\n', argv[0], 'is not a valid json file.\n'); | ||
printUsage(); | ||
process.exit(1); | ||
} | ||
nounou(clientPath, { | ||
@@ -33,0 +46,0 @@ args: [argv[0]], |
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
39017
1279
0
13
+ Addeddebug@3.2.7(transitive)
- Removeddebug@4.4.0(transitive)
Updateddebug@^3.1.0
Updatedsplit2@^2.2.0
Updatedthrough2@^2.0.3
Updatedws@^1.1.5