summaryrefslogtreecommitdiff
path: root/scripts/snmp
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-01-07 17:58:46 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-01-07 17:58:46 -0800
commitef6945e6627cb2833080fd41ea7ab5084c5b1de3 (patch)
tree9ffe57a95daef0338b3eb9fc1aeb5c0430fa6a3e /scripts/snmp
parent732f072d22e3e75f7fc8c0b5b6c601a81c0c88ae (diff)
downloadvyatta-cfg-system-ef6945e6627cb2833080fd41ea7ab5084c5b1de3.tar.gz
vyatta-cfg-system-ef6945e6627cb2833080fd41ea7ab5084c5b1de3.zip
Add support trap source address
Bug 458 Add service snmp trap-source <address> wrapper for /etc/snmp/snmp.conf
Diffstat (limited to 'scripts/snmp')
-rw-r--r--scripts/snmp/vyatta-snmp.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl
index 9a6a5039..8a26e3dc 100644
--- a/scripts/snmp/vyatta-snmp.pl
+++ b/scripts/snmp/vyatta-snmp.pl
@@ -35,6 +35,7 @@ use warnings;
my $mibdir = '/opt/vyatta/share/snmp/mibs';
my $snmp_init = '/opt/vyatta/sbin/snmpd.init';
my $snmp_conf = '/etc/snmp/snmpd.conf';
+my $snmp_client = '/etc/snmp/snmp.conf';
my $snmp_tmp = "/tmp/snmpd.conf.$$";
my $snmp_snmpv3_user_conf = '/usr/share/snmp/snmpd.conf';
my $snmp_snmpv3_createuser_conf = '/var/lib/snmp/snmpd.conf';
@@ -58,6 +59,8 @@ sub snmp_start {
close $fh;
select STDOUT;
+ snmp_client_config();
+
move($snmp_tmp, $snmp_conf)
or die "Couldn't move $snmp_tmp to $snmp_conf - $!";
@@ -191,6 +194,16 @@ EOF
}
}
+sub snmp_client_config {
+ my $config = new Vyatta::Config;
+ my $trap_source = $config->returnValue('trap-source');
+
+ open (my $cf, '>', $snmp_client)
+ or die "Couldn't open $snmp_client - $!";
+ print {$cf} "clientaddr $trap_source\n" if ($trap_source);
+ close $cf;
+}
+
sub snmp_create_snmpv3_user {
my $vyatta_user = shift;