From 02c3f7a18ef80df515452d1c18566c2bd2305fee Mon Sep 17 00:00:00 2001 From: crate Date: Tue, 8 Oct 2024 18:28:29 -0500 Subject: [PATCH] testing --- pve_test.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pve_test.py diff --git a/pve_test.py b/pve_test.py new file mode 100644 index 0000000..a2fb61e --- /dev/null +++ b/pve_test.py @@ -0,0 +1,26 @@ +import config +from proxmoxer import ProxmoxAPI + +pve_host = config.PVE_HOST +pve_user = config.PVE_USER +pve_pass = config.PVE_PASS +pve_node = 'c530' + + +proxmox = ProxmoxAPI(pve_host, user=pve_user, password=pve_pass, verify_ssl=False) + +all_nodes = proxmox.nodes.get() + +def shutdown_pve(): + try: + proxmox.nodes(pve_node).status.shutdown.post() + print("Node is shutting down.") + except Exception as e: + print(e) + +for node in all_nodes: + name = node['node'] + node_status = proxmox.nodes(name).status.get() + print(f"Node {name} Status: {node_status}") + +# shutdown_pve()