feat: add homelab deployment configs, documentation, and automation scripts
This commit is contained in:
15
scripts/test_portainer_key.py
Normal file
15
scripts/test_portainer_key.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import requests
|
||||
import urllib3
|
||||
urllib3.disable_warnings()
|
||||
|
||||
headers = {"X-API-Key": "ptr_TCVm8ujeB4zT0oRejyMCwKw5enaPG/uKj1KuF0uOWX8="}
|
||||
url = "https://140.44.4.71:9443/api/endpoints/3/docker/containers/json?all=1"
|
||||
|
||||
r = requests.get(url, headers=headers, verify=False)
|
||||
print("Portainer containers status:", r.status_code)
|
||||
if r.status_code == 200:
|
||||
data = r.json()
|
||||
running = len([c for c in data if c.get("State") == "running"])
|
||||
stopped = len([c for c in data if c.get("State") == "exited"])
|
||||
print(f"Containers: Running: {running}, Stopped: {stopped}, Total: {len(data)}")
|
||||
|
||||
Reference in New Issue
Block a user