Skip to content
Snippets Groups Projects
Commit 525b8da0 authored by Leonard Penzer's avatar Leonard Penzer
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #127 failed
#!/usr/bin/python3
import json
import netaddr
branch_to_be_checked = "nightly"
def getNodesDownloadedUpdate(access,segments):
updated = []
for line in access.split("\n"):
ipv6 = line.split(" ")[0]
for segment in segments:
if ("Wget" in line or "Gluon Autoupdater (using libuclient)" in line ) and branch_to_be_checked in line and ipv6.startswith("fd21:b4dc:4b%02i"%(segment)) and "gluon-ffs" in line:
#print(line)
if netaddr.IPAddress(ipv6) not in updated:
updated.append(netaddr.IPAddress(ipv6))
return updated
with open("/var/log/nginx/access.log") as fp:
access = fp.read()
with open("/home/www/html/netinfo/json/nodesdb.json") as fp:
data = json.load(fp)
countWaiting = 0
countUpdated = 0
countOfflineAfterUpdate = 0
segmentsWatched = range(1,33)
updated = getNodesDownloadedUpdate(access,segmentsWatched)
release_to_be_watched = "1.6+2019-09-14-g.9f827678-s.5904ca9"
for mac in data:
d = data[mac]
software = d["software"]
branch = d["software"]["autoupdater"]["branch"]
autoupdater_enabled= d["software"]["autoupdater"]["enabled"]
release = d["software"]["firmware"]["release"]
hardware_model = "UNKNOWN"
if "model" in d["hardware"]:
hardware_model = d["hardware"]["model"]
if "addresses" in d["network"]:
addresses = d["network"]["addresses"]
for a in addresses:
if a.startswith("fd21:b4dc:4b"):
ipv6 = netaddr.IPAddress(a)
else:
ipv6 = None
if "segment" in d:
segment = d["segment"]
else:
segment = 0
hasDownloaded = ""
if ipv6 in updated:
hasDownloaded = "UPDATING"
online = d["status"]
for segmentWatched in segmentsWatched:
if segment == segmentWatched and online=="online" and branch == branch_to_be_checked and autoupdater_enabled == True:
if release == release_to_be_watched:
countUpdated+=1
if ipv6 not in updated:
print ("Not expected %s %s %s %s %2i %s"%(mac,online,branch,release,segment,ipv6))
else:
print ("%s %s %s %s %2i %s %s %s"%(mac,online,branch,release,segment,ipv6,hardware_model,hasDownloaded))
countWaiting+=1
if segment == segmentWatched and online!="online" and release != release_to_be_watched and branch == branch_to_be_checked and autoupdater_enabled == True and ipv6 in updated:
print ("!!!! %s %s %s %s %2i %s %s"%(mac,online,branch,release,segment,ipv6,hasDownloaded))
countOfflineAfterUpdate+=1
print("Waiting: %i"%countWaiting)
print("Updated: %i"%countUpdated)
print("Offline after Update: %i"%countOfflineAfterUpdate)
print("Downloads: %i"%(len(updated)))
print("Sum: %i"%(countWaiting+countUpdated))
#for u in updated:
# print(u)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment