summaryrefslogtreecommitdiff
path: root/scripts/snmp/vyatta-snmp.pl
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-01-18 18:44:10 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-01-18 18:44:10 -0800
commit3f58c0d6f3467c55a69c055c5d25bd7f02204d99 (patch)
treeaa418aeedcf69920ca5dde056b59e31264e67b98 /scripts/snmp/vyatta-snmp.pl
parent58ad6a6a0ad9d55b7ba94afd25c31cb96b2ac92d (diff)
downloadvyatta-cfg-system-3f58c0d6f3467c55a69c055c5d25bd7f02204d99.tar.gz
vyatta-cfg-system-3f58c0d6f3467c55a69c055c5d25bd7f02204d99.zip
Fix snmp trap-source
Incorrect config level in script.
Diffstat (limited to 'scripts/snmp/vyatta-snmp.pl')
-rw-r--r--scripts/snmp/vyatta-snmp.pl13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl
index d92143f6..3adb37b7 100644
--- a/scripts/snmp/vyatta-snmp.pl
+++ b/scripts/snmp/vyatta-snmp.pl
@@ -41,6 +41,8 @@ my $snmp_snmpv3_user_conf = '/usr/share/snmp/snmpd.conf';
my $snmp_snmpv3_createuser_conf = '/var/lib/snmp/snmpd.conf';
my $versionfile = '/opt/vyatta/etc/version';
+my $snmp_level = 'service snmp';
+
sub snmp_restart {
system("$snmp_init restart > /dev/null 2>&1 &");
}
@@ -144,7 +146,7 @@ sub snmp_get_values {
}
}
- $config->setLevel("service snmp");
+ $config->setLevel($snmp_level);
my $contact = $config->returnValue("contact");
if (defined $contact) {
print "syscontact \"$contact\" \n";
@@ -194,12 +196,19 @@ EOF
}
}
+# Configure SNMP client parameters
sub snmp_client_config {
my $config = new Vyatta::Config;
- my $trap_source = $config->returnValue('trap-source');
+ $config->setLevel($snmp_level);
open (my $cf, '>', $snmp_client)
or die "Couldn't open $snmp_client - $!";
+
+ my $version = get_version();
+ my $now = localtime;
+ print {$cf} "# autogenerated by vyatta-snmp.pl on $now\n";
+
+ my $trap_source = $config->returnValue('trap-source');
print {$cf} "clientaddr $trap_source\n" if ($trap_source);
close $cf;
}