removed mac addresses from code
This commit is contained in:
parent
c48815c8b7
commit
70779ce691
|
@ -0,0 +1,34 @@
|
|||
member: cn=tidirium,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=tatonka,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=ulihd,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=nospoonuser,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=progamler,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=zeus,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=lichtscheu,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=stefan,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=wegginho,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=jcoder,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=smash,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=pascal,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=herbern,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=syn,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=seppo,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=blueberry,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=immo,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=freakfairy,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=badboy,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=alteisen,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=eimann,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=downhill,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=annett,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=dukat,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=klapauzius,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=hotte,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=henne,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=tunix,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=fiurin,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=jsilence,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=kuro,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=klara,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
member: cn=lucas,ou=people,dc=chaostreff-dortmund,dc=de
|
||||
|
|
@ -18,15 +18,8 @@ var SnmpMac = function(hostname, community) {
|
|||
var names = [];
|
||||
|
||||
redisClient.on("connect", function () {
|
||||
redisClient.set(redisprefix + "24:77:03:a9:f3:f4","lucas");
|
||||
redisClient.set(redisprefix + "3c:97:0e:22:b7:68","lucas");
|
||||
redisClient.set(redisprefix + "a0:0b:ba:c7:98:e5","lucas");
|
||||
redisClient.set(redisprefix + "b8:27:eb:7d:6f:d2","rpi2");
|
||||
redisClient.set(redisprefix + "b8:27:eb:7b:9b:9a","rpi3");
|
||||
redisClient.set(redisprefix + "a8:88:08:10:a0:c5","pascal");
|
||||
redisClient.set(redisprefix + "c8:97:9f:72:8f:67","fisch");
|
||||
redisClient.set(redisprefix + "00:80:a3:91:39:1c","ripe-atlas-probe");
|
||||
redisClient.set(redisprefix + "d4:ca:6d:33:cf:79","routerboard");
|
||||
//redisClient.set(redisprefix + "00:80:a3:91:39:1c","ripe-atlas-probe");
|
||||
//redisClient.set(redisprefix + "d4:ca:6d:33:cf:79","routerboard");
|
||||
|
||||
console.log("connected to redis");
|
||||
self.emit('ready');
|
||||
|
|
56
node/test.js
56
node/test.js
|
@ -1,30 +1,50 @@
|
|||
var moment = require("moment");
|
||||
var redis = require("redis");
|
||||
var redisClient = redis.createClient();
|
||||
|
||||
redisClient.on("connect", function () {
|
||||
console.log("connected to redis");
|
||||
var snmp = require("net-snmp");
|
||||
|
||||
|
||||
var baseoid = "1.3.6.1.2.1.17.7.1.2.2.1.3";
|
||||
var regexp = /([0-9]+).([0-9]+).([0-9]+).([0-9]+).([0-9]+).([0-9]+)$/;
|
||||
|
||||
var session = snmp.createSession("juni.ctdo.de", "ctdo23", { version: snmp.Version2c } )
|
||||
|
||||
|
||||
function getMacFromOID(oid, callback) {
|
||||
var matches = regexp.exec(oid);
|
||||
var mac = "";
|
||||
|
||||
redisClient.zrangebyscore('onlinecount', "-inf", "+inf", function(err, replies) {
|
||||
if(matches != null) {
|
||||
for(var i = 1; i < matches.length; i++) {
|
||||
var num = parseInt(matches[i]);
|
||||
if(num <= 15) mac += "0";
|
||||
mac += num.toString(16) + ":";
|
||||
}
|
||||
mac = mac.substr(0, mac.length-1);
|
||||
|
||||
var data = [];
|
||||
callback(mac);
|
||||
}
|
||||
}
|
||||
|
||||
replies.forEach(function (reply, i) {
|
||||
function doneCb(error) {
|
||||
if (error)
|
||||
console.error(error.toString ());
|
||||
|
||||
var line = reply.split('|');
|
||||
data.push( { at: moment(parseInt(line[0])).format(), value: line[1] });
|
||||
}
|
||||
|
||||
function feedCb(varbinds) {
|
||||
for (var i = 0; i < varbinds.length; i++) {
|
||||
if (snmp.isVarbindError(varbinds[i])) {
|
||||
console.error(snmp.varbindError (varbinds[i]));
|
||||
} else {
|
||||
if(varbinds[i].value == "3") { // only valid arp entries
|
||||
getMacFromOID(varbinds[i].oid, function(mac) {
|
||||
console.log(mac);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
session.subtree(baseoid, 20, feedCb, doneCb);
|
||||
|
||||
console.log(data);
|
||||
|
||||
redisClient.quit();
|
||||
});
|
||||
|
||||
|
||||
});
|
Loading…
Reference in New Issue