Schrift
[thread]7655[/thread]

Probelm mit Telnetzugriff auf Router (Seite 2)



<< |< 1 2 3 >| >> 28 Einträge, 3 Seiten
krusty
 2006-01-27 12:20
#62338 #62338
User since
2006-01-27
91 Artikel
BenutzerIn
[default_avatar]
so habe jetzt folgendes probiert.

Code: (dl )
$session->waitfor('/deleting RIP instance, are you sure\? y\/\[n\]/') or die " Error getting \"deleting RIP instance, are you sure? y/[n]\" prompt: $!";


Code: (dl )
$session->waitfor('/deleting RIP instance, are you sure? y\/[n]/') or die " Error getting \"deleting RIP instance, are you sure? y/[n]\" prompt: $!";


Code: (dl )
$session->waitfor('/deleting RIP instance, are you sure\? y\/\[n\] /') or die " Error getting \"deleting RIP instance, are you sure? y/[n]\" prompt: $!";


Code: (dl )
$session->waitfor('/deleting RIP instance, are you sure? y\/[n] /') or die " Error getting \"deleting RIP instance, are you sure? y/[n]\" prompt: $!";


aber alles scheint nicht zu funtzen. *kopf kratz*
renee
 2006-01-27 12:32
#62339 #62339
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Bekommst Du eine Fehlermeldung??

Lass Dir mal mit $session->lastPrompt() immer wieder den letzten Prompt anzeigen. Das Entscheidende ist, dass Du dahinterkommst, an welcher Zeile es "nicht mehr klappt". Irgendwelche Fehlermeldungen waeren naetuerlich sehr hilfreich, sonst artet das hier noch in richtige Raterei aus...
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
krusty
 2006-01-27 12:39
#62340 #62340
User since
2006-01-27
91 Artikel
BenutzerIn
[default_avatar]
so habe deine Rat befolgt und folgende Ausgabe bekommen:

Code: (dl )
1
2
3
4
5
6
7
8
9
suse:~/Desktop/RIP # ./norip.pl
DEBUG: 9999999999, 1.1.1.1
DEBUG: (ping): 0
Net::Telnet::Netscreen=GLOB(0x83b7548) is an [unexpected] object, aborting at ./norip.pl line 55
(in cleanup) Last command and firewall error:
9999999999-> save
save
Unknown Keyword:save at ./norip.pl line 0
suse:~/Desktop/RIP #


Zeile 55 ist übrigens
Code: (dl )
$session->lastPrompt();


ist der Code überhaupt so richtig?

Code: (dl )
1
2
3
4
$session->cmd($command1) or die " Error giving \"set vrouter trust-vr\" command: $!";
$session->lastPrompt();
$session->cmd($command2) or die " Error giving \"unset protocol rip\" command: $!";
$session->lastPrompt();

usw.\n\n

<!--EDIT|krusty|1138364006-->
renee
 2006-01-27 12:45
#62341 #62341
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
statt $! solltest Du besser $session->error verwenden...

hast Du irgendwo noch ein 'save' ohne Anfuehrungszeichen rumliegen??
Hast Du Wiki:use strict und use warnings benutzt??
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
krusty
 2006-01-27 12:48
