Template reload following reboot. **solved**

All about the standard Meteobridge devices based on mobile routers from TP-Link, D-Link, ASUS

Moderator: Mattk

Post Reply
stevem
Senior Boarder
Senior Boarder
Posts: 41
Joined: Mon Sep 21, 2015 10:38 am

Template reload following reboot. **solved**

Post by stevem »

Hi,

I wonder if you could tell me if the meteobridge (mr3020) is designed to retry loading templates if the initial load fails when it is restarted?

The reason I’m asking is this am the power failed at my site. Everything came back online after 30 mins and looked good except the FTP service file being uploaded by the meteobridge to my weather site (a local web server) was empty and as a consequence the web site displayed no current data. The meteobridge was uploading a file but is was zero length. I could access the template file fine from my browser but the meteobridge didn’t appear to be able to do so or if it was able wasn’t processing it. The fix was to manually reload the template using the button on the service definition panel. As soon as I did this everything came right.

In the past I have had a laptop running small web and FTP servers to host the meteobridge template and the web site. I’ve recently ported this configuration to a raspi to reduce the 24x7 power usage. The new raspi doesn’t have any backup battery (unlike the laptop) and as a consequence in a power fail situation it to will fail also. The raspi is booting off a USB 1TB hard drive and restarting is not instant. It may take an extended period following a crash shutdown if the hard drive is dirty.

I’m thinking my problem might be that the meteobridge is coming back on-line (100mb/sec fibre so it loads quickly) before the ftp server holding the FTP service template is on-line. This wouldn’t be an issue if the meteobridge kept trying to load a template if the initial load failed. Which brings me back to me question... does the meteobridge try repeatedly to load templates on restart or try once and then give up?

Any thoughts would be most appreciated.

Rgds Steve

Mattk
Platinum Boarder
Platinum Boarder
Posts: 885
Joined: Mon Sep 22, 2014 3:24 am

Re: Template reload following reboot

Post by Mattk »

Latency on boot up can be a problem and not sure if the MR3020 latest version supports the Boot Delay option intended to let the router fully boot before the MB tries and connects. This has been at least an MBPro feature since Feb 2017 Ver 3.2+

User avatar
wvdkuil
Platinum Boarder
Platinum Boarder
Posts: 514
Joined: Sun Jul 24, 2011 8:00 pm
Location: Belgium
Contact:

Re: Template reload following reboot

Post by wvdkuil »

Mattk wrote:
Sun Jan 17, 2021 11:17 am
Latency on boot up can be a problem and not sure if the MR3020 latest version supports the Boot Delay option intended to let the router fully boot before the MB tries and connects. This has been at least an MBPro feature since Feb 2017 Ver 3.2+
But that would not help in this case as the template files are on a "slow starting" local-server,
stevem wrote:
Sun Jan 17, 2021 10:10 am
The raspi is booting off a USB 1TB hard drive and restarting is not instant.
It may take an extended period following a crash shutdown if the hard drive is dirty.
The best solution would be to move the meteoridge to another raspi which makes it possible to store all template files on the Meteobridge-device.

Wim
Support for Leuven-Template & Scripts at https://support.leuven-template.eu/
Support for the PWS_Dashboard (HWS-template) https://pwsdashboard.com/

stevem
Senior Boarder
Senior Boarder
Posts: 41
Joined: Mon Sep 21, 2015 10:38 am

Re: Template reload following reboot

Post by stevem »

Thanks both of you.

I’m assuming based on you replies that the metrobridge does NOT attempt to re-try loading templates on restart.

Is there any chance this feature could be added? It would seem to be something that would add general robustness in many different use cases.

Rgds

Mattk
Platinum Boarder
Platinum Boarder
Posts: 885
Joined: Mon Sep 22, 2014 3:24 am

Re: Template reload following reboot

Post by Mattk »

wvdkuil wrote:
Sun Jan 17, 2021 11:34 am
Mattk wrote:
Sun Jan 17, 2021 11:17 am
Latency on boot up can be a problem and not sure if the MR3020 latest version supports the Boot Delay option intended to let the router fully boot before the MB tries and connects. This has been at least an MBPro feature since Feb 2017 Ver 3.2+
But that would not help in this case as the template files are on a "slow starting" local-server,

Wim
Wim, Not sure I understand your reasoning? The problem reads that if power is returned and all begin to start up then some devices will complete boot then try and connect devices that are still booting? Fail then won't try again?

If the MB tries to connect before the reliant systems are fully running then the MB my not re-try? But if all the other devices are allowed to fully start first, then the MB is started then all should be good? Time delay on the MB does exactly this.

stevem
Senior Boarder
Senior Boarder
Posts: 41
Joined: Mon Sep 21, 2015 10:38 am

Re: Template reload following reboot

Post by stevem »

thanks for the comments

In my 40 years in IT I've learnt that systems of of components that rely on particular start orders or wait times in the end are problematic. If you can get to a point where any individual component can be restarted or upgraded without then having to restart related components or worry about lost data life is much calmer and you get far more sleep. That's one reason the old VP2-datalogger-weatherlink app worked so well. You could reboot the windows system without any loss of data. If weatherlink was down, even for days, the data piled up in the logger but was it never lost. When weatherlink came back on-line the data in the logger was processed and the historical database showed no sign of the outage.

