Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


please help SNMP dynamic configuration using perl

captincaptin Member Posts: 2
Hi there I new to perl and SNMP....I need to write a trap handler in Perl that handle traps in SNMP environment such as link up/down and also it must do some configuration as a respond/correct to what happen,in my case I look for linkdown status and it should turn the alternative port up,that's all
so fa r I got the:
1- snmptrapd.conf file

authCommunity log,execute,net public
ignoreauthfailure no
format1 %#02.2h:%#02.2j TRAP%w.%q (%W) from %A Event:%v

traphandle "{abc}" eq "IF-MIB::LinkUp" || "{def}" eq "IF-MIB::LinkDown" | perl.exe file

my $TRAP_FILE = "traps.all.log";
print "Executing Trap Handler...";

my $host = ; # Read the Hostname - First line of input from STDIN
my $ip = ; # Read the IP - Second line of input

my $result = index($ip,"");

if ($result==-1) {
while() {

open(TRAPFILE, ">> $TRAP_FILE");
print(TRAPFILE "New trap received: $OID

HOST: $host
IP: $ip
foreach(@vars) {
print(TRAPFILE "TRAP: $_
print(TRAPFILE "
print "finished.

but I don't know how to write the piece of script that will do the configuration changes from linkdown to linkup...

can somebody help please...
Sign In or Register to comment.