Page 1 of 1

Archived records not stored in MySQL

Posted: Sun 12 Jun 2016 12:50 pm
by Dinant
Today I had to stop CumulusMX for more than one hour. After I restarted CumulusMX the archived records were read and the Cumulus logfiles were being updated.
I am also using a MySQL database to log everyhing, but the MySQL database is not being updated.
Has anyone seen this behaviour?

Dinant

Re: Archived records not stored in MySQL

Posted: Sun 12 Jun 2016 3:40 pm
by steve
Do you mean that you are using the built in facility in MX to log to MySQL when the monthly log file is updated? I'm fairly sure I added the code to do the updates from archive data, and I would have tested that it works. I'm on holiday at the moment and can't look at the code. If you zip up the MX diags folder and attach it, I'll try to take a look, but I may not be able to do it until I am home. You could look at the files yourself, it may be obvious what is going on.

Re: Archived records not stored in MySQL

Posted: Sun 12 Jun 2016 5:39 pm
by Dinant
Yes, I am using the built-in MySQL facility.
After investigating the MXdiag file I may conclude the archived records are put into the MySQL database. There is only 1 record missing.
I think I pressed "Ctrl-C" when the MySQL update was busy. See logfile:

Code: Select all

2016-06-12 12:16:00.529 Writing log entry for 12-06-2016 12:16:00
2016-06-12 12:16:00.529 Written log entry for 12-06-2016 12:16:00
2016-06-12 12:16:00.529 Writing today.ini, LastUpdateTime = 12-06-2016 12:16:00 raindaystart = 276.6 rain counter = 276.6
2016-06-12 12:16:00.529 INSERT IGNORE INTO Monthly (LogDateTime,Temp,Humidity,Dewpoint,Windspeed,Windgust,Windbearing,RainRate,TodayRainSoFar,Pressure,Raincounter,InsideTemp,InsideHumidity,LatestWindGust,WindChill,HeatIndex,UVindex,SolarRad,Evapotrans,AnnualEvapTran,ApparentTemp,MaxSolarRad,HrsSunShine,CurrWindBearing,RG11rain,RainSinceMidnight,WindbearingSym,CurrWindBearingSym) Values('16-06-12 12:16',18.8,76,14.5,3.2,8.0,176,0.0,0.0,1009.04,276.6,27.2,46,4.8,18.8,18.8,0.0,0,0.00,0.00,19.6,852,0.0,196,0.0,0.0,'Z','ZZW')
Exiting system due to external CTRL-C, or process kill, or shutdown
2016-06-12 12:16:05.232 Cumulus closing
2016-06-12 12:16:05.295 Writing Cumulus.ini file
2016-06-12 12:16:05.342 Closing connection
2016-06-12 12:16:05.342 Station stopped
In the monthly logfile the entry 12:16 is present, but in the MySQL file it isn't!

The reason I thought archived records where not put into the MySQL database was the recent_graphic.php made by Mark from weather.wilmslowastro.com.
I am using that php/javascript script on my webpage. I attached the image recent_graph.png.
Realtime graphics at http://www.weerstation-markelo.nl/grafieken_recent.php

You see a gap between 12:14 and 13:42. The data from these records is omitted from the graph. In the MySQL database there is only 1 record at 12:16 missing.
Why is there a gap in the graphic? Those records (gap) are in the MySQL database. I have checked that.

Hopefully Mark will read this topic and maybe he can answer this question.

Dinant

Re: Archived records not stored in MySQL

Posted: Sun 12 Jun 2016 11:54 pm
by mcrossley
The real time data is only logged into MySQL when cumulus is 'live' running, cumulus will add data into the SQL log tables during the catch up, but does not update the real time data - there isn't any. I guess it could trigger the real time insert every time a log entry is added during catchup which would add a bit of the missing data. Steve would have to look into that though.

Re: Archived records not stored in MySQL

Posted: Mon 13 Jun 2016 8:14 am
by Dinant
The recent_graph.php is using the Monthly MySQL table (not the Realtime MySQL table) , isn't it?
I don't use the Realtime MySQL table at all and I have graphs shown!

Re: Archived records not stored in MySQL

Posted: Mon 13 Jun 2016 8:51 am
by mcrossley
Oops, yes you are correct, it was too late last night - you are talking about the recent graphs not realtime.

So yes, that graph gets its data from the the monthly table.

If you say the data is in the table, then I have no idea why it is not being picked up. I'd really have to take a look at it and run the query manually. Are you sure the logged date/times are correct - no subtle differences?

edit: MX catch-up has worked OK for me in the past

Re: Archived records not stored in MySQL

Posted: Mon 13 Jun 2016 9:16 am
by Dinant
If I start the php script which gets the data from the MySQL database, it shows the data from the gap is not there. So it seems there is an error in the php script. The script is a copy of your realtimeLogSql.php script file. I cannot find the error in the script. Maybe you can find it. I'll send you a copy of the script tonight by PM.

Dinant

Re: Archived records not stored in MySQL

Posted: Wed 15 Jun 2016 4:22 pm
by Dinant
I found the error. The script is using the Realtime table and not the Monthly table. To use Mark's script I have chosen the Realtime interval equal to the normal archive interval e.g. 1 minute. I am not using the Realtime table for other things. Because the Realtime table is not updated during the catch up I got a gap in the recent graph.
Anyway thanks for your help.

Dinant