aboutsummaryrefslogtreecommitdiffstats
path: root/web/nms.gathering.org
diff options
context:
space:
mode:
Diffstat (limited to 'web/nms.gathering.org')
-rwxr-xr-xweb/nms.gathering.org/api/public/location4
-rwxr-xr-xweb/nms.gathering.org/api/public/switch-state3
-rwxr-xr-xweb/nms.gathering.org/api/read/switches-management2
-rw-r--r--web/nms.gathering.org/js/nms-map-handlers.js14
4 files changed, 11 insertions, 12 deletions
diff --git a/web/nms.gathering.org/api/public/location b/web/nms.gathering.org/api/public/location
index 6c25ab9..b940007 100755
--- a/web/nms.gathering.org/api/public/location
+++ b/web/nms.gathering.org/api/public/location
@@ -8,7 +8,7 @@ use warnings;
use Data::Dumper;
#my $query = $nms::web::dbh->prepare("select * from switches where '185.110.150.7' << subnet4");
-my $query = $nms::web::dbh->prepare("select * from switches where ? << subnet4");
+my $query = $nms::web::dbh->prepare("select * from switches where ? << subnet4 or ? << subnet6");
print "Cache-Control: max-age=0";
print "Content-Type: text/html";
@@ -20,7 +20,7 @@ print "\n\n";
my @xff = split(",",$ENV{HTTP_X_FORWARDED_FOR});
my $addr = $xff[0] // $ENV{REMOTE_ADDR};
-$query->execute($addr);
+$query->execute($addr,$addr);
# add start html: header + body etc.
print "
diff --git a/web/nms.gathering.org/api/public/switch-state b/web/nms.gathering.org/api/public/switch-state
index 32cf9a6..2a2b5b6 100755
--- a/web/nms.gathering.org/api/public/switch-state
+++ b/web/nms.gathering.org/api/public/switch-state
@@ -32,7 +32,6 @@ while ( my $ref = $q->fetchrow_hashref() ) {
}
$json{'switches'}{$sysname}{'uplinks'}{'total'} += 1;
}
-
$json{'switches'}{$sysname}{ifs}{$smallport}{'ifHCInOctets'} += $port{'ifHCInOctets'};
$json{'switches'}{$sysname}{ifs}{$smallport}{'ifHCOutOctets'} += $port{'ifHCOutOctets'};
$json{'switches'}{$sysname}{totals}{'ifHCInOctets'} += $port{'ifHCInOctets'};
@@ -43,6 +42,7 @@ while ( my $ref = $q->fetchrow_hashref() ) {
}
$json{'switches'}{$sysname}{totals}{'total'} += 1;
}
+ $json{'switches'}{$sysname}{'temp'} = $data{'misc'}{'enterprises.2636.3.1.13.1.7.7.1.0.0'}{''};
$json{'switches'}{$sysname}{'time'} = $ref->{'time'};
}
@@ -83,6 +83,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}{'time'} = $ref->{'time'};
}
$nms::web::cc{'max-age'} = "5";
diff --git a/web/nms.gathering.org/api/read/switches-management b/web/nms.gathering.org/api/read/switches-management
index 9e12337..4461a90 100755
--- a/web/nms.gathering.org/api/read/switches-management
+++ b/web/nms.gathering.org/api/read/switches-management
@@ -12,7 +12,7 @@ use Data::Dumper;
$nms::web::cc{'max-age'} = "60";
-my $q2 = $nms::web::dbh->prepare('select switch,sysname,mgmt_v4_addr,subnet4,subnet6,mgmt_v6_addr,mgmt_v4_gw,mgmt_v6_gw,mgmt_vlan,traffic_vlan,last_config_fetch,current_mac,poll_frequency,last_updated from switches where placement is not null');
+my $q2 = $nms::web::dbh->prepare('select switch,sysname,mgmt_v4_addr,subnet4,subnet6,mgmt_v6_addr,mgmt_v4_gw,mgmt_v6_gw,mgmt_vlan,traffic_vlan,last_config_fetch,current_mac,poll_frequency,last_updated,distro_phy_port from switches where placement is not null');
$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {
diff --git a/web/nms.gathering.org/js/nms-map-handlers.js b/web/nms.gathering.org/js/nms-map-handlers.js
index 6de2943..7c13421 100644
--- a/web/nms.gathering.org/js/nms-map-handlers.js
+++ b/web/nms.gathering.org/js/nms-map-handlers.js
@@ -236,16 +236,14 @@ function tempUpdater()
var t = "white";
var temp = "";
- if(!nmsData.snmp || !nmsData.snmp.snmp || ! nmsData.snmp.snmp[sw] || !nmsData.snmp.snmp[sw]["misc"] || !nmsData.snmp.snmp[sw]["misc"]["enterprises.2636.3.1.13.1.7.7.1.0.0"])
+ if(!nmsData.switchstate || !nmsData.switchstate.switches || !nmsData.switchstate.switches[sw] || !nmsData.switchstate.switches[sw].temp)
continue;
- var tempObj = nmsData.snmp.snmp[sw]["misc"]["enterprises.2636.3.1.13.1.7.7.1.0.0"];
- if(tempObj[""]) {
- temp = tempObj[""] + "°C";
- t = temp_color(temp);
- nmsMap.setSwitchColor(sw, t);
- nmsMap.setSwitchInfo(sw, temp);
- }
+ var t = nmsData.switchstate.switches[sw].temp;
+ temp = t + "°C";
+ t = temp_color(temp);
+ nmsMap.setSwitchColor(sw, t);
+ nmsMap.setSwitchInfo(sw, temp);
}
}