import paramiko
def check_disk_mounted(host, port, username, password):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, port, username, password)
stdin, stdout, stderr = ssh.exec_command("df -h")
output = stdout.read().decode()
lines = output.split("
")
for line in lines:
if "/dev/" in line and "Mounted on" in line:
print(line)
ssh.close()
# 请将以下参数替换为实际的远程服务器信息
host = "example.com"
port = 22
username = "your_username"
password = "your_password"
check_disk_mounted(host, port, username, password)
06-09
2641
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)