diff options
Diffstat (limited to 'web')
-rwxr-xr-x | web/api/public/switch-state | 6 | ||||
-rw-r--r-- | web/js/nms-map-handlers.js | 29 |
2 files changed, 32 insertions, 3 deletions
diff --git a/web/api/public/switch-state b/web/api/public/switch-state index b7cd70c..557c312 100755 --- a/web/api/public/switch-state +++ b/web/api/public/switch-state @@ -27,7 +27,7 @@ while ( my $ref = $q->fetchrow_hashref() ) { } else { $json{'switches'}{$sysname}{ifs}{$smallport}{'ifAlias'} = $port{'ifAlias'}; } - if ($porti =~ /ge-0\/0\/4[4-7]$/) { + if ($porti =~ /Gi1\/0\/4[78]$/) { $json{'switches'}{$sysname}{'uplinks'}{'ifHCInOctets'} += $port{'ifHCInOctets'}; $json{'switches'}{$sysname}{'uplinks'}{'ifHCOutOctets'} += $port{'ifHCOutOctets'}; if ($port{'ifOperStatus'} eq "up") { @@ -70,7 +70,7 @@ while ( my $ref = $q2->fetchrow_hashref() ) { } else { $json{'then'}{$sysname}{ifs}{$smallport}{'ifAlias'} = $port{'ifAlias'}; } - if ($porti =~ /ge-0\/0\/4[4-7]$/) { + if ($porti =~ /Gi1\/0\/4[78]$/) { $json{'then'}{$sysname}{'uplinks'}{'ifHCInOctets'} += $port{'ifHCInOctets'}; $json{'then'}{$sysname}{'uplinks'}{'ifHCOutOctets'} += $port{'ifHCOutOctets'}; if ($port{'ifOperStatus'} eq "up") { @@ -89,7 +89,7 @@ while ( my $ref = $q2->fetchrow_hashref() ) { } $json{'then'}{$sysname}{totals}{'total'} += 1; } - $json{'then'}{$sysname}{'temp'} = $data{'misc'}{'enterprises.2636.3.1.13.1.7.7.1.0.0'}{''}; + $json{'then'}{$sysname}{'temp'} = $data{'misc'}{'jnxOperatingTemp'}{'7.1.0.0'} || $data{'misc'}{'ciscoEnvMonTemperatureStatusValue'}{'1011'}; $json{'then'}{$sysname}{'time'} = $ref->{'time'}; } $nms::web::cc{'max-age'} = "5"; diff --git a/web/js/nms-map-handlers.js b/web/js/nms-map-handlers.js index 42044d9..2c47536 100644 --- a/web/js/nms-map-handlers.js +++ b/web/js/nms-map-handlers.js @@ -15,6 +15,7 @@ var handler_uplinks = { init:uplinkInit, + getInfo:uplinkInfo, tag:"uplink", name:"Uplink" }; @@ -127,6 +128,33 @@ var handlers = [ handler_cpu ]; +function uplinkInfo(sw) +{ + var ret = new handlerInfo("uplink","Uplinks"); + ret.why = "Uplinks"; + ret.score =0; + if (testTree(nmsData,['switchstate','switches',sw,'uplinks'])) { + var u = parseInt(nmsData.switchstate.switches[sw].uplinks.live); + ret.data[0].value = u; + ret.data[0].description = "Uplinks"; + if (nmsData.switches.switches[sw].subnet4 == undefined || + nmsData.switches.switches[sw].subnet4 == null) { + if (u == 0) { + ret.score = 700 + ret.why = "0 uplinks with clientnet?"; + } else if (u == 1) { + ret.score = 600; + ret.why = "Only 1 uplink"; + } else if (u == 2) { + ret.score = 0; + } else { + ret.score = 500; + ret.why = u + " uplinks"; + } + } + } + return ret; +} /* * Update function for uplink map */ @@ -163,6 +191,7 @@ function uplinkUpdater() } } + /* * Init-function for uplink map */ |