Authored by 姜枫

处理node 状态查询失败

... ... @@ -10,7 +10,7 @@ const Server = models.Server;
const ws = require('../../lib/ws');
const monit = {
node: function (projectId, hosts) {
node: function (project, hosts) {
hosts.forEach((host) => {
var obj = {
'total': 0,
... ... @@ -41,14 +41,14 @@ const monit = {
}).catch(function (err) {
obj.errmsg = '获取监控状态失败'
}).finally(function () {
ws.broadcast(`/monit/${projectId}`, {
ws.broadcast(`/monit/${project._id}`, {
host: host,
monitdata: obj
});
});
});
},
php: function(projectId, hosts) {
php: function(project, hosts) {
if (!_.isArray(hosts)) {
return;
}
... ... @@ -67,7 +67,7 @@ const monit = {
console.log(err);
} else {
stream.on('close', () => {
ws.broadcast(`/monit/${projectId}`, {
ws.broadcast(`/monit/${project._id}`, {
host: host,
monitdata: obj
});
... ...
... ... @@ -437,9 +437,9 @@ const p = {
}
if (project.type === 'php') {
monit.php(projectId, hosts);
monit.php(project, hosts);
} else {
monit.node(projectId, hosts);
monit.node(project, hosts);
}
ctx.body = {
code: 200
... ...
... ... @@ -94,7 +94,7 @@
eventBind();
$("#table-servers").DataTable({
pageLength: 5,
pageLength: 20,
retrieve: true,
responsive: true,
searching: false
... ...