srv/poe_manager/app.py aktualisiert
This commit is contained in:
@@ -104,9 +104,13 @@ def index():
|
||||
latest_log = max(log_files, key=os.path.getctime)
|
||||
with open(latest_log, "r") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
for dev in devices:
|
||||
if dev[1] in line:
|
||||
status_dict[dev[0]] = "online" if "erreichbar" in line else "offline"
|
||||
# exakte Prüfung, Name gefolgt von 'ist erreichbar!' oder 'ist nicht erreichbar!'
|
||||
if line.startswith(f"{dev[1]} ist erreichbar!"):
|
||||
status_dict[dev[0]] = "online"
|
||||
elif line.startswith(f"{dev[1]} ist nicht erreichbar!"):
|
||||
status_dict[dev[0]] = "offline"
|
||||
|
||||
# Template rendern mit Devices, Status und Intervall
|
||||
return render_template("index.html", devices=devices, status=status_dict, interval=interval)
|
||||
|
||||
Reference in New Issue
Block a user