15 ms·
> [...] that feed into a prometheus -> cortex store, so I can then map them on Grafana. I had to Google because I've never heard of any of those. Did I find th
by tzs 5y ago
> [...] that feed into a prometheus -> cortex store, so I can then map them on Grafana.
I had to Google because I've never heard of any of those. Did I find the right ones?
https://prometheus.io/ https://prometheus.io/
https://cortexmetrics.io/ https://cortexmetrics.io/
https://grafana.com/ https://grafana.com/
Mine is much more primitive. My indoor temperature monitor is an ESP8266 that uploads the temperature to a simple PHP page that saves it in an sqlite DB. A cron job runs a Perl script every few minutes that extract the data for the last hour, 3 hours, 12 hours, 48 hours, and since the beginning of time and uses gnuplot to produce PNG graphs. There's a static page on my server that displays those graphs.
My outdoor temperature monitor uses a cheap AcuRite 433 MHz indoor/outdoor thermometer I bought. I have an RPi with an RTL-SDR attached spying on the communications between the AcuRite sensor outside and the AcuRite display inside using rtl_433. A script looks at the rtl_433 and finds the AcuRite sensor data and puts it in an sqlite DB. I haven't yet gotten around to making something to graph it.
The nice thing about that approach is that it was also easy to add support for other 433 MHz wireless sensors near me, such as the AcuRite fridge/freezer thermometer I have. I can also see a few assorted sensors of neighbors (temperature, humidity, soil moisture, tire pressure, wind speed, wind direction, rain, and a few other random things). If I wanted to it would be easy to add them to the DB.
When I made a wireless tipping range gauge recently. I used a 433 MHz transmitter module [1] and added a decoder [2] to rtl_433 that understands my data stream format. That gets my data into the rtl_433 output. No need to futz around with 433 MHz receiver modules which appear to be a pain in the ass [3]. An ATTiny85 counts the tips and runs the transmitter. The ATTiny85, the transmitter module, a battery holder, an RJ11 socket because the rain gauge has an RJ11 connector, a board to put those things on [4], and a small waterproof case is pretty much the complete parts list.
I think I'm going to standardize on this general approach. For things that do not have WiFi and only need to report data 433 MHz modules and custom decoders fro rtl_433 on the RPi. For things that do have WiFi, such as any future ESP projects I do, they will just use WiFi to talk to the RPi. If anything needs to get sent outside of my LAN the RPi will handle it.
The RPi is also currently controlling a space heater in my living room, getting connection data from my cable modem periodically and recording that in an sqlite DB, and serving a simple web page that lets me quickly change inputs and volume on my Denon receiver and so I'm already pretty much committed to keeping it running all the time.
[1] https://www.sparkfun.com/products/10534 https://www.sparkfun.com/products/10534
[2] Decoders can be specified in a simple text file. Here's the one for my rain guage as an example:
decoder {
name = TZS Rain Gauge,
modulation = OOK_PWM,
short = 416,
long = 612,
reset = 1452,
gap = 0,
tolerance = 0,
sync = 1484,
bits = 96,
match = {24}0x545a53,
get = Tips:@80:{16},
}
That results in this in the rtl_433 output (when set to write output in JSON) for my rain guage:
{"time" : "1637771949", "model" : "TZS Rain Gauge", "count" : 1, "num_rows" : 1, "rows" : [{"len" : 96, "data" : "545a5304436f756e743a03da", "Tips" : 986}], "codes" : ["{96}545a5304436f756e743a03da"]}
[3] https://www.sparkfun.com/products/10532 https://www.sparkfun.com/products/10532
[4] https://www.amazon.com/gp/product/B07ZYTZ48N/ https://www.amazon.com/gp/product/B07ZYTZ48N/
- outworlder 5y ago> Mine is much more primitive. My indoor temperature monitor is an ESP8266 that uploads the temperature to a simple PHP page that saves it in an sqlite DB. Nothing wrong with 'simple'. Although you are kinda reimplementing the wheel in some of the setup. If you don't have an use for the whole Prometheus shebang (it's a great piece of software, but might be overkill, and you probably don't need Cortex), you can upload stuff to Graphite. Installation is simple. Sending data is just a netcat away, can't really get simpler than that. Bonus points is that you don't have to maintain (or create) the PHP page. Or maintain a database schema for any new metrics you come up with. Send what amounts to a string with your metrics to Graphite, and then you can connect Grafana to it and quickly build all sorts of graphs, even alerts. Now that you have built it, it makes no sense to replace. If you ever find you need different metrics, different graphs, queries, alerting, a dashboard or what have you, take a look at that. It's the simplest solution I've found. Like their examples show: echo "foo.bar 1 `date +%s`" | nc localhost 2003 Essentially, the format is: <metric name> <metric> <timestamp> Send that to the listening port and you are done.
- Jedd 5y agoAu contraire - your setup is way more sophisticated than mine! : ) I have some 433MHz kit, plus a bundle of various arduinos, but (for me) the complexity of getting them to talk back to base has kept me procrastinating for years. The ESP8266/ESP32 devices, with WiFi built-in, are effectively the same price as arduinos (here in AU, via ebay) but so much more convenient because of that extra memory + the wifi. I'm going to have some frustration with the 3 vs 5 volt, especially with some of the more esoteric components, but so far it's been a breeze to setup. As Outworlder observes, my back-end is way more complex than a normal human would need - I'm replicating a stack we use at work, so it's basically taking up a bit of space on my home lab. Cortex is for a serious (enterprisey) amount of long-term storage of time-series metrics. Prometheus is easy enough to set up - it scrapes web end points that contain key / value pairs in plain text, and puts those in its own time series data store. Sqlite will scale just as well, I'm sure. If you have the bandwidth, I can recommend playing with some of these things, just in case they may make your life easier later. Prometheus (server) will run on a Raspbery Pi easy enough. https://github.com/G1Tech/youTubeStream/blob/master/prometheus-bme280-v2.ino https://github.com/G1Tech/youTubeStream/blob/master/promethe... That's a code fragment to run on an ESP and present a prometheus-compatible end point with a handful of key/value pairs - if you have a spare ESP, run it up, and hit the endpoint to see what I mean. The simplicity is compelling. If / when I go down the path of custom components plugged into arduinos - and I'd like to one day build something to measure the levels in my rainwater tanks - I think that I'd try to get those data back into an intermediary device (esp or RPi) that could present them in this opentelemetry format, as it would make it easier to swap things around in the future. Grafana is fantastic, and can produce some gorgeous visualisations from Prometheus (and other) sources. You may even be able to get it doing something with your sqlite DB. Running up a monitoring agent (Prometheus' node_exporter, or InfluxDB's telegraf - functionally very similar) on your laptop may be a good way to experiment with live data and visualisations with low-effort. (Note that Telegraf will by default try to push into an InfluxDB -- I'm not a huge fan of InfluxDB -- but you can configure it to provide an otel / prometheus-compatible scrapable web endpoint instead.)