There is no wait time in meteobridge (mr3020) I can see so I'm not seeing an easy option, even if it is suboptimal, to my immediate problem.

The best option would be for the meteobridge to keep trying to reload a configured template if it doesn't load just like the meteobridge repeatedly tries to upload weather data if that process fails. I'd suggest an initial wait time of 30 seconds, which doubled on each iteration up to a maximum of say 60 minutes.

Is there any chance of this enhancement?

Rgds Steve

User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 6631
Joined: Mon Oct 01, 2007 10:51 pm

Re: Template reload following reboot

Post by admin »

There is no plan to add more clutter to processes by repeating load of templates.

If any edge-case does need it, feel free to write a shell script for this and to call this to your liking.

stevem
Senior Boarder
Senior Boarder
Posts: 41
Joined: Mon Sep 21, 2015 10:38 am

Re: Template reload following reboot

Post by stevem »

It all seems a little inconsistent to me. Even if the template was hosted on a win10 laptop its recovery could be stalled by a win10 upgrade. And the only fix is manual intervention.

I can see this hasn't been a common problem in the past because with slower internet connections the meteobridge bootstrap process would always take an extended time. With faster connections and FTTH common the meteobridge will more often be first up and this situation will be more common.

As things stand your status page shows all green ticks on the upload status even though the template didn't load and ftp is pumping out a zero length file. Most confusing. Should this be classified as a bug?

Andyk1
Expert Boarder
Expert Boarder
Posts: 80
Joined: Fri Jan 05, 2018 1:14 am
Location: Oklahoma, USA
Contact:

Re: Template reload following reboot

Post by Andyk1 »

I recently brought this for my Rpi-4B and it does work. Provides approx. 10 hours of backup time.

https://www.amazon.com/gp/product/B07Y2 ... UTF8&psc=1
Image

stevem
Senior Boarder
Senior Boarder
Posts: 41
Joined: Mon Sep 21, 2015 10:38 am

Re: Template reload following reboot

Post by stevem »

Nice option. Thanks.

I have been looking at a ups option that will support 2x Raspi, the meteobridge, 3 Poe cameras, a switch, a router, and the telco fibre termination device. And then there are smart home devices that might be added. I can see in the future some sort of reliable power device and wiring will be a standard feature of new homes.

That said, even with reliable power devices need to be able to restart and recover independently or the whole thing becomes unmanageable.

Rgds

Andyk1
Expert Boarder
Expert Boarder
Posts: 80
Joined: Fri Jan 05, 2018 1:14 am
Location: Oklahoma, USA
Contact:

Re: Template reload following reboot

Post by Andyk1 »

stevem wrote:
Tue Jan 19, 2021 10:26 pm
Nice option. Thanks.

I have been looking at a ups option that will support 2x Raspi, the meteobridge, 3 Poe cameras, a switch, a router, and the telco fibre termination device. And then there are smart home devices that might be added. I can see in the future some sort of reliable power device and wiring will be a standard feature of new homes.

That said, even with reliable power devices need to be able to restart and recover independently or the whole thing becomes unmanageable.

Rgds
I Live in the county side of Oklahoma. We have frequent power outages here. Every sensitive electronic device is on a UPS. Cable Moden and routers are on there own providing power for at least 4 hours... My weather station again is on the UPS I mentioned with the Ecowitt GW1000 plugged into the Rpi-4 for extra back-up. If power is out for more than an hour I fire up one of the 4 generators we now have 1 being diesel for longer-term outages. ... that's how bad our electrical supply is here.
Image

stevem
Senior Boarder
Senior Boarder
Posts: 41
Joined: Mon Sep 21, 2015 10:38 am

Re: Template reload following reboot

Post by stevem »

This site is at a beach in New Zealand, unattended most of the time, and fed by a non-redundant mains supply. We have an outage every couple of months either because the power company decide to do maintenance or some idiot drives their car into a pole. I'll have to get something. A tesla powerwall would be nice :-) Rgds Steve

User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 6631
Joined: Mon Oct 01, 2007 10:51 pm

Re: Template reload following reboot

Post by admin »

Just released update will retry on template loads after reboot, when it does not work on first try.

stevem
Senior Boarder
Senior Boarder
Posts: 41
Joined: Mon Sep 21, 2015 10:38 am

Re: Template reload following reboot. **solved**

Post by stevem »

Many thanks. I’m sure this will be of assistance to many over time.
Rgds
Steve

stevem
Senior Boarder
Senior Boarder
Posts: 41
Joined: Mon Sep 21, 2015 10:38 am

Re: Template reload following reboot. **solved**

Post by stevem »

Hi Admin,

Something is not right with this fix. I have just had the situation occur again with a second site.

The power failed.
Following the power fail a web site that relies on a template formatted json file ftp'd to it by the meteobridge fails
On inspection the web site is repeatedly receiving a zero byte file. Both the web site (which also holds the meteobridge template) and ftp server are running fine.
The meteobridge admin pages show all uploads are working correctly (green tick) including the templated FTP item at issue
The issue is resolved by refreshing the template on the meteobridge (an MR3020) by pressing the button provided.
I conclude that for some reason the template did not load correctly or for some reason it has been lost within the meteobridge.

Is it possible to refresh templates automatically every 24 hrs and also when the output of the template process is zero length?

Regards
Steve

Post Reply