我新学习节点js我想要100.000网站正常运行时间检查监视器得到标题响应。
我使用https://www.npmjs.com/package/ping-monitor类
如何更快地检查和处理工作, 我添加了log mongoDB数据库
我的代码
var urls = ["http://www.google.com",
"http://www.yahoo.com",
"http://www.website.com"];
async.map(urls, function(url, callback) {
try {
var myWebsite = new Monitor({
website: url,
interval: 1
});
myWebsite.on('error', function (msg) {
console.log(msg);
});
myWebsite.on('up', function (res) {
console.log('Website UP ' + res.website + ' .');
});
myWebsite.on('down', function (res) {
console.log('Oh Snap!! ' + res.website + ' is down! ' + res.statusMessage);
});
// this event is required to be handled in all Node-Monitor instances
myWebsite.on('error', function (res) {
console.log('Oh Snap!! An unexpected error occured trying to load ' + res.website + '!');
myWebsite.stop();
});
myWebsite.on('stop', function (website) {
console.log(website + ' monitor has stopped.');
});
}catch(e)
{
console.log("hata "+url);
}
setTimeout(function () {
callback("null", 'one')
console.log(url+" Başlayacak");
}, 0)
}, function(err, results) {
});