一个获取远程linux服务器信息的工具
example
code:: python
from Azog.base.exception import HostClientException from Azog import Host
- hosts = [
{‘Address’: ‘192.223.42.25’, ‘Port’: 22, ‘User’: ‘root’, ‘Password’: ‘123456’},
]
if __name__ == ‘__main__’:
- 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())
# sftp h.sftp_get(‘/root/111/2131’, ‘1’) h.sftp_put(‘demo.py’, ‘/root/111/demo.py’)
print(‘*’ * 50)
- except HostClientException as e:
print(e.code, e.message)
- except Exception as e:
print(e)
Metadata
Release files for Azog 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Azog-0.2.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Azog-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / Azog-0.2.tar.gz
| Download URL | Azog-0.2.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4dc8c558edf9afeff7be15763d6867d90fb0c83d47ce112e2f46c2342714367
|
|
BLAKE2b-256 checksum How to use checksums |
0e3c5920fda5dfef5526f6b5db207490da83a35458f36dbb4139834a9073c479
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Release files / Azog-0.2-py3-none-any.whl
| Download URL | Azog-0.2-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
514d168a5150104d790c817299e38f60e6b845e96f42fc9374c8e2920c10cbac
|
|
BLAKE2b-256 checksum How to use checksums |
c96b09509bb6bd7b9c81e65c33c6d5de8f44212acad42585a5087b8a9a721851
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|