smartmeter icon indicating copy to clipboard operation
smartmeter copied to clipboard

Wenn Server nicht erreichbar hängt sich Skript auf

Open Hofei90 opened this issue 5 years ago • 2 comments

Ist der Server nicht erreichbar hängt sich das Skript auf, dass keine weiteren Werte mehr erfasst werden.

Apr 01 10:44:15 raspberrypi smartmeter[6423]: INFO: Durchlaufdauer: 0:00:05.844594 Apr 01 10:44:15 raspberrypi smartmeter[6423]: INFO: Messdauer: 0:00:05.732574 Apr 01 10:44:06 raspberrypi smartmeter[6423]: INFO: Durchlaufdauer: 0:00:07.502115 Apr 01 10:44:06 raspberrypi smartmeter[6423]: INFO: DB Dauer schreiben: 0:00:00.110540 Apr 01 10:44:06 raspberrypi python3[6423]: </html> Apr 01 10:44:06 raspberrypi python3[6423]: </body> Apr 01 10:44:06 raspberrypi python3[6423]: <hr><center>nginx</center> Apr 01 10:44:06 raspberrypi python3[6423]: <center><h1>502 Bad Gateway</h1></center> Apr 01 10:44:06 raspberrypi python3[6423]: <body> Apr 01 10:44:06 raspberrypi python3[6423]: <head><title>502 Bad Gateway</title></head> Apr 01 10:44:06 raspberrypi python3[6423]: <html> Apr 01 10:44:06 raspberrypi python3[6423]: 502 Apr 01 10:44:06 raspberrypi python3[6423]: [{"ts": "2020-04-01 10:43:04", "spannung_l1": 231.1787, "spannung_l2": 231.2233, "spannung_l3": 231.3556, "strom_l1": 1.9614, "strom_l2": 1.152, "strom_l3": 0.743 Apr 01 10:44:06 raspberrypi python3[6423]: </html> Apr 01 10:44:06 raspberrypi python3[6423]: </body> Apr 01 10:44:06 raspberrypi python3[6423]: <hr><center>nginx</center> Apr 01 10:44:06 raspberrypi python3[6423]: <center><h1>502 Bad Gateway</h1></center> Apr 01 10:44:06 raspberrypi python3[6423]: <body> Apr 01 10:44:06 raspberrypi python3[6423]: <head><title>502 Bad Gateway</title></head> Apr 01 10:44:06 raspberrypi python3[6423]: <html> Apr 01 10:44:06 raspberrypi python3[6423]: 502

  • [ ] Bei Fehler Werte Zwischenspeichern (Auswahl für Pfad und Anzahl schaffen)

  • [ ] Verbindung neu initisalisieren

Hofei90 avatar Apr 01 '20 09:04 Hofei90

Alternative Lösungsmöglichkeit:

Wenn die Verbindung nicht möglich ist, Skript bei r.status_code = 502 abbrechen und Fehler über den Service abfangen

RemainAfterExit=no
Restart=on-failure
RestartSec=5s

SPertl avatar Apr 04 '20 09:04 SPertl

Gerade bei Postgrest verstehe ich nicht, warum es überhaupt Probleme gibt. Das ist ein URL Aufruf der Schief geht, dann müssten doch eigentlich nur die aktuell beinhalten Daten verloren gehen und das Skript im normalen Zyklus weiter arbeiten. Da kann ich den Fehler noch nicht wirklich ansehen.

Natürlich bietet sich dein Alternativvorschlag an, wär trotzdem schön zu wissen was die eigentliche Ursache des Problemes ist.

Hofei90 avatar Oct 09 '20 10:10 Hofei90