aboutsummaryrefslogtreecommitdiffstats
path: root/web/api
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2016-05-20 16:48:03 +0200
committerKristian Lyngstol <kristian@bohemians.org>2016-05-20 16:48:03 +0200
commit746e73a9ea27dc90047ac26950c21f963bf99af5 (patch)
tree62c2b3c642dfa08a12b9b6fbbb76da62e9074ad4 /web/api
parent212753aa48e60ccc9cbd74a16f313cebc6d3cda6 (diff)
Add system-generated op logs
First up: Add a switch, get a log entry. This might require some filtering in the GUI eventually. This is why the user is set to 'system', even when we have an actual user that triggered the event.
Diffstat (limited to 'web/api')
-rwxr-xr-xweb/api/write/switch-add4
1 files changed, 3 insertions, 1 deletions
diff --git a/web/api/write/switch-add b/web/api/write/switch-add
index 56e5cb2..d210567 100755
--- a/web/api/write/switch-add
+++ b/web/api/write/switch-add
@@ -11,6 +11,7 @@ use strict;
use warnings;
use JSON;
use Data::Dumper;
+use nms::oplog qw(oplog);
$nms::web::cc{'max-age'} = "0";
@@ -83,10 +84,11 @@ foreach my $tmp2 (@tmp) {
$nms::web::dbh->do("INSERT INTO SWITCHES (mgmt_v4_addr, sysname, poll_frequency, community, lldp_chassis_id, mgmt_v6_addr, placement,subnet4,subnet6,distro_name) VALUES ($template{'mgmt_v4_addr'}, $template{'sysname'}, $template{'poll_frequency'}, $template{'community'}, $template{'lldp_chassis_id'}, $template{'mgmt_v6_addr'}, $template{'placement'},$template{'subnet4'},$template{'subnet6'},$template{'distro_name'});");
push @added, $switch{'sysname'};
+ oplog($switch{'sysname'}, "Switch added: " . $switch{'sysname'});
}
}
$json{'switches_addded'} = \@added;
-print "X-ban: /api/.*switches.*\n";
+print "X-ban: /api/.*\n";
finalize_output();