aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/public
diff options
context:
space:
mode:
Diffstat (limited to 'web/api/public')
-rwxr-xr-xweb/api/public/switch-state18
1 files changed, 10 insertions, 8 deletions
diff --git a/web/api/public/switch-state b/web/api/public/switch-state
index 919924e..528bf7d 100755
--- a/web/api/public/switch-state
+++ b/web/api/public/switch-state
@@ -7,17 +7,19 @@ use strict;
use warnings;
use Data::Dumper;
-my $target = $ENV{REQUEST_URI};
-$target =~ s/$ENV{SCRIPT_NAME}//;
-$target =~ s/^\///;
-my ($switch, $port) = split(/\//,$target,2);
+#my $target = $ENV{REQUEST_URI};
+#$target =~ s/$ENV{SCRIPT_NAME}//;
+#$target =~ s/^\///;
+#my ($switch, $port) = split(/\//,$target,2);
+my $port;
+my $switch;
my $q;
-if (!defined($switch)) {
+#if (!defined($switch)) {
$q = $nms::web::dbh->prepare('select sysname,extract(epoch from date_trunc(\'second\',time)) as time,data from snmp natural join switches where id in (select max(id) from snmp where ' . $nms::web::when . ' group by switch) and switches.deleted = \'f\' and not switches.tags \?& array[\'ignoreswitchstate\'];');
-} else {
- $q = $nms::web::dbh->prepare('select sysname,extract(epoch from date_trunc(\'second\',time)) as time,data from snmp natural join switches where id in (select max(id) from snmp where ' . $nms::web::when . 'group by switch) and sysname = ' . $nms::web::dbh->quote($switch) . ';');
-}
+#} else {
+# $q = $nms::web::dbh->prepare('select sysname,extract(epoch from date_trunc(\'second\',time)) as time,data from snmp natural join switches where id in (select max(id) from snmp where ' . $nms::web::when . 'group by switch) and sysname = ' . $nms::web::dbh->quote($switch) . ';');
+#}
$q->execute();
while ( my $ref = $q->fetchrow_hashref() ) {