whatap 0.4.46 → 0.4.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -41,15 +41,8 @@ SystemKubeTask.prototype.process = function (p) {
|
|
|
41
41
|
p.cpu_cores = 1; // static one core in nodejs
|
|
42
42
|
p.host_ip = SecurityMaster.IP;
|
|
43
43
|
var now = Date.now();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// 몽땅 만들어야 함.
|
|
47
|
-
p.cpu = KubeClient.cpu * ConfSysMon.correction_factor_cpu;
|
|
48
|
-
p.mem = KubeClient.memory * ConfSysMon.correction_factor_pcpu;
|
|
49
|
-
// p.metering = KubeClient.metering == 0 ? p.cpu_cores : KubeClient.metering;
|
|
50
|
-
p.metering = 1;
|
|
51
|
-
}
|
|
52
|
-
|
|
44
|
+
p.cpu = 0;
|
|
45
|
+
p.mem = 0;
|
|
53
46
|
if (p.metering != 0) {
|
|
54
47
|
this.last_metering = p.metering;
|
|
55
48
|
} else {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
var CounterTask = require('./counter-task'),
|
|
8
8
|
ResourceProfile = require('./../../util/resourceprofile'),
|
|
9
|
+
KubeUtil = require('./../../util/kube-util'),
|
|
9
10
|
SecurityMaster = require('../../net/security-master');
|
|
10
11
|
|
|
11
12
|
function SystemPerf(){
|
|
@@ -25,10 +26,18 @@ SystemPerf.prototype.process = function(p) {
|
|
|
25
26
|
p.cpu_proc = cpu.proc;
|
|
26
27
|
|
|
27
28
|
p.disk = ResourceProfile.getDisk().usage;
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
if(p.version <= 1) p.mem = ResourceProfile.getMemory().usage;
|
|
31
|
+
else p.mem = ResourceProfile.getMemoryV2().usage;
|
|
32
|
+
|
|
29
33
|
p.cpu_cores = cpu.core;
|
|
30
34
|
p.host_ip = SecurityMaster.IP;
|
|
31
35
|
p.pid=process.pid;
|
|
36
|
+
|
|
37
|
+
if (KubeUtil.container_id != null) {
|
|
38
|
+
p.mem = 0;
|
|
39
|
+
p.cpu = 0;
|
|
40
|
+
}
|
|
32
41
|
};
|
|
33
42
|
|
|
34
43
|
module.exports = SystemPerf;
|
package/lib/util/kube-util.js
CHANGED
|
@@ -18,13 +18,14 @@ var KubeUtil = {
|
|
|
18
18
|
var line = contents[i];
|
|
19
19
|
if(line){
|
|
20
20
|
this.container_id = line.substr(line.lastIndexOf('/')+1) || '';
|
|
21
|
-
this.container_id = this.container_id.replace(/^(docker-)+|(\\.scope)+$/ig, "");
|
|
21
|
+
this.container_id = this.container_id.replace(/^(docker-)+|(containerd-)+|(crio-)+|(\\.scope)+$/ig, "");
|
|
22
22
|
if(this.container_id.length > 5){
|
|
23
23
|
this.container_key = HashUtil.hash(this.container_id);
|
|
24
24
|
break;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
Logger.print('WHATAP-800' , 'id:' + this.container_id + ' // key:' + this.container_key , false)
|
|
28
29
|
}catch(e){
|
|
29
30
|
Logger.printError('WHATAP-800', 'KubeUtil(loadContainerId) ', e)
|
|
30
31
|
}
|
package/package.json
CHANGED