I was successful in porting the solar inverter data to MRTG! This is accomplished with a program called RRDTool developed by the author of the original MRTG. A script was needed to import the raw solar data into a database using a handy language called python. RRDTool uses a database called Round Robin Database thus the RRD.
The solar inverter has the ability to “push” a file via FTP to a host at a selected time interval. Currently, I have it pushing every minute to a server. A cron job calls a script every 5 mins which then imports the data to the round-robin database. The graphs are generated on the fly with a CGI script that calls to RRDTool to generate the graphs.
Since MRTG was developed to read data network interface statistics I had to work with different options to represent the data accurately, the solar data is an absolute number meaning that it is an actual reading at that moment in time and not cumulative such as a continuous counter. The script first looks for the database file and if it does not exist it will create an empty file with the proper layout for the data. In this case the actual generation in real-time in watts. If the file exists it looks for the raw data files and creates a list for import. The first file in the list is opened the time stamp found, reformatted then saved to a variable. Next, I get the actual data into a variable, format the RRDTool command, and push it off to the DB. Finally, I save the raw data file to a backup directory.
There are some data missing as I was not logging for a while and I have a gap in the data as I lost some while developing the script. For a little extra fun, I enabled mod_proxy in Apache so the graphs, database, and logging are on another server of mine “hidden” behind this one. This was a learning experiment for me to integrate features/functions also.
Let me know if you have any questions!
*This page will auto-refresh every 5 mins to update to the latest graphs
Live Solar Power Generation
Updated:Sun Oct 13 17:35:52 2024
System: | Solar Inverter at Brighton Honey |
Description: | Live Solar Power Generation |
Max Output: | 6.460 kW |
Peak Output today: | 1.017 kW @ 13:34:32 |
Generation today: | 1.85 kWh |
Generation best: | 37.87 kWh @ 2024-04-25 |
Generation YTD: | 4375.757 kWh |
Generation Total: | 32468.202 kWh |