Files

21 lines
600 B
Python
Raw Permalink Normal View History

import asyncio
import asyncssh
import sys
sys.path.insert(0, r"C:/Users/dimir/proects/debian-manager")
async def main():
from app.core.ssh import SSHClient
from app.core.monitor import _METRICS_CMD
from app.db.models import Server
srv = Server(id=1, name="t", host="132.243.17.164", port=2292,
username="dimon", password="123456789987654321")
async with SSHClient(srv) as c:
r = await c.run(_METRICS_CMD, timeout=30)
print("STDOUT:")
print(r.stdout)
if r.stderr:
print("STDERR:", r.stderr[:500])
asyncio.run(main())