summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-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;
}