| 主機參考:VPS測評參考推薦/專注分享VPS服務器優(yōu)惠信息!若您是商家可以在本站進行投稿,查看詳情!此外我們還提供軟文收錄、PayPal代付、廣告贊助等服務,查看詳情! |
| 我們發(fā)布的部分優(yōu)惠活動文章可能存在時效性,購買時建議在本站搜索商家名稱可查看相關文章充分了解該商家!若非中文頁面可使用Edge瀏覽器同步翻譯!PayPal代付/收錄合作 |
利用Python腳本登錄交換機實現(xiàn)自動配置備份的方法有哪些?下面跟著小編一起來看看吧。
一、Python腳本
ssh = paramiko.SSHClient()ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())ssh.connect("10.x.x.x", 22,"用戶名","密碼",allow_agent=False,look_for_keys=False)
command = 'sh running-config r '
stdin, stdout, stderr = ssh.exec_command(command)#stdin, stdout, stderr = ssh.invoke_shell(command)a=[]result = stdout.readlines()
if not result:result = stderr.read()
backup=open("/root/worke/beifen/beifen.txt","w")
for line in result:print(line)backup.write(line)
backup.close()ssh.close()
看完上文,你對利用Python腳本登錄交換機實現(xiàn)自動配置備份的方法大概了解了嗎?如果想了解更多,歡迎關注主機參考行業(yè)資訊頻道哦
What are the methods to automatically configure backup by using Python script to log in switch? Let's follow Xiaobian to have a look.
1、 Python script
SSH = paramiko. Sshclient(), SSH. Set 58853; missing host key policy (paramiko. Autoaddpolicy()), SSH. Connect ("10. X.x.x", 22, "user name", "password", allow agent = false, look for keys = false)
command = 'sh running-config r '
stdin, stdout, stderr = ssh.exec_command(command)#stdin, stdout, stderr = ssh.invoke_shell(command)a=[]result = stdout.readlines()
if not result:result = stderr.read()
backup=open("/root/worke/beifen/beifen.txt","w")
for line in result:print(line)backup.write(line)
backup.close()ssh.close()
After reading the above, do you have a general idea of how to use Python script to log in to the switch to automatically configure the backup? If you want to learn more, please pay attention to the host reference industry information channel
--------------------------------------------------------------
主機參考,收集國內外VPS,VPS測評,主機測評,云服務器,虛擬主機,獨立服務器,國內外服務器,高性價比建站主機相關優(yōu)惠信息@www.k2270.com
詳細介紹和測評國外VPS主機,云服務器,國外服務器,國外主機的相關優(yōu)惠信息,商家背景,網(wǎng)絡帶寬等等,也是目前國內最好的主機云服務器VPS參考測評資訊優(yōu)惠信息分享平臺
這幾篇文章你可能也喜歡:
- PacificRack,黑色星期五特別優(yōu)惠,美國便宜VPS云服務器低至1折,美國洛杉磯QN自營機房,KVM虛擬架構,2核4G內存100Mbps帶寬,僅15美元/年,約1.25美元/月
- ZJI,雙十二特價優(yōu)惠活動,香港免備案獨立服務器5.5折,阿里云CN2專線,雙線雙IP,E5-2630L(6核12線程)處理器16G內存5Mbps CN2+BGP帶寬,412.5元/月
- #實時更新#最新2021年主機商雙十一活動匯總,國內外VPS主機商雙11促銷優(yōu)惠活動匯總,海外免備案VPS云服務器/獨立服務器超大帶寬不限流量雙11活動
- ZJI,雙十一特價優(yōu)惠,自營免備案香港獨立服務器/獨服一律55折,香港阿里云專線/BGP,Intel E5-2630L處理器16G內存5Mbps帶寬CN2+BGP阿里云專線,412元/月
- ZJI,香港葵灣獨立服務器/物理服務器特價優(yōu)惠,終身55折循環(huán)優(yōu)惠,CN2+BGP線路,E5-2630L處理器16G內存15Mbps帶寬,522.5元/月
本文由主機參考刊發(fā),轉載請注明:利用Python腳本登錄交換機實現(xiàn)自動配置備份的方法 http://www.k2270.com/12707.html
主機參考

















評論前必須登錄!
注冊