summaryrefslogtreecommitdiff
path: root/scripts/snmp
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/snmp')
-rwxr-xr-xscripts/snmp/vyatta-snmp-v3.pl19
-rwxr-xr-xscripts/snmp/vyatta-snmp.pl11
2 files changed, 16 insertions, 14 deletions
diff --git a/scripts/snmp/vyatta-snmp-v3.pl b/scripts/snmp/vyatta-snmp-v3.pl
index 5cd1ab87..a2d738eb 100755
--- a/scripts/snmp/vyatta-snmp-v3.pl
+++ b/scripts/snmp/vyatta-snmp-v3.pl
@@ -27,7 +27,10 @@ use Socket;
use Socket6;
my $snmp_v3_level = 'service snmp v3';
-my $snmp_init = 'invoke-rc.d snmpd';
+my $snmp_restart = 'systemctl restart snmpd.service';
+my $snmp_stop = 'systemctl stop snmpd.service';
+my $snmp_start = 'systemctl start snmpd.service';
+my $snmp_reload = 'systemctl reload snmpd.service';
my $snmpd_conf = '/etc/snmp/snmpd.conf';
my $snmpd_usr_conf = '/usr/share/snmp/snmpd.conf';
my $snmpd_var_conf = '/var/lib/snmp/snmpd.conf';
@@ -35,7 +38,7 @@ my $snmpd_conf_tmp = "/tmp/snmpd.conf.$$";
my $snmpd_usr_conf_tmp = "/tmp/snmpd.usr.conf.$$";
my $snmpd_var_conf_tmp = "/tmp/snmpd.var.conf.$$";
my $versionfile = '/opt/vyatta/etc/version';
-my $local_agent = 'unix:/var/run/snmpd.socket';
+my $local_agent = 'unix:/run/snmpd.socket';
my $oldEngineID = "";
my $setserialno = "";
@@ -53,7 +56,7 @@ sub randhex {
}
sub snmpd_running {
- open( my $pidf, '<', "/var/run/snmpd.pid" )
+ open( my $pidf, '<', "/run/snmpd.pid" )
or return;
my $pid = <$pidf>;
close $pidf;
@@ -77,9 +80,7 @@ sub check_snmp_exit_code {
}
sub snmpd_stop {
- system(
-"start-stop-daemon --stop --exec /usr/sbin/snmpd --oknodo -R 2 > /dev/null 2>&1"
- );
+ system("$snmp_stop > /dev/null 2>&1");
if ( check_snmp_exit_code($?) ) {
print "ERROR: Can not stop snmpd!\n";
exit(1);
@@ -87,7 +88,7 @@ sub snmpd_stop {
}
sub snmpd_start {
- system("$snmp_init start > /dev/null 2>&1");
+ system("$snmp_start > /dev/null 2>&1");
if ( check_snmp_exit_code($?) ) {
print "ERROR: Can not start snmpd!\n";
exit(1);
@@ -95,7 +96,7 @@ sub snmpd_start {
}
sub snmpd_update {
- system("$snmp_init reload > /dev/null 2>&1");
+ system("$snmp_reload > /dev/null 2>&1");
if ( check_snmp_exit_code($?) ) {
print "ERROR: Can not reload snmpd!\n";
exit(1);
@@ -103,7 +104,7 @@ sub snmpd_update {
}
sub snmpd_restart {
- system("$snmp_init restart > /dev/null 2>&1");
+ system("$snmp_restart > /dev/null 2>&1");
if ( check_snmp_exit_code($?) ) {
print "ERROR: Can not restart snmpd!\n";
exit(1);
diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl
index 90f710e8..d744f2ad 100755
--- a/scripts/snmp/vyatta-snmp.pl
+++ b/scripts/snmp/vyatta-snmp.pl
@@ -36,20 +36,21 @@ use Socket;
use Socket6;
my $mibdir = '/opt/vyatta/share/snmp/mibs';
-my $snmp_init = 'invoke-rc.d snmpd';
+my $snmp_start = 'systemctl start snmpd.service';
+my $snmp_stop = 'systemctl stop snmpd.service';
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';
my $versionfile = '/opt/vyatta/etc/version';
-my $local_agent = 'unix:/var/run/snmpd.socket';
+my $local_agent = 'unix:/run/snmpd.socket';
my $password_file = '/config/snmp/superuser_pass';
my $snmp_level = 'service snmp';
sub snmp_running {
- open (my $pidf, '<', "/var/run/snmpd.pid")
+ open (my $pidf, '<', "/run/snmpd.pid")
or return;
my $pid = <$pidf>;
close $pidf;
@@ -61,12 +62,12 @@ sub snmp_running {
}
sub snmp_stop {
- system("$snmp_init stop > /dev/null 2>&1");
+ system("$snmp_stop > /dev/null 2>&1");
}
sub snmp_start {
# we must stop snmpd first for creating vyatta user
- system("$snmp_init stop > /dev/null 2>&1");
+ system("$snmp_stop > /dev/null 2>&1");
open (my $fh, '>', $snmp_tmp)
or die "Couldn't open $snmp_tmp - $!";