27 lines
493 B
Python
27 lines
493 B
Python
|
|
## Requires NUT2 from PIP
|
|
from nut2 import PyNUTClient
|
|
import os
|
|
|
|
# hostList = os.environ["hosts"]
|
|
# hostList = hostList.split(",")
|
|
|
|
|
|
# host
|
|
hostList = ['10.0.5.2', '10.0.5.181']
|
|
|
|
test = []
|
|
|
|
## pull all the UPSes froom each host
|
|
for host in hostList:
|
|
input(host)
|
|
client = PyNUTClient(host, '3493')
|
|
for UPS in client.list_ups():
|
|
test.append(str(UPS))
|
|
|
|
print(test)
|
|
|
|
# client = PyNUTClient('10.0.5.2', '3493')
|
|
|
|
# print(client.list_ups())
|
|
# print(client.list_vars("Net-UPS1")) |