• October 24, 2020, 02:20:12 PM
Welcome, Guest. Please login or register. Registration is free.
Did you miss your activation email?

Author Topic: Script PERL connect on switch Avaya 4500 series  (Read 4496 times)

0 Members and 1 Guest are viewing this topic.

Offline Da_fourby

  • Rookie
  • **
  • Posts: 17
Script PERL connect on switch Avaya 4500 series
« on: December 13, 2013, 08:27:10 AM »
Hi all,
I want code a script in Perl for shutdown a switch during the night.
I'm beginner in PERL and i can't connect on my switch with my script on telnet.
I have a username and password via radius authentification... i block on the connection and i think my prompt is bad.
I don't find help in "Internet"
If somebody have code a script can you help me ?


Offline Michael McNamara

  • Administrator
  • Hero Member
  • *****
  • Posts: 3842
    • michaelfmcnamara
    • Michael McNamara
Re: Script PERL connect on switch Avaya 4500 series
« Reply #1 on: December 15, 2013, 11:38:48 PM »
If your looking to use Perl then you probably need to leverage the SNMP mibs to initiate the reboot.

Else I would suggest that you look at Expect (and specifically autoexepect to get your feet wet).

Good Luck!
We've been helping network engineers, system administrators and technology professionals since June 2009.
If you've found this site useful or helpful, please help me spread the word. Link to us in your blog or homepage - Thanks!

Offline MatzeKS

  • Sr. Member
  • ****
  • Posts: 311
    • matzeks
    • Controlware GmbH - Germany
Re: Script PERL connect on switch Avaya 4500 series
« Reply #2 on: December 16, 2013, 04:30:58 AM »
Hi Da_fourby, I'm not sure why you want to shutdown your switches at night.
But anyway, if this is planned to saving energy during night time you can try to use the "energy saver option" on most stackable ERS.

Good luck
------------------------------------------------------
ACE-Fx #00050

Offline Da_fourby

  • Rookie
  • **
  • Posts: 17
Re: Script PERL connect on switch Avaya 4500 series
« Reply #3 on: December 16, 2013, 04:39:13 AM »
Hi all,
I want my script connect on switch or stack via telnet and apply command.
Command shutdown is an example.

Michael have reason, i need SNMP mibs for this but it's my first script so it's very difficult i find.
Thank's you i continue my research, if you have any examples, I'm interested :-)
« Last Edit: December 16, 2013, 04:47:49 AM by Da_fourby »

Offline Théo

  • Jr. Member
  • **
  • Posts: 34
Re: Script PERL connect on switch Avaya 4500 series
« Reply #4 on: December 23, 2013, 03:52:17 AM »

Hi Da_fourby,

The shutdown command will reboot your device not really shutdown.

About scripts, i made somes few month ago. I used perl and telnet mod (CPAN) not SNMP mibs.
If you want more informations, you welcome.


ACIS 6103 - ACSS 3605

Offline Da_fourby

  • Rookie
  • **
  • Posts: 17
Re: Script PERL connect on switch Avaya 4500 series
« Reply #5 on: December 23, 2013, 05:00:52 AM »
Hi Théo,
Yes i know the shutdown command reboot the switch or stack and it's not really shutdown.

Do you have an exemple of your script ?

Offline Da_fourby

  • Rookie
  • **
  • Posts: 17
Re: Script PERL connect on switch Avaya 4500 series
« Reply #6 on: December 23, 2013, 08:03:09 AM »
So it's ok,
I have a functionning script:

use Net::Telnet; #Pour Telnet
my $login = "my_login; #login
my $pwd = "my_pwd"; #mdp
my $device = "172.30.2.100"; #Adresse IP du switch/stack
$t = new Net::Telnet(Timeout => 40, Output_log => "out.log", dump_log => "dump.log"); #Instance connexion Telnet + Résultats dans fichiers
   $t->open("$device"); #Connexion au switch/stack
   sleep(1); #Attente de 1 seconde
   $t->put("\cY"); #Le CTRL+Y
   sleep(1); #Attente de 1 seconde
   $t->print("$login"); #Rentre le login
   $t->print("$pwd"); #Rentre le mdp
   $t->waitfor('/#$/m'); #Attente du prompt
   $t->print("conf t"); #Pour passer en conf t
   $t->print("snmp-server contact DSI"); #Passage de la commande
   (@out) = $t->waitfor('/#$/m'); #Attente du prompt
   $t->print("logout"); #Deconnexion
   $t->close(); #Fermeture de la session Telnet


Thanks you all and thanks you Théo ;-) =D