diff --git a/monitor.mjs b/monitor.mjs index 33701c3..5193464 100644 --- a/monitor.mjs +++ b/monitor.mjs @@ -70,7 +70,7 @@ class Monitor { const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => { let configs = await _self.getConfig(); if (configs.monit_urls.length == 0) { - console.error("No monit urls"); + console.error("No monit urls in the config file."); return false; } @@ -83,7 +83,6 @@ class Monitor { taskRes = await common.createHeroUnionTask(configs.monit_urls[i], '', configs); if (taskRes && taskRes.code == 1) { _self.tasks.push(taskRes.task); - console.log("Monit task", taskRes.task); }else { console.error("Monit task create failed", taskRes); } @@ -100,17 +99,14 @@ class Monitor { const _self = this; let configs = await _self.getConfig(); - console.log('Task number', _self.tasks.length); - let task, taskRes; for(let index = 0; index < _self.tasks.length; index ++) { task = _self.tasks[index]; if (task.status == 'done') {continue;} - console.log('Query task result', task); + console.log('Query task result of %s', task.id); taskRes = await common.queryHeroUnionTask(task.id, configs); if (taskRes && taskRes.code == 1) { - console.log("Task result", taskRes); _self.tasks[index] = taskRes.task; common.log('Connect success, url: %s, task id: %s', task.url, task.id); @@ -142,7 +138,7 @@ class Monitor { && this.config.resultQueryFrequence ? this.config.resultQueryFrequence : 5; //5 分钟检测一次 const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => { if (_self.tasks.length == 0) { - console.error("No tasks"); + console.error("No tasks to check result."); return false; }