2018-08-15 14:55:28.053 [ERROR] [m.kuguhome.openhab.prometheusmetrics] -
[com.kuguhome.openhab.prometheusmetrics.exposable.OpenHABThingStateMetric(291)] Error during
instantiation of the implementation object
java.lang.NoClassDefFoundError: Could not initialize class
com.kuguhome.openhab.prometheusmetrics.exposable.OpenHABThingStateMetric
You probably hot-swapped the file inside the addons/ folder? So delete the old one, put in the new? For some reason unknown to us, that sadly doesn’t work with our bundle currently. You will need to restart openhab after removal of the old bundle.
I just tried again on my test system with the 0.9.3 jar from GitHub and it works well without errors.
Can you try to restart?
I am running OH 2.3 release as well, the bundle is not tested with the latest openHAB snapshot, sorry. Probably, the io.swagger.annotation version has changed lately
@diyha you mentioned (Presence with Android after using Iphone) you would like to see some “stats” from your openHAB instance. I think this bundle will do the thing for you.
In detail:
what bindings are installed
what bindings were uninstalled after they were installed (you record the installed bundles over time in prometheus and look at them, can even issue PromQL queries to filter bundles for specific properties, e.g. changed from installed to uninstalled)
how many things a binding serves (this is not directly implemented yet, but you will get a list of all things)
how many exceptions are thrown by a binding shortly after being installed (may indicate poor docs and poor parm descriptions) (the metrics bundle counts the number of log messages by level)
how many exceptions are thrown by a binding in a given time (see above)
how many exceptions are thrown by platform (may indicate popular platform issue) (see above and additionally the events per source are counted, this will also be revealing)
how often OH reboots not directly counted but can be inferred from resetting event counters
how often rule engine throws errors (may indicate poor rue language VM and tooling) (counted in the logs and event bus)
etc (number of inbox entries, bundle and thing state, thread/pool size and counts, jvm/process/memory insights)
Let me know if you have any questions, suggestions or feature requests or if the bundle helps you in any way.
Hello, is there potential/initiative to get this as a plugin in (some of) the store?
Would love to get statistics on what is openhab doing inside prometheus
Since this relies on so many external services I don’t see how this could be made into a binding or add-on. It could probably be added to openHABian though.
Setting this up is still on my todo list but I don’t have a lot of time to work on additions to my system these days. I’m fighting a bit of bit rot at the moment that is taking a lot of my time (RPi that controls my garage has gone wonky, Wunderground is shutting off it’s free API, etc).
Yes, there is an initiative to team up with Deutsche Telekom and get the metrics into Eclipse Smart Home core. But this may take a little while.
Meanwhile, following the instructions above and in the readme over at GitHub, it is already possible to use our bundle. Just drop the .jar files into your addons directory.
The bundle only relies on the prometheus library bundles, which you can download and also just drop into the directory, it is not relying on any external service!
Is anyone aware of a similar Prometheus exporter to scrape item values. It would be awesome to be able to expose values like power consumption or lumens or or water flow… to Prometheus’ calculation functions. I did see one approach that could work via exporting values first to MQTT.
https://github.com/hikhvar/mqtt2prometheus looks like it comes somewhat close but since Prometheus need to know whether each metric is a gauge or a counter it would require that each metric is individually configured.
Oh, wow I’m very sorry I didn’t reply in time, somehow I didn’t get or notice the forum mail notifications
Thanks @ricadelic for the detailed instructions. Actually it should be no problem to place all the .jar files into the addons folder at the same time or at a random order. @mdnx the link https://github.com/KuguHome/openhab-prometheus-metrics/releases/ as @ricadelic posted it is the right place to look. The bundle is currently running in several field systems for us in beta state, development is somewhat paused but we are very interested in feedback!
@imaginator I am not aware of a similar approach for a direct item Prometheus exporter.From our point of view, the InfluxDB or any other persistence plugin would be the “correct” way to get the item values (going MQTT->Prometheus seems one step too much for me). We instead wanted to get values/metrics, which were (until now) hidden. Also, to our mind, Prometheus is more of a health metrics monitoring tool and less of a general value scraper. But you can certainly use it that way. It also shouldn’t be too much of a problem, to write an “Exposable” along the lines of https://github.com/KuguHome/openhab-prometheus-metrics/blob/master/com.kuguhome.openhab.prometheusmetrics/src/main/java/com/kuguhome/openhab/prometheusmetrics/exposable/OpenHABThingStateMetric.java which queries the item registry instead of the thing registry and outputs their values.
If it would be “switchable” within the bundle, we could include it, if you do a PR on GitHub.
I haven’t set this this up myself yet, but my understand is that Prometheus users Grafana as the display. So there shouldn’t be anything stopping you from adding graphs of stuff saved to InfluxDB through Persistence to the same Graphana dashboard.
My thinking on Prometheus is less about the graphing and more about the Prometheus query functions. I’d love to be able to detect water leaks by looking for sustained low values. Or predict energy consumption for the rest of the month. Or hook into the Prometheus alert manager … Or…