Button Bar to Load Script in SecureCRT

This time i will write about activate button bar to load script in secureCRT. The background i write this topic because a few days ago, we had an unmanaged Node (Metro Ethernet) which caused by fan modules failed. everybody expected the cause of this incident was power problems. unfortunately, no one checks the log which told the fan failed or malfunction, so that the temperature of working modules getting higher until reach 110 degree Celsius and causing the system off.

From that case, i tried to create a script to capture modules state and log of the system. I decided to use button bar and python script to make it works in secureCRT. so that, when the problem happen again, we just run the script to log what we want and analyze the log.

  1. Activate button bar in SecureCRT. right click in empty bar then check the “Button Bar”.
    1. Right click button bar
  2.  Right click in button bar then select “New Button…”
    2. New Button Bar
  3. Select “Run Script” function and browse the script which being saved.
    3. Load Script
  4. Login to a Node (I use Nokia 7750 SR-7 with SROS)
  5. Click the “Button” to run the script
    4. Run Script

After you click the button, the script will run automatically, make sure you already log the session you established.

sample script to capture module state in SROS with python for secureCRT:

crt.Dialog.MessageBox("Pastikan sudah me-log session ini")

crt.Screen.Send ("\show system information | match \"System Name\" " + "\r")
crt.Screen.WaitForString ("# ")
row = crt.Screen.CurrentRow
str5 = crt.Screen.Get(row-1, 25, row-1, 50).strip()

if (str5 == ": 7210 SAS-R6") or (str5 == ": 7210 SAS-M 24F 2XFP ET"):
crt.Screen.Send ("show system information | match Name " + "\r")
crt.Screen.WaitForString ("# ")
row = crt.Screen.CurrentRow
str5 = crt.Screen.Get(row-2, 28, row-2, 50).strip()

crt.Screen.Send ("show system information | match Type " + "\r")
crt.Screen.WaitForString ("# ")
row = crt.Screen.CurrentRow
str6 = crt.Screen.Get(row-1, 28, row-1, 50).strip()
else:
crt.Screen.Send ("show system information | match Type " + "\r")
crt.Screen.WaitForString ("# ")
row = crt.Screen.CurrentRow
str6 = crt.Screen.Get(row-1, 26, row-1, 50).strip()

if (str6 == "7705 SAR-8") or (str6 == "7705 SAR-8 v2"):
crt.Screen.Send ("show card | match Active " + "\r")
crt.Screen.WaitForString ("# ")
str7 = crt.Screen.Get(row-1,0 , row-1,3).strip()
else:
crt.Screen.Send ("show card | match active " + "\r")
crt.Screen.WaitForString ("# ")
str7 = crt.Screen.Get(row-1,0 , row-1,3).strip()

str8 = str7 + ":" + str5

crt.Screen.Send ("\show time" + "\r")
crt.Screen.WaitForString (str8 + "# ")
crt.Screen.Send ("\environment no more" + "\r")
crt.Screen.WaitForString (str8 + "# ")
crt.Screen.Send ("\show card state" + "\r")
crt.Screen.WaitForString (str8 + "# ")
crt.Screen.Send ("\show chassis" + "\r")
crt.Screen.WaitForString (str8 + "# ")
crt.Screen.Send ("\show system alarms" + "\r")
crt.Screen.WaitForString (str8 + "# ")
crt.Screen.Send ("\show log log-id 99" + "\r")
crt.Screen.WaitForString (str8 + "# ")
crt.Screen.Send ("\show log log-id 50" + "\r")
crt.Screen.WaitForString (str8 + "# ")

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s