|
@@ -10,7 +10,7 @@ const Server = models.Server; |
|
@@ -10,7 +10,7 @@ const Server = models.Server; |
10
|
const ws = require('../../lib/ws');
|
10
|
const ws = require('../../lib/ws');
|
11
|
|
11
|
|
12
|
const monit = {
|
12
|
const monit = {
|
13
|
- node: function (projectId, hosts) {
|
13
|
+ node: function (project, hosts) {
|
14
|
hosts.forEach((host) => {
|
14
|
hosts.forEach((host) => {
|
15
|
var obj = {
|
15
|
var obj = {
|
16
|
'total': 0,
|
16
|
'total': 0,
|
|
@@ -41,14 +41,14 @@ const monit = { |
|
@@ -41,14 +41,14 @@ const monit = { |
41
|
}).catch(function (err) {
|
41
|
}).catch(function (err) {
|
42
|
obj.errmsg = '获取监控状态失败'
|
42
|
obj.errmsg = '获取监控状态失败'
|
43
|
}).finally(function () {
|
43
|
}).finally(function () {
|
44
|
- ws.broadcast(`/monit/${projectId}`, {
|
44
|
+ ws.broadcast(`/monit/${project._id}`, {
|
45
|
host: host,
|
45
|
host: host,
|
46
|
monitdata: obj
|
46
|
monitdata: obj
|
47
|
});
|
47
|
});
|
48
|
});
|
48
|
});
|
49
|
});
|
49
|
});
|
50
|
},
|
50
|
},
|
51
|
- php: function(projectId, hosts) {
|
51
|
+ php: function(project, hosts) {
|
52
|
if (!_.isArray(hosts)) {
|
52
|
if (!_.isArray(hosts)) {
|
53
|
return;
|
53
|
return;
|
54
|
}
|
54
|
}
|
|
@@ -67,7 +67,7 @@ const monit = { |
|
@@ -67,7 +67,7 @@ const monit = { |
67
|
console.log(err);
|
67
|
console.log(err);
|
68
|
} else {
|
68
|
} else {
|
69
|
stream.on('close', () => {
|
69
|
stream.on('close', () => {
|
70
|
- ws.broadcast(`/monit/${projectId}`, {
|
70
|
+ ws.broadcast(`/monit/${project._id}`, {
|
71
|
host: host,
|
71
|
host: host,
|
72
|
monitdata: obj
|
72
|
monitdata: obj
|
73
|
});
|
73
|
});
|