Off Line Notification

nineback
Advisor
Advisor
Posts: 73
Joined: Thu Aug 24, 2017 11:12 am
Location: Alabama
Station model: Davis Pro2
Software: WeeWX
Contact:

Off Line Notification

Post by nineback » Tue Nov 14, 2017 2:48 am

Is there a way to be notified when the template stops receiving data from the weather station? Occasionally my program stops sending data and the only way I know about it is when Weather Underground sends me an email message.

Tom

nineback
Advisor
Advisor
Posts: 73
Joined: Thu Aug 24, 2017 11:12 am
Location: Alabama
Station model: Davis Pro2
Software: WeeWX
Contact:

Re: Off Line Notification

Post by nineback » Fri Nov 17, 2017 3:07 am

Posted 3 days ago and no reply. Anyone have an idea on this?

Tom

User avatar
dmgould
Forecaster
Forecaster
Posts: 173
Joined: Sat Aug 26, 2017 2:43 am
Location: Divide, Colorado, USA
Station model: Davis Pro 2 Plus Wireless
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by dmgould » Fri Nov 17, 2017 3:51 am

I don't know anything about Weather Display software. If it requires a computer to be running I can relate. In the past I used Virtual Weather Station which required a computer running for page and data updates. If anything in the program froze the data stopped. Generally I also found out via a WU email. Ultimately I installed a program that monitored a VWS freeze and it automatically rebooted the program. It was a great solution. Unfortunately I can't remember the name of that program, but it worked great. If it comes to me I'll let you know. Don't know if this helps but it is what it is.
Dave G
Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Fri Nov 17, 2017 10:42 am

Hi,
it is technically not possible due to the nature of how the API works, or rather I should say not impossible, but technically too problematic and complicated that users would struggle to set this up.
First thing you need to know is that in order to do this you would need a script that periodically checks your station is online. The only script that is periodically run is the update script, the api.php. However, you cannot check functionality of something by the very same thing. Its like my ISP provider.... they dont have a phone and when my internet at home does not work, Im supposed to inform them by email.... nice... :D
So first problem is that you would need an external CRON job to do this. Software such as WD, MB etc. only triggers the api.php when there is new data available, so it simply wont run when your station is offline and you wont get any email. Setting up a CRON job is a problem. Especially if it is external. People struggle with understanding the concept of it, I was so happy when I got rid of it in v11 thanks to the API. People using Cumulus and WL and WU still need it, and it is in 80% the first thing they ask because they get stuck. So I dont want re-introducing CRON jobs. They are in some plugins, but those are optional.
Second problem, even the above solution would not solve this problem. If your website was also down, you would need a second server that would be checking it, again, it cannot be the same server because if it is not working, it would also not check anything and not email anything. Pages like WU obviously can do this because their webpage has many CRON jobs and they have many servers.

So if you want to do it, you would have to create a script that checks the latest record in the db, then set up the mail function if it is offline, have a CRON job run this script periodically, independent of the api.php and ideally place it on a different server, not the one where you have the template.

nineback
Advisor
Advisor
Posts: 73
Joined: Thu Aug 24, 2017 11:12 am
Location: Alabama
Station model: Davis Pro2
Software: WeeWX
Contact:

Re: Off Line Notification

Post by nineback » Fri Nov 17, 2017 12:00 pm

Thanks for the replies. I thought I noticed before that the Template would show Off-Line if it was not receiving data? The Template must be monitoring something and triggering this. Why could we not receive an email when the status changes to Off-Line?

On my main page I currently see two locations that are indicating ONLINE . One is in the FOOTER and one is in the Station Status block. The Station Status even tells the date and duration of the outages. Again I assume these are real-time indications of station status.

Tom

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Fri Nov 17, 2017 12:24 pm

Hi,
yes, but the problem is that when you see that in the footer, it is because you just "ran the script" by visiting the page. It is not monitored anywhere in the background. So tying it with this homepage script would mean that for example, if your station went offline at 2AM and no-one visited your homepage until 7AM, you would not get any email until then and if it went back online at 5AM, you would never get any email.
For this to work reliably you need a CRON job, hoping someone will visit your page every say 20-30mins is not an ideal solution.

nineback
Advisor
Advisor
Posts: 73
Joined: Thu Aug 24, 2017 11:12 am
Location: Alabama
Station model: Davis Pro2
Software: WeeWX
Contact:

