mirror of
https://github.com/andrey271192/vps_monitoring.git
synced 2026-09-20 11:55:34 +00:00
fix(keenetic): preserve URL scheme/ports and IPv4 polling
Use web_url scheme and host:port for API base URL instead of forcing https. Force IPv4 in aiohttp to avoid IPv6 hangs on KeenDNS. Sync canonical 24-router list with Russian names. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
48
scripts/quick_auth_check.py
Normal file
48
scripts/quick_auth_check.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fast auth-only check for all routers (no RCI batch)."""
|
||||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
from server.services.keenetic_client import KeeneticClient
|
||||
|
||||
DATA = Path("/opt/vps-monitoring/data/keenetic.json")
|
||||
|
||||
|
||||
async def one(dev):
|
||||
c = KeeneticClient(
|
||||
host=dev.get("host", ""),
|
||||
login=dev.get("login", "admin"),
|
||||
password=dev.get("password", ""),
|
||||
web_url=dev.get("web_url", ""),
|
||||
)
|
||||
try:
|
||||
ok = await c.authenticate()
|
||||
if ok:
|
||||
return "ONLINE"
|
||||
return f"OFFLINE: {c.last_error}"
|
||||
except Exception as e:
|
||||
return f"ERR: {e}"
|
||||
finally:
|
||||
await c.close()
|
||||
|
||||
|
||||
async def main():
|
||||
with open(DATA) as f:
|
||||
devices = json.load(f)
|
||||
online = 0
|
||||
for d in devices:
|
||||
r = await one(d)
|
||||
if r == "ONLINE":
|
||||
online += 1
|
||||
name = d["name"]
|
||||
url = d.get("web_url", "")
|
||||
print(f"{name:28} {r:40} {url}")
|
||||
await asyncio.sleep(0.3)
|
||||
print(f"\nTotal: {online}/{len(devices)} ONLINE")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user