diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/rl-system.init | 3 | ||||
-rw-r--r-- | scripts/snmp/vyatta-snmp.pl | 25 |
2 files changed, 24 insertions, 4 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 5c8df10c..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 - $!"; @@ -157,8 +160,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,10 +183,27 @@ 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"; } } +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; |