-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about retention/data overwrite - no issue #4
Comments
Hi @HSkul! I'm so happy that you're making use of this project. I'm still using it as my primary forecasting tool, and plan to maintain it indefinitely. As for the best way to run this, I use an hourly Systemd timer, which is pretty similar to a cronjob just with better logging via journalctl and easier disabling/enalbing. You ask how data will accumulate in InfluxDB. Well, you are right to ask. You will accumulate a new series every hour, 24 per day, or 8760 series per year. In InfluxDB, high series cardinality can be an issue especially for memory usage. If you would find adding support for retention policies back in as an optional flag useful, I could look into it for you. (I could also look into an optional flag to overwrite data on a single time series if that would be interesting.) Insert plug here for VictoriaMetrics, a drop-in replacement for InfluxDB or Prometheus. It's storing more time series in smaller space with less memory and cpu usage. I switched about 1 year ago after InfluxDB corrupted its database and crashed on every startup on my 4GB Pi 4. Let me know your thoughts and we can continue this conversation. Ted |
Related: just added my VictoriaMetrics dashboard definition to the repo, since I noticed I only had the Influx version there. |
Ted, Thanks, Hjalti |
I'll have a look then, I've created a new issue to track it. You indeed can write identical influx line protocol to VictoriaMetrics, plus it also can scrape prometheus endpoints, and more. |
Looks like in InfluxDB 2.x, each "bucket" has its own retention period: https://docs.influxdata.com/influxdb/v2.5/reference/internals/data-retention/#bucket-retention-period So I don't think there's any need to add retention policy support, since you should be able to configure whatever bucket retention needed already. I'll look into overwriting next. |
I've added a new config option, I'm going to also upgrade the influx client to 2.x before releasing a new version. |
You know, I should point out about VictoriaMetrics - it only by default supports metrics up to 2 days into the future, I actually maintain my own fork with that modified to 30 days in the future. Issue: VictoriaMetrics/VictoriaMetrics#827 (comment) |
Thanks a lot for all the information. This is really helpful. I'm actually running InfluxDB 1.8 at the moment, as the authentication seemed to be simpler (can avoid it). I have InfluxDB 1.8 and Grafana running in the containers and I'm working on figuring out how to run forecastmetrics as a cron job in a container as well (which port does it use?). I think what I'm going to do is to try to get this going so I can free up my Raspberry PI 2 for other uses (wall based Google calendar with Grafana graphs, my RPi 1b is struggling there). Then later I can rather easily get a separate container running with either InfluxDB 2 or VictoriaMetrics and swap by switching external ports. Thanks again |
Good news is that even when using the Influx 2.x client, authentication still works with Influx 1.8 by setting the "authentication token" to "username:password", leaving the organization blank, and setting the bucket to "database[/retention-policy]". https://github.com/influxdata/influxdb-client-go#influxdb-18-api-compatibility ForecastMetrics doesn't have any incoming connections - it makes http GET requests to NWS/Visualcrossing if enabled, and then makes http POST requests to influx/VM. Sounds like you have interesting projects! Enjoy :) |
One other comment about using VictoriaMetrics - with the upgrade to the influx 2.x client it will require using vmauth (a simple auth proxy) with it, because VM doesn't support the "Auhtorization: Token ..." header: VictoriaMetrics/VictoriaMetrics#1897 |
Just released v3.2.0 with two new features:
Let me know if this release helps or you have any trouble. |
This is great. Let me take it for a spin. I got my container running with v3.1.2 but the data is looking a bit different from the data that is being pulled by the RPi (at least what is stored in the InfluxDB container). I'll try v3.2.0 and see if there is any change with the overwrite. I'll keep you posted. Thanks again. |
I forgot to ask - do you happen know what version you were using on the RPi? There's no embedded version or anything - you'd have to remember what you downloaded or compare the bytes, sorry |
Something is not right. I'm pretty sure I did everything the same when I built the image with v3.2.0 as what I did with v3.1.2 and now I'm getting this when I run forecastmetrics:
Here is my config file. I'm wondering if it is not set up correctly:
Thanks, |
Nope, that's a bug I didn't notice because gasp I didn't try it with overwrite_data set to true. Releasing 3.2.1 now. |
Added version information to the binary :) |
OK it is working now. Or at least the same as v.3.1.2 I ran in the container. Still some issue with the data coming in compared to the RPi. My cloud cover is coming in at 100% (7 days out) and it never was predicted to be 100%. The humidity and temperature doesn't look the same as what the RPi is pulling in. I need to have it run overnight and see what it looks like tomorrow. Thanks! |
I just started running the latest version and am also seeing some weirdness where refreshing the dashboard has metrics appearing and disappearing. Will need to investigate further tomorrow. |
So I don't think there's anything inherently wrong here, at least with the non-overwrite version. The forecast metrics I'm generating still seem to be good. On my VictoriaMetrics system, I'm no longer getting the database as part of the metric, because it's now sent on the query string like Any further thoughts on what you're seeing on your side? |
Philly coords would look something like locations:
- name: Philly Phanatic
latitude: 39.9056
longitude: -75.1666 So if you're close to that you're probably good. The cloud cover does look different between the two, you're sure they're set to the same location? If the yellow/green dot graphs are temperature, they look more like wind directions to me. Temperatures don't jump like that but wind directions would jump from 350 degrees to 0 degrees. |
Long story. Figured out that there was something wrong with InfluxDB database (probably because I copied over the folders and data from the Pi do the docker container). So I switched to Victoriametrics, got it set up in container and just got everything going (ForecastMetrics running in a separate container, values from Homekit being sent to VM periodically and Grafana now plotting data). I need to let it run for a while to ensure everything is working right. But my first impression is that the forecast data now makes sense. I don't now what the issue was with InfluxDB but everything looks right now., both temperature and precipitation probability and cloud cover (the data streams I have been using). The only thing is that I'm only getting ~3 days worth of forecast. Like I said, I'm letting it run for a while to see how this works out. I also need to figure out minor things like changing the retention to 1 year instead of the default of 1 month. |
Hey that's awesome! As for 3 days of forecast, I can tell you what's up there - VM only supports 2 days into the future as I mentioned above. I rebuild it every once in a while allowing 30 days into the future, feel free to install a binary from here: https://github.com/tedpearson/VictoriaMetrics/releases/tag/v1.84.0-54741f6 Once you do that you should be good to go (other than precipitation amount forecasts, which are only forecast about 3 days out by NWS). For retention, it's just a flag to the VM process: |
Ahh yes, got it. I will recreate the VM container with your binary. Thanks a lot. So far it looks like it is working except the Homekit automations but that is a Homekit issue (common). Thanks again. |
The victoriametrics binary that I got from the link above is not running on the plain vanilla Debian image. I get the following error when I log into the container: victoria-metrics: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found I'll try the Ubuntu image and if that doesn't work, I guess I'll have to compile it. Edit: NM, it works with the Ubuntu image. |
First of all thanks a lot of this code. I have been using this on a Raspberry Pi with Influxdb and Grafana and it has been working really well (I copied your graphs, really liked the way you presented the data). I'm in the process of moving the setup to a home-built NAS running OpenMediaVault and putting InfluxDB and Grafana into Docker containers so I want to make sure I do this properly for the long run.
On the RPi I have been running ForecastMetrics as a cron job every hour. It was just something I figured would work. But now that I'm reading up on this a little more I'm confused as to how much data will accumulate in InfluxDB since it doesn't look like old data is being overwritten and there is no retention policy (I'm using 1 year in InfluxDB). Originally when I was setting this up it didn't look like unnecessary data was being accumulated but now I'm not sure. What is your suggestion on how to populate an InfluxDB database?
If the answer is just a cron job I may see if it makes sense to put it inside a container (not sure why, just to see if I can do it as I'm learning to use containers). Any obvious issues with that?
Thanks
H
The text was updated successfully, but these errors were encountered: