diff --git a/lib/util.js b/lib/util.js index 39c4039..1801726 100644 --- a/lib/util.js +++ b/lib/util.js @@ -36,6 +36,16 @@ function getServerNameByIp(ip) { } } +function getServerIps() { + var ips = []; + + for (var i = 0; i < servers.length; i++) { + ips.push(servers[i].ip); + } + + return ips; +} + // This method is a monstrosity. // Since we loaded ALL pings from the database, we need to filter out the pings so each entry is a minute apart. // This is done by iterating over the list, since the time between each ping can be completely arbitrary. @@ -120,11 +130,16 @@ exports.setIntervalNoDelay = function(func, delay) { }; exports.convertPingsToGraph = function(sqlData) { + var serverIps = getServerIps(); var graphData = {}; for (var i = 0; i < sqlData.length; i++) { var entry = sqlData[i]; + if (serverIps.indexOf(entry.ip) === -1) { + continue; + } + var name = getServerNameByIp(entry.ip); if (!name) {