Hi,
If you have the IP of backup RE, you can connect to Backup RE and call the rpc (get-system-core-dumps) to give you the details of core dumps.
Also you can use SCP util module to transfer the file
https://github.com/vnitinv/pyez-examples/blob/master/12_utils_scp.py
If you don’t have IP of the bacup RE, you can use StartShell utils to login onto backup RE (from master) and run the commands.
with StartShell(dev) as ss:
if ss.run('cli', '> ')[0]:
if ss.run('request routing-engine login other-routing-engine', '> ')[0]:
print 'logged into other re'
data = ss.run(“show system core-dumps”, '> ')
print data
Thanks
Nitin Kr
CONFIDENTIALITY NOTE: The information transmitted, including attachments, is intended only for the person(s) or entity
to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information and email by person(s) or entity other than the intended
recipient is prohibited. If you received this in error, please contact the sender and destroy any copies of the information. Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus transmitted by this email. Email transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or
contain viruses. The sender and company therefore do not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission.
--
You received this message because you are subscribed to the Google Groups "Junos Python EZ" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
junos-python-...@googlegroups.com.
Visit this group at https://groups.google.com/group/junos-python-ez.
To view this discussion on the web visit
https://groups.google.com/d/msgid/junos-python-ez/6db4bb60-067f-4604-bb16-800dddb9cead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi,
IP of the backup RE is not available based on the requirements I need to code on. L The below set of codes works but I cant find any means extract out the “paths” of the core dumps in order to run the scp to the master RE.
Tried to use re.match but not workable. If there is a means to properly “dissect” the data out, this could properly work.
Hi,
Re.search does not work out well too sadly. I guess that’s because apart from pyez, the whole output comes in a whole set rather than per line.
Trying to figure it out. If there is a way to know what is the various core-dumps available on the backup RE, there should be a way to scp it from backup RE to master RE so to scp it out to the server for troubleshooting purposes. J
CODE
with StartShell(deve) as ss:
if ss.run('cli','>'):
if ss.run('request routing-engine login other-routing-engine'):
data = ss.run("show system core-dumps")
for a in data:
a = str(a)
if re.search("No such file",a):
print a
print "Break"
OUTPUT
show system core-dumps
-rwxrwxrwx 1 root wheel 269 Dec 14 18:51 /var/crash/TTKjamescoreTTK.txt*
/var/tmp/*core*: No such file or directory
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
total files: 1
Thanks & Regards,
Bing Zhong (Zack)
Telephone: +65 63800216
Nera Telecommunications Ltd
109 Defu Lane 10 Singapore 539225
Hi Bing,
You can use rpc way to collect data from Backup re also and then parse xml object for the data.
from jnpr.junos import Device
from lxml import etree
dev = Device(host="xxxx", user="xxxx", password="xxxx”)
dev.open()
op = dev.rpc.get_system_core_dumps(routing_engine='backup')
print etree.tostring(op)
StartShell code too work fine for me with latest code:
with StartShell(dev) as ss:
if ss.run('cli', '>'):
if ss.run('request routing-engine login other-routing-engine'):
data = ss.run("show system core-dumps", "> ")[1] # ss.run return something like (True, 'dataaaaaa')
for line in data.splitlines():
if re.search('No such file', line):
print line
Thanks
Nitin Kr