1

I new learning node js i want 100.000 web site uptime check monitor get header response.

I Use https://www.npmjs.com/package/ping-monitor class

How i can faster check and threading work, I add log mongoDB database

My Code

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) {

    });
Agit
  • 83
  • 1
  • 9
  • I'm a little confused what it is you're asking. Are you trying to record every time you visit google, yahoo and an example website to see if they are up or down? And it's not going as fast as you want? They actively have rate limiters on bigger websites to prevent you doing stuff like this, because it sounds like you're trying to HTTP ping flood them. The best way to determine if a site is up or down is to write a simple endpoint that you can hit on your own site, and ping it once a second or so. – jcolebrand Feb 05 '17 at 18:32
  • thanks for comment ,Each member will control their own sites.Example project pingdom vs. @jcolebrand – Agit Feb 05 '17 at 23:29

0 Answers0