-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
45 lines (43 loc) · 1.55 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from Azog.base.exception import HostClientException
from Azog import Host
hosts = [
{'Address': '192.223.42.25', 'Port': 22, 'User': 'root', 'Password': 'donotuseroot!'},
# {'Address': '194.156.224.51', 'Port': 22, 'User': 'root', 'Password': 'Maijia123..'},
]
if __name__ == '__main__':
for i in hosts:
try:
h = Host(i)
h.sftp_get('/root/111/2131', '1')
h.sftp_put('demo.py', '/root/111/demo.py')
except Exception as e:
print(e)
# for i in hosts:
# try:
# h = Host(i)
# # system
# print(h.sys_info.get_uptime())
# print(h.sys_info.get_load())
# print(h.sys_info.get_kernel())
# print(h.sys_info.get_release())
# print(h.sys_info.get_architecture())
# # cpu
# print(h.cpu_info.get_cpu_name())
# print(h.cpu_info.get_cpu_cores())
# print(h.cpu_info.get_cpu_freq())
# print(h.cpu_info.get_cpu_core_cache())
# # ram
# print(h.ram_info.get_total_ram())
# print(h.ram_info.get_use_ram())
# print(h.ram_info.get_buff_ram())
# print(h.ram_info.get_total_swap())
# print(h.ram_info.get_use_swap())
# # disk
# print(h.disk_info.get_total_disk())
# print(h.disk_info.get_use_disk())
#
# print('*' * 50)
# except HostClientException as e:
# print(e.code, e.message)
# except Exception as e:
# print(e)