Sentinel has set up an API for the Node Health Report of Nodes. Using this data, we can indicate via status icon on the node card a ✅︎ if the node passed the integrity checks or an ❌ if the node failed any of the checks.
def GetHealthCheckData(self):
Request = HTTPRequests.MakeRequest(TIMEOUT=2)
http = Request.hadapter()
try:
r = http.get("https://api.health.sentinel.co/v1/records") #specify a constant in konstants.py
data = r.json()
for nodehealthdata in data['result']:
k=0
# integrity check
if nodehealthdata['status'] != 1:
NodeHealth[nodehealthdata['addr']] = False
elif "info_fetch_error " in nodehealthdata:
NodeHealth[nodehealthdata['addr']] = False
elif "config_exchange_error" in nodehealthdata:
NodeHealth[nodehealthdata['addr']] = False
elif "location_fetch_error" in nodehealthdata:
NodeHealth[nodehealthdata['addr']] = False
else:
NodeHealth[nodehealthdata['addr']] = True
except Exception as e:
print(str(e))
This NodeHalth dictionary can be parsed in screens.py and a check for the boolean value can be made in add_rv_data()1288 and a status Icon set to the appropriate indicator.
Sentinel has set up an API for the Node Health Report of Nodes. Using this data, we can indicate via status icon on the node card a ✅︎ if the node passed the integrity checks or an ❌ if the node failed any of the checks.
API: https://api.health.sentinel.co/v1/records
This request should be made by a
GetHealthCheckData()
insentinel.py
about line 158Line https://github.com/MathNodes/meile-gui/blob/c2fecdd76d7755ceef07003c8a65e3ff3b1d8d38/src/cli/sentinel.py#L117 should contain a call to the routine
self.GetHealthCheckData()
Line https://github.com/MathNodes/meile-gui/blob/c2fecdd76d7755ceef07003c8a65e3ff3b1d8d38/src/cli/sentinel.py#L30 should contain an empty dictionary
NodeHealth
which will be populated inGetHealthCheckData()
. The keys ofNodeHealth
will be the sentnode addresses and the value of each key will be boolean.This
NodeHalth
dictionary can be parsed inscreens.py
and a check for the boolean value can be made inadd_rv_data()
1288 and a status Icon set to the appropriate indicator.The Icon will be need to be added to
meile.kv
inRecyclerViewRow
https://github.com/MathNodes/meile-gui/blob/c2fecdd76d7755ceef07003c8a65e3ff3b1d8d38/src/kv/meile.kv#L567 similar to the existing one. It can be made aButton
with icon specified inadd_rv_data()