#62342 #62342
User since
2006-01-27
91 Artikel
BenutzerIn
[default_avatar]
nein hatte ich nicht verwendet. Habe ich jetzt aber und folgende Ausgabe auf der Konsole bekommen.

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
suse:~/Desktop/RIP # ./norip.pl
Global symbol "$host" requires explicit package name at ./norip.pl line 19.
Global symbol "$wan" requires explicit package name at ./norip.pl line 20.
Global symbol "$host" requires explicit package name at ./norip.pl line 21.
Global symbol "$wan" requires explicit package name at ./norip.pl line 21.
Global symbol "$wan" requires explicit package name at ./norip.pl line 22.
Global symbol "$host" requires explicit package name at ./norip.pl line 26.
Global symbol "$wan" requires explicit package name at ./norip.pl line 26.
Global symbol "$host" requires explicit package name at ./norip.pl line 30.
Global symbol "$wan" requires explicit package name at ./norip.pl line 30.
Global symbol "$host" requires explicit package name at ./norip.pl line 39.
Global symbol "$wan" requires explicit package name at ./norip.pl line 39.
Global symbol "$host" requires explicit package name at ./norip.pl line 40.
Global symbol "$wan" requires explicit package name at ./norip.pl line 40.
Global symbol "$wan" requires explicit package name at ./norip.pl line 43.
Global symbol "$command1" requires explicit package name at ./norip.pl line 50.
Global symbol "$command2" requires explicit package name at ./norip.pl line 51.
Global symbol "$command3" requires explicit package name at ./norip.pl line 52.
Global symbol "$command4" requires explicit package name at ./norip.pl line 53.
Global symbol "$command5" requires explicit package name at ./norip.pl line 54.
Global symbol "$command6" requires explicit package name at ./norip.pl line 55.
Global symbol "$command1" requires explicit package name at ./norip.pl line 56.
Global symbol "$command2" requires explicit package name at ./norip.pl line 58.
Global symbol "$command3" requires explicit package name at ./norip.pl line 62.
Global symbol "$command4" requires explicit package name at ./norip.pl line 65.
Global symbol "$command5" requires explicit package name at ./norip.pl line 67.
Global symbol "$command6" requires explicit package name at ./norip.pl line 69.
Execution of ./norip.pl aborted due to compilation errors.
suse:~/Desktop/RIP #


Ein save ohne Anführungszeichen habe ich auch nicht mehr drin.
renee
 2006-01-27 12:50
#62343 #62343
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Wegen dieser Fehlermeldungen hatte ich Dir den Wiki-Artikel verlinkt. Den solltest Du auf jeden Fall mal lesen!
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
krusty
 2006-01-27 12:53
#62344 #62344
User since
2006-01-27
91 Artikel
BenutzerIn
[default_avatar]
bin dabei :D

ich habe aber in meinem Script Variablen die Global gültig sein sollen. Wie werden diese deklariert. Habe ich in dem Wiki nicht gefunden.\n\n

<!--EDIT|krusty|1138359357-->
renee
 2006-01-27 13:00
#62345 #62345
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Was global gueltig sein "muss", schreibst Du am Anfang vom Skript, z.B.
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/perl

use strict;
use warnings;

my $global = "globale Variable";
test();

sub test{
print $global;
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
krusty
 2006-01-27 13:06
#62346 #62346
User since
2006-01-27
91 Artikel
BenutzerIn
[default_avatar]
DANKE, hatte ich gerade im Moment auch herausgefunden. *upps*

Naja, zurück zum eigentlichen Problem. Kann es sein, das das Module Net::Telnet::Netscreen die Option lastprompt nicht kennt. Habe zumindest unter Cpan nichts dergleichen bei dem Modul gefunden. Script läuft jetzt auch wieder mit der letzten Fehlermeldung zu lastprompt durch, bzw. bricht dann halt ab.

Vergiss das was ich gerade geschrieben hatte.
War ein Tippfehler drin.

NICHT: lastPrompt();
SONDERN: last_prompt;

;) ich hasse Tippfehler ;)\n\n

<!--EDIT|krusty|1138360117-->
Crian
 2006-01-27 13:14
#62347 #62347
User since
2003-08-04
5873 Artikel
ModeratorIn
[Homepage]
user image
diese globalen Variablen

a) sparsam (bis gar nicht) verwenden
b) ersten Buchstaben groß schreiben
s--Pevna-;s.([a-z]).chr((ord($1)-84)%26+97).gee; s^([A-Z])^chr((ord($1)-52)%26+65)^gee;print;

use strict; use warnings; Link zu meiner Perlseite
<< |< 1 2 3 >| >> 28 Einträge, 3 Seiten



View all threads created 2006-01-27 10:47.