Python Forum
Paramiko resource shortage error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Paramiko resource shortage error
#1
I want to log into a router from a gateway switch and then pass commands to get the logs of the router

Made a script for the same butting receiving " Paramiko resource shortage error " \

### SCRIPT #### 

import paramiko
import getpass
import time

Host = "199.52.39.1"                                           ## This is the gateway IP 
username = "a2201471-3"
password = "RoXS5f+em9%Tjo="

ssh_client = paramiko.SSHClient()

ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

ssh_client.connect(hostname=Host, username=username, password=password)

print("Successfully Connected\n")

cmd = "Ssh -l gakr_mnsey 10.251.13.241"                    #### This is my username and the router IP

remote_connection = ssh_client.invoke_shell()

stdin, stdout, stderr = ssh_client.exec_command(cmd,get_pty=True) 

stdin.write('4cLs=P2j\n')

stdin.flush()
time.sleep(1)

stdin.write('sh ip bgp summ | b Nei\n')
stdin.flush()

remote_connection.send('sh ip bgp summ | b Nei\n')

print(stdout.read())
time.sleep(1)

ssh_client.close
##### Error ########

Error:
C:\Users\Gautham.Krishna\Desktop>g1.py Seccessfully Connected Secsh channel 1 open FAILED: : Resource shortage Traceback (most recent call last): File "C:\Users\Gautham.Krishna\Desktop\g1.py", line 21, in <module> stdin, stdout, stderr = ssh_client.exec_command(cmd,get_pty=True) File "C:\Users\Gautham.Krishna\AppData\Local\Programs\Python\Python38-32\lib\site-packages\paramiko-2.7.1-py3.8.egg\paramiko\client.py", line 508, in exec_command chan = self._transport.open_session(timeout=timeout) File "C:\Users\Gautham.Krishna\AppData\Local\Programs\Python\Python38-32\lib\site-packages\paramiko-2.7.1-py3.8.egg\paramiko\transport.py", line 875, in open_session return self.open_channel( File "C:\Users\Gautham.Krishna\AppData\Local\Programs\Python\Python38-32\lib\site-packages\paramiko-2.7.1-py3.8.egg\paramiko\transport.py", line 1017, in open_channel raise e paramiko.ssh_exception.ChannelException: ChannelException(4, 'Resource shortage')
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Paramiko Server -- Exception (server): Error reading SSH protocol banner ujlain 3 4,274 Jul-24-2023, 06:52 AM
Last Post: Gribouillis
  Python error handling Paramiko pythondiy 2 21,870 Aug-22-2017, 02:22 AM
Last Post: oldseven

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020