From 732f072d22e3e75f7fc8c0b5b6c601a81c0c88ae Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 7 Jan 2010 17:21:23 -0800 Subject: Add support for trap community and port Bug 3756 Allow setting trap communities and port values. --- scripts/snmp/vyatta-snmp.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl index 5c8df10c..9a6a5039 100644 --- a/scripts/snmp/vyatta-snmp.pl +++ b/scripts/snmp/vyatta-snmp.pl @@ -157,8 +157,7 @@ sub snmp_get_values { print "syslocation \"$location\" \n"; } - my @trap_targets = $config->returnValues("trap-target"); - + my @trap_targets = $config->listNodes("trap-target"); if (@trap_targets) { # linkUp/Down configure the Event MIB tables to monitor # the ifTable for network interfaces being taken up or down @@ -181,7 +180,14 @@ EOF } foreach my $trap_target (@trap_targets) { - print "trap2sink $trap_target\n"; + my $port = $config->returnValue("trap-target $trap_target port"); + my $community + = $config->returnValue("trap-target $trap_target community"); + + print "trap2sink $trap_target"; + print ":$port" if $port; + print " %community" if $community; + print "\n"; } } -- cgit v1.2.3