How would one go about navigating a numeric menu? #3407
Wipfli-I3T-networking
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have some old APC 7900 and 7901 PDUs, very old ones, we also have new ones that use normal commands, but not these. The problem is that they use a numeric menu, 1 for this, 2 for that, 3 for this other area, etc. And Escape to go back. The problem I'm having is getting Netmiko to communicate with this system. I've been using send_command_timing() but I'm having some issues getting the PDU to accept these commands. In my standard SSH I have to do the following once I authenticate. 1[enter]2[enter]1[enter] (I'll just write it like most of us read this as 1\n2\n1\n from now on) this gets me to the first thing I need to capture in the output. Then [esc][esc][esc]3\n7\n\n\n\n gets me to the second screen I need to capture output from, and finally [esc]4\n logs out.
So I've tried:
send_command_timing('1', last_read=5, read_timeout=15)
send_command_timing('2', last_read=5, read_timeout=15)
send_command_timing('1', last_read=5, read_timeout=15)
and
send_command_timing('1\n', last_read=5, read_timeout=15)
send_command_timing('2\n', last_read=5, read_timeout=15)
send_command_timing('1\n', last_read=5, read_timeout=15)
and
send_command_timing('1\n2\n1\n', last_read=5, read_timeout=15)
and even
send_command_timing(r'1', last_read=5, read_timeout=15)
and
send_command_timing(r'1\n', last_read=5, read_timeout=15)
but nothing seems to get the 2nd page of the menu, much less past it to the parts I need to reach.
If I enable debug I get this (I assume this is the important stuff)
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (password) successful!
DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes
DEBUG:paramiko.transport:[chan 0] Max packet out: 4096 bytes
DEBUG:paramiko.transport:Secsh channel 0 opened.
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
American Power Conversion Network Management Card AOS v3.9.4
(c) Copyright 2009 All Rights Reserved Rack PDU APP v3.9.3
Name : BDF11-PDU4 Date : 03/21/2024
Contact : Unknown Time : 22:42:37
Location : Bed User : Administrator
Up Time : 8 Days 2 Hours 56 Minutes Stat : P+ N+ A+
Switched Rack PDU: Communication Established
------- Control Console -------------------------------------------------------
DEBUG:netmiko:read_channel:
DEBUG:netmiko:[find_prompt()]: prompt is >
DEBUG:netmiko:write_channel: b'1\n2\n1\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel: 12
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
Here is the connect handler config and netmiko_session_log.txt output.
{
'device_type': 'generic',
'ip': '10.X.X.23',
'username': '',
'password': '',
'banner_timeout': 30,
'conn_timeout': 30,
'session_log': 'netmiko_session_log.txt'
}
American Power Conversion Network Management Card AOS v3.9.4
(c) Copyright 2009 All Rights Reserved Rack PDU APP v3.9.3
Name : BDF11-PDU4 Date : 03/21/2024
Contact : Unknown Time : 22:42:37
Location : Bed User : Administrator
Up Time : 8 Days 2 Hours 56 Minutes Stat : P+ N+ A+
Switched Rack PDU: Communication Established
------- Control Console -------------------------------------------------------
read_channel_timing's absolute timer expired.
The network device was continually outputting data for longer than 15
seconds.
If this is expected i.e. the command you are executing is continually emitting
data for a long period of time, then you can set 'read_timeout=x' seconds. If
you want Netmiko to keep reading indefinitely (i.e. to only stop when there is
no new data), then you can set 'read_timeout=0'.
You can look at the Netmiko session_log or debug log for more information.
but it never gets to the second page. It doesn't matter which way I try to do it. Maybe I'm just doing it all wrong. I'm no Netmiko expert by any means. I've used it for the last couple of years to scrape aruba switches mostly. Things that are best done via SSH. So I figured since I can SSH into these PDUs, and since it's all just commands, and since Netmiko so far has taken everything I've thrown at it and just worked, that this would too. I've tried to use the docs, and forums, and all the info I can find to figure this out on my own. But I've hit a wall. I'm hoping you know what I'm doing wrong.
I'm happy to provide any additional info you think would be helpful.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions