EMC DDVE:Python 远程查看告警 alerts show current

# more ddve.py 
#!/usr/bin/python
# -*- coding: utf-8 -*-
# filename: pexpect_test.py

import threading
import paramiko
import subprocess
import sys

ip = "IP地址"
user = "sysadmin"
passwd = "密码"
client = paramiko.SSHClient()

client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(ip,22,username=user,password=passwd)

remote_connection = client.invoke_shell()
output = remote_connection.recv(1000)
print output

remote_connection.send("alerts show current\n");
output = remote_connection.recv(5000)
print output

[root@netman py]# python ddve.py 
Last login: Mon Dec 17 19:19:44 CST 2018 from 10.20.0.202 on gui

alerts show current

[root@netman py]# 
点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注