forked from danielzzz/node-ping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy-test.js
16 lines (14 loc) · 3.96 KB
/
my-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var fs = require('fs')
, Log = require('log')
, log = new Log('debug', fs.createWriteStream('result.log'));
var ping = require('ping');
var hosts=['baidu.com','180.212.140.81','219.145.232.204','112.247.176.108','180.112.221.142','115.225.122.35','58.243.226.130','116.249.115.51','113.244.56.126','1.85.129.217','122.72.32.73','119.164.179.184','175.42.102.252','58.245.110.154','171.39.41.186','61.160.6.158','111.155.116.200','110.73.5.198','175.11.152.253','221.237.122.52','221.229.190.241','222.52.142.242','218.56.132.155','220.249.185.178','118.188.20.162','222.73.85.77','220.248.36.57','122.72.32.75','122.72.32.93','180.168.179.193','123.207.30.187','120.76.47.120','180.140.165.130','61.141.186.159','219.141.189.236','171.221.70.59','163.125.211.89','118.178.124.33','42.202.130.246','124.239.177.85','61.152.81.193','112.247.176.108','180.112.221.142','118.188.20.162','58.243.226.130','113.244.56.126','1.85.129.217','123.207.30.187','120.76.47.120','180.140.165.130','219.141.189.236','119.164.179.184','42.202.130.246','175.42.102.252','58.245.110.154','61.160.6.158','221.237.122.52','221.229.190.241','120.25.154.32','223.223.194.254','114.102.15.48','222.52.142.242','180.212.140.81','222.73.85.77','115.225.122.35','116.249.115.51','220.248.36.57','122.72.32.75','122.72.32.93','180.168.179.193','122.72.32.73','61.141.186.159','171.221.70.59','163.125.211.89','118.178.124.33','124.239.177.85','61.152.81.193','171.39.41.186','111.155.116.200','110.73.5.198','175.11.152.253','113.121.245.32','121.31.103.33','110.73.30.246','114.239.253.38','116.28.106.165','220.179.214.77','110.73.32.7','114.139.48.8','111.124.231.101','118.80.181.186','113.122.42.161','60.211.17.10','110.72.20.245','110.73.33.207','122.89.138.20','61.138.104.30','121.31.199.91','182.90.15.172','202.38.95.66','113.93.120.136',"183.221.50.92","140.124.72.74","1.163.88.127","112.192.234.123","111.252.50.214","211.138.121.37","123.110.219.104","218.108.168.68","27.206.137.9","58.254.132.87","211.138.121.37","111.184.226.3","119.14.253.128","117.59.217.237","221.182.101.213","183.209.124.38","60.5.97.122","211.151.59.251","113.237.206.45","125.119.2.44","114.95.216.45","110.228.12.112","118.233.199.164","183.207.224.17","124.230.71.201","58.62.44.103","124.239.164.102","121.10.109.142","119.7.192.27","115.228.244.31","183.221.50.92","140.124.72.74","1.163.88.127","112.192.234.123","111.252.50.214","211.138.121.37","123.110.219.104","218.108.168.68","27.206.137.9","58.254.132.87","211.138.121.37","111.184.226.3","119.14.253.128","117.59.217.237","221.182.101.213","183.209.124.38","60.5.97.122","211.151.59.251","113.237.206.45","125.119.2.44","114.95.216.45","110.228.12.112","118.233.199.164","183.207.224.17","124.230.71.201","58.62.44.103","124.239.164.102","121.10.109.142","119.7.192.27","115.228.244.31","183.221.50.92","140.124.72.74","1.163.88.127","112.192.234.123","111.252.50.214","211.138.121.37","123.110.219.104","218.108.168.68","27.206.137.9","58.254.132.87","211.138.121.37","111.184.226.3","119.14.253.128","117.59.217.237","221.182.101.213","183.209.124.38","60.5.97.122","211.151.59.251","113.237.206.45","125.119.2.44","114.95.216.45","110.228.12.112","118.233.199.164","183.207.224.17","124.230.71.201","58.62.44.103","124.239.164.102","121.10.109.142","119.7.192.27","115.228.244.31","183.221.50.92","140.124.72.74","1.163.88.127","112.192.234.123","111.252.50.214","211.138.121.37","123.110.219.104","218.108.168.68","27.206.137.9","58.254.132.87","211.138.121.37","111.184.226.3","119.14.253.128","117.59.217.237","221.182.101.213","183.209.124.38","60.5.97.122","211.151.59.251","113.237.206.45","125.119.2.44","114.95.216.45","110.228.12.112","118.233.199.164","183.207.224.17","124.230.71.201","58.62.44.103","124.239.164.102","121.10.109.142","119.7.192.27","115.228.244.31"];
var pingASecond = function(){
hosts.forEach(function (host) {
ping.promise.probe(host)
.then(function (res) {
log.debug(res["host"]+" "+res["time"]+"ms");
});
});
}
setInterval(pingASecond,1000);