Re: Off Line Notification

Post by nineback » Fri Nov 17, 2017 12:31 pm

Roger all. Thanks again.

Tom

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Fri Nov 17, 2017 12:52 pm

This is in fact exactly how the original script worked - until I realized this fundemantal flaw and had to delete it. Creating such script is not so much a programming challenge rather a challenge in terms of setting up all the rest. >80% users now use WD, MB, WL or Wcat, none of which require CRON job and this would even require a second independent server. Way too complicated for vast majority of users to set up.

nineback
Advisor
Advisor
Posts: 73
Joined: Thu Aug 24, 2017 11:12 am
Location: Alabama
Station model: Davis Pro2
Software: WeeWX
Contact:

Re: Off Line Notification

Post by nineback » Fri Nov 17, 2017 1:27 pm

Understand. It would be nice to know when the station goes offline. In my case WU will send me an email after a couple of hours which is much longer than I would like.

Thanks for the detailed explanation.

Tom

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Fri Nov 17, 2017 1:49 pm

If your server supports CRON jobs, or if you are ok with using external service (potentially unreliable) such as cronjobs.org, then you could achieve this, although it would not solve the problem in case your entire website was down, just the station.

nineback
Advisor
Advisor
Posts: 73
Joined: Thu Aug 24, 2017 11:12 am
Location: Alabama
Station model: Davis Pro2
Software: WeeWX
Contact:

Re: Off Line Notification

Post by nineback » Fri Nov 17, 2017 2:17 pm

My server does support cron jobs.

Tom

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Fri Nov 17, 2017 2:42 pm

RIght, then you can do this and it depends how you want to check this, you have two options, either make the script look at meteotemplateLive.txt and get the latest timestamp there, or have it look at the last record in db. Compare with current time and then set a certain maximum interval that is tolerated and if it is exceeded insert the mail function (make sure your server has mail server installed). Then upload it basically anywhere on your server and set a CRON job for it, again interval depends on you, the faster the sooner you would know the station is offline, although keep in mind that setting it to eg. 5s would put a huge unnecessary load on your server.

SwissWetter.ch
Newbie
Newbie
Posts: 9
Joined: Tue Sep 19, 2017 2:06 pm
Location: Lueterkofen, Switzerland
Station model: Davis VP2, Lufft WS600
Software: meteobridge
Contact:

Re: Off Line Notification

Post by SwissWetter.ch » Mon Dec 18, 2017 1:31 pm

Arrrrrrgh !

I hope, I'm in the right topic.

I saw, that my template not received Data since 14.12.2017. My weatherBoxx PRO was down.
http://lueterkofen.meteotemplate.net

Is there a possibility, to send emalis to me, when no data is incoming?

Thanks

Markus
Check out the shop: https://meteo.shop

Demostation:
http://lueterkofen.meteotemplate.net
Lufft WS600 and Davis VP2 Station

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Mon Dec 18, 2017 1:47 pm

Hi Markus,
you are in the right topic, but unfortunately it is not possible because when there is no data, the api script is not triggered at all and if it is not triggered it cannot send email. It would be unreliable to do it this way.

SwissWetter.ch
Newbie
Newbie
Posts: 9
Joined: Tue Sep 19, 2017 2:06 pm
Location: Lueterkofen, Switzerland
Station model: Davis VP2, Lufft WS600
Software: meteobridge
Contact:

Re: Off Line Notification

Post by SwissWetter.ch » Mon Dec 18, 2017 1:52 pm

Hi Yachim

But isn't it possible, to open a second "trigger-script" ... for example called "alert.php" or something else.

Then my server or a external service can trigger this script for example all 10 min or 30 min, what else.
And if there no new data: --> Send ALERT-Mail !

So, i will lost 30 min of data but not 3 days.... this would be VERY helpful.

Best regards

Markus
Check out the shop: https://meteo.shop

Demostation:
http://lueterkofen.meteotemplate.net
Lufft WS600 and Davis VP2 Station

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Mon Dec 18, 2017 3:51 pm

The problem is that users using the api (WD, WCat, WeeWX and Meteobridge) do not use any CRON jobs and I was extremely happy I could get rid of them. It was always the most problematic thing for people to understand and set up. And what is worse, I was usually unable to help them because CRON jobs must be set up on the server, not via Meteotemplate. I therefore try to avoid CRON jobs as much as possible to make it easier for people to use and for me as well. Only people with Cumulus and few other updates still use it, but it is a minority.

SwissWetter.ch
Newbie
Newbie
Posts: 9
Joined: Tue Sep 19, 2017 2:06 pm
Location: Lueterkofen, Switzerland
Station model: Davis VP2, Lufft WS600
Software: meteobridge
Contact:

Re: Off Line Notification

Post by SwissWetter.ch » Mon Dec 18, 2017 4:03 pm

Hi Jachym

I think, the setup of a cronjob is in plesk a "childgame" :-)
Completely setupable by GUI. No Linuxknowing is necessary.

If someone can setup a meteotemplate, he can also setup a cron - I think.

So, the only possibility is to export the datas to another Portal, who can solve this?
AWEKAS can this.... but Awekas is not my world.

ok, I check this with Boris Pasternak, what he can do.

Best regards, Markus
Check out the shop: https://meteo.shop

Demostation:
http://lueterkofen.meteotemplate.net
Lufft WS600 and Davis VP2 Station

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Mon Dec 18, 2017 4:22 pm

Hi Markus,
CRON job is easy to do via Meteobridge, but not with the other software. I dare to say 80% of problems with installation in the past were caused by CRON job problems

SwissWetter.ch
Newbie
Newbie
Posts: 9
Joined: Tue Sep 19, 2017 2:06 pm
Location: Lueterkofen, Switzerland
Station model: Davis VP2, Lufft WS600
Software: meteobridge
Contact:

Re: Off Line Notification

Post by SwissWetter.ch » Mon Dec 18, 2017 5:04 pm

You misunderstood me completely!

I don't want to change anything in dataupload and the virtual "cronjob" in this case.

Let it be, like it is ! All is good.


But it would be great, to have a plugin called "breaking-alert" or something like this.
Only two things must be setted up:

- enter the email, where should the alert receive
- setup a cron, who calls the Plugin all 10 or 30 min or what the customer want.

Result: If no new data received until two calls: --> send email

Thats all. :-)
Check out the shop: https://meteo.shop

Demostation:
http://lueterkofen.meteotemplate.net
Lufft WS600 and Davis VP2 Station

nineback
Advisor
Advisor
Posts: 73
Joined: Thu Aug 24, 2017 11:12 am
Location: Alabama
Station model: Davis Pro2
Software: WeeWX
Contact:

Re: Off Line Notification

Post by nineback » Mon Dec 18, 2017 5:09 pm

I understand your concern with folks creating cron jobs. You helped me before but I think the idea of a plug-in is not a bad idea. It gives the user an option. To me setting up a cron job would be much simpler than me trying to write a script to read the db or anything else. That is way out of my ability. A plug-in could contain the script that he cron merely has to call.

Tom

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Mon Dec 18, 2017 9:20 pm

OK, but as I said earlier, to make this 100% reliable (which I would want) would mean having to have separate, independent server. Otherwise it would still not guarantee your template is being updated. Server/script issues would not send you notifications and your db would still not be updated

nineback
Advisor
Advisor
Posts: 73
Joined: Thu Aug 24, 2017 11:12 am
Location: Alabama
Station model: Davis Pro2
Software: WeeWX
Contact:

Re: Off Line Notification

Post by nineback » Mon Dec 18, 2017 9:27 pm

Do you mean run the chron on a server that does not host the template? I doubt many people (I don't) are paying for more than one server but some folks might and would probably appreciate it.

Tom

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Mon Dec 18, 2017 9:33 pm

Yes, thats what I explained above. In general, if you want to check functionality of something, it obviously cannot be done by the thing itself, because if it fails, it fails.

In this case, if you want to check data is coming to db, you cannot be checking it by the same server that is saving it. If it fails it wont send you any notification because there is a problem with it.

nineback
Advisor
Advisor
Posts: 73
Joined: Thu Aug 24, 2017 11:12 am
Location: Alabama
Station model: Davis Pro2
Software: WeeWX
Contact:

Re: Off Line Notification

Post by nineback » Mon Dec 18, 2017 9:41 pm

My data issues come from my station failing to upload the data (lost internet connection, computer froze, etc) and not from a problem with the server. Would checking from the same server should detect this?

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Off Line Notification

Post by Jachym » Mon Dec 18, 2017 9:54 pm

Yes, but I dont like the idea of saying:

"This script will email you when your station is offline - but actually, only in some cases"

Post Reply