Script for suck Cisco 3640

Do u have Cisco Router 3640 ? has experience interface ethernet hangs suddenly, no arp of neighborhood computer, can’t ping to another host, just one solution to resolve : RELOAD !!

If you have this Cisco router 3640 and this in production environment, and have above problem. You will never go sleep well.
Here I make perl script to do reload of router. And then This script scheduled in cron tab.
My problem case and flow chart of my program like following,
My script check by login to router, first check is typing command “show ip bgp summary”,and then checking status BGP of router. If status BGP is “Active”, so we checked to ping ip address of bgp router peer. If success rate is 0 percent, we face the real problem, so doing “reload” command. Otherwise, logout.

Good night, have a nice dream…..

use Net::Telnet ();
$t = new Net::Telnet(Prompt=>’/sindoro/’,Timeout=>15);
$t->waitfor(’/Username: $/’) || die “Didnot get username”;
$t->waitfor(’/Password: $/’) || die “Did not get password”; $t->print(’put_your_password_telnet_here’);
$t->waitfor(’/sindoro/’) || die “didnot get prompt”;
$t->waitfor(’/Password: $/’) || die “Did not get password”;
$t->waitfor(’/sindoro/’) || die “didnot get prompt”;
@status_openixp=$t->cmd(”show ip bgp summary | in”);
print @status_openixp; ($tmp,$tmp2,$tmp3,$tmp4,$tmp5,$tmp6,$tmp7,$tmp8,$updown,$state)=split(/\s+/,$status_openixp[0]);
print “Uptime BGP: “.$updown.” “.$state.” prefix”;
if ($state =~ /Active/)
{ print “BGP is active”;
# print @ping_status;
print “Ping rate: “.$rate.” percent” ;
if ($rate == “0″)
{ $t->print(’reload’);
$t->waitfor(’/confirm/’) || die “gak dapet confirm”;

Thank’s to johan


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )


Connecting to %s

%d blogger menyukai ini: