summaryrefslogtreecommitdiff
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
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
-rwxr-xr-xscripts/rl-system.init3
-rw-r--r--scripts/snmp/vyatta-snmp.pl13
-rw-r--r--templates/service/snmp/trap-source/node.def2
3 files changed, 17 insertions, 1 deletions
diff --git a/scripts/rl-system.init b/scripts/rl-system.init
index ed26301e..ee113ff6 100755
--- a/scripts/rl-system.init
+++ b/scripts/rl-system.init
@@ -94,7 +94,8 @@ update_version_info () {
clear_or_override_config_files ()
{
- for conf in snmp/snmpd.conf snmp/snmptrapd.conf keepalived/keepalived.conf \
+ for conf in snmp/snmpd.conf snmp/snmptrapd.conf snmp/snmp.conf \
+ keepalived/keepalived.conf \
ipvsadm.rules default/ipvsadm resolv.conf
do
if [ -s /etc/$conf ] ; then
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;
diff --git a/templates/service/snmp/trap-source/node.def b/templates/service/snmp/trap-source/node.def
new file mode 100644
index 00000000..d8add72c
--- /dev/null
+++ b/templates/service/snmp/trap-source/node.def
@@ -0,0 +1,2 @@
+type: ipv4
+help: Set SNMP trap source address