diff options
-rwxr-xr-x | clients/snmpfetchng.pl | 1 | ||||
-rw-r--r-- | web/nms.gathering.org/js/nms-info-box.js | 48 |
2 files changed, 44 insertions, 5 deletions
diff --git a/clients/snmpfetchng.pl b/clients/snmpfetchng.pl index 394abae..bece8ab 100755 --- a/clients/snmpfetchng.pl +++ b/clients/snmpfetchng.pl @@ -60,7 +60,6 @@ sub populate_switches { @switches = (); my $limit = $nms::config::snmp_max; - print "called populate\n"; $qswitch->execute($limit) or die "Couldn't get switch"; $dbh->commit; diff --git a/web/nms.gathering.org/js/nms-info-box.js b/web/nms.gathering.org/js/nms-info-box.js index 6b13498..0175b6f 100644 --- a/web/nms.gathering.org/js/nms-info-box.js +++ b/web/nms.gathering.org/js/nms-info-box.js @@ -140,6 +140,38 @@ nmsInfoBox._makeCommentTable = function(content) { return table; } +nmsInfoBox._searchSmart = function(id, sw) { + if (nmsData.smanagement.switches[sw].distro == id) { + console.log("ieh"); + return true; + } + if (id.match("[a-z]+.active")) { + console.log("hei: " + sw); + var family = id.match("[a-z]+"); + var limit = id; + limit = limit.replace(family + ".active>",""); + limit = limit.replace(family + ".active<",""); + limit = limit.replace(family + ".active=",""); + var operator = id.replace(family + ".active","")[0]; + if (limit == parseInt(limit)) { + if (operator == ">" ) { + if (nmsData.switchstate.switches[sw][family].live > limit) { + return true; + } + } else if (operator == "<") { + if (nmsData.switchstate.switches[sw][family].live < limit) { + return true; + } + } else if (operator == "=") { + if (nmsData.switchstate.switches[sw][family].live == limit) { + return true; + } + } + } + } + return false; +} + /* * FIXME: Not sure this belongs here, it's really part of the "Core" ui, * not just the infobox. @@ -153,11 +185,19 @@ nmsInfoBox._search = function() { } if(id) { for(var sw in nmsData.switches.switches) { - if(sw.indexOf(id) > -1) { - hits++; - nmsMap.setSwitchHighlight(sw,true); + if (id[0] == "/") { + if (nmsInfoBox._searchSmart(id.slice(1),sw)) { + nmsMap.setSwitchHighlight(sw,true); + } else { + nmsMap.setSwitchHighlight(sw,false); + } } else { - nmsMap.setSwitchHighlight(sw,false); + if(sw.indexOf(id) > -1) { + hits++; + nmsMap.setSwitchHighlight(sw,true); + } else { + nmsMap.setSwitchHighlight(sw,false); + } } } } else { |