in reply to Re: Call for (gentle) critique.
in thread Call for (gentle) critique.
sub execute { my $i = shift; my $mib = "$oid{$i}$tftpserver"; for my $host(@routers) { chomp $host; next if (($regex) and ($host !~ /$regex/)); $filename = "$host.cfg" if ($i eq "wrnet"); my $s = Net::SNMP->session( -hostname => $host, -community => $community ); $s->set_request($mib, OCTET_STRING, $filename); my $error = $s->error; $s->set_request($oid{wrmem}, INTEGER, "1") if ($commit); $s->close; if ($error) { print "\n$error\n\n"; } elsif ($i eq "wrnet") { print "\nSuccessfully wrote config to tftpserver for $host.\n\n" +; } elsif ($i eq "confnet") { print "\nSuccessfully sent config to $host.\n\n"; } } }
humbly -c
|
|---|