aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2016-02-21 15:17:23 +0000
committerKristian Lyngstol <kly@kly.no>2016-02-21 15:17:23 +0000
commita412ae0c8c75b70786cf60c10c21d0b5c080dfb4 (patch)
tree6c64eab1ac2c207c49b6ef7c4bc38e6e897c809a /web
parentcdc33b1f0989e82d270d281090ffa2d516282f62 (diff)
nms: Start splitting up port-state.pl
Diffstat (limited to 'web')
-rwxr-xr-xweb/nms.gathering.org/comment.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/web/nms.gathering.org/comment.pl b/web/nms.gathering.org/comment.pl
new file mode 100755
index 0000000..d22dcdc
--- /dev/null
+++ b/web/nms.gathering.org/comment.pl
@@ -0,0 +1,16 @@
+#! /usr/bin/perl
+# vim:ts=8:sw=8
+
+use lib '../../include';
+use nms::web;
+use strict;
+use warnings;
+use Data::Dumper;
+
+my $query = $nms::web::dbh->prepare('select sysname,extract(epoch from date_trunc(\'second\',time)) as time,state,username,id,comment from switch_comments natural join switches where state != \'delete\' order by time desc limit 1');
+$query->execute();
+while (my $ref = $query->fetchrow_hashref()) {
+ push @{$nms::web::json{'comments'}{$ref->{'sysname'}}{'comments'}},$ref;
+}
+
+nms::web::finalize_output();