11 lines
489 B
Python
11 lines
489 B
Python
import paramiko
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect('140.44.4.41', username='root', password='dietpi', timeout=10)
|
|
_, o, _ = c.exec_command("kubectl create token prometheus-scraper -n kube-system --duration=87600h")
|
|
token = o.read().decode().strip()
|
|
_, o2, e = c.exec_command(f"curl -sk -H 'Authorization: Bearer {token}' https://140.44.4.41:10250/metrics/cadvisor | head -10")
|
|
print("Head:\n", o2.read().decode().strip())
|
|
c.close()
|