diff options
-rw-r--r-- | web/js/nms-info-box.js | 70 | ||||
-rw-r--r-- | web/js/nms-map-handlers.js | 7 |
2 files changed, 11 insertions, 66 deletions
diff --git a/web/js/nms-info-box.js b/web/js/nms-info-box.js index e6817dc..46762c2 100644 --- a/web/js/nms-info-box.js +++ b/web/js/nms-info-box.js @@ -878,53 +878,12 @@ var switchSummaryPanel = function() { }; this.refresh = function(reason) { var content = []; - - //Get DHCP info - var lastDhcp = undefined; - try { - var tempDhcp = nmsData.dhcp.dhcp[this.sw]; - var now = Date.now(); - now = Math.floor(now / 1000); - tempDhcp = now - parseInt(tempDhcp); - tempDhcp = tempDhcp + " s"; - } catch(e) {} - - //Get SNMP status - var snmpStatus = undefined; - try { - if (nmsData.snmp.snmp[this.sw].misc.sysName[0] != sw) { - snmpStatus = "Sysname mismatch"; - } else { - snmpStatus = "OK"; - } - } catch(e) {} - - //Get CPU usage - var cpuUsage = undefined; - try { - var cpu = 0; - for (var u in nmsData.snmp.snmp[this.sw].misc.jnxOperatingCPU) { - var local = nmsData.snmp.snmp[this.sw].misc['jnxOperatingCPU'][u]; - cpu = Math.max(nmsData.snmp.snmp[this.sw].misc.jnxOperatingCPU[u],cpu); - } - cpuUsage = cpu + " %"; - } catch (e) {} - - //Get traffic data - var uplinkTraffic = undefined; - try { - var speed = 0; - var t = parseInt(nmsData.switchstate.then[this.sw].uplinks.ifHCOutOctets); - var n = parseInt(nmsData.switchstate.switches[this.sw].uplinks.ifHCOutOctets); - var tt = parseInt(nmsData.switchstate.then[this.sw].time); - var nt = parseInt(nmsData.switchstate.switches[this.sw].time); - var tdiff = nt - tt; - var diff = n - t; - speed = diff / tdiff; - if(!isNaN(speed)) { - uplinkTraffic = byteCount(speed*8,0); + for ( var h in handlers ) { + if (handlers[h].getInfo != undefined) { + var tmp = handlers[h].getInfo(this.sw); + content.push([tmp.description,tmp.value]); } - } catch (e) {}; + } //Get uptime data var uptime = ""; @@ -933,12 +892,6 @@ var switchSummaryPanel = function() { uptime = Math.floor(uptime) + " t"; } catch(e) {} - //Get temperature data - var temp = ""; - try { - temp = nmsData.switchstate.switches[this.sw].temp + " °C"; - } catch(e) {} - //Get management data var mgmtV4 = ""; var mgmtV6 = ""; @@ -951,20 +904,7 @@ var switchSummaryPanel = function() { subnetV6 = nmsData.smanagement.switches[this.sw].subnet6; } catch(e) {} - //Get ping data - var ping = undefined; - try { - nmsData.ping.switches[this.sw].latency + " ms"; - } catch (e) {} - - - content.push(["Ping latency:",ping]); - content.push(["Last DHCP lease:",lastDhcp]); - content.push(["SNMP status:",snmpStatus]); - content.push(["CPU usage:",cpuUsage]); - content.push(["Uplink traffic:",uplinkTraffic]); content.push(["System uptime:",uptime]); - content.push(["Temperature",temp]); content.push(["Management (v4):",mgmtV4]); content.push(["Management (v6):",mgmtV6]); content.push(["Subnet (v4):",subnetV4]); diff --git a/web/js/nms-map-handlers.js b/web/js/nms-map-handlers.js index 46ab672..d32849d 100644 --- a/web/js/nms-map-handlers.js +++ b/web/js/nms-map-handlers.js @@ -74,6 +74,7 @@ var handler_cpu = { var handler_combo = { init:comboInit, + getInfo:comboInfo, tag:"combo", name:"Aggregated health" }; @@ -411,14 +412,17 @@ function snmpUpdater() { } function snmpInfo(sw) { var ret = { description: "SNMP data", switch: sw, why: "No data" }; - if (nmsData.snmp.snmp[sw] == undefined || nmsData.snmp.snmp[sw].misc == undefined) { + if (nmsData.snmp == undefined || nmsData.snmp.snmp == undefined || nmsData.snmp.snmp[sw] == undefined || nmsData.snmp.snmp[sw].misc == undefined) { ret.score = 800; ret.why = "No data"; + ret.value = "No data"; } else if (nmsData.snmp.snmp[sw].misc.sysName[0] != sw) { ret.score = 300; ret.why = "SNMP sysName doesn't match Gondul sysname"; + ret.value = ret.why; } else { ret.score = 0; + ret.value = "SNMP freshly updated"; nmsMap.setSwitchColor(sw, green); } return ret; @@ -474,6 +478,7 @@ function comboInfo(sw) { } } catch(e) {} } + worst.description = "Worst: " + worst.description; return worst; } |