[APP] Prometheus.io exporter

@Kyrcio

Is the new version gonna be submitted to the appstore? maybe as test?

I started using the prometheus app to store solar panels information and visualize it in Grafana. Is there a way to make a selection in the data is stored? I do only need two sets of data and i am collecting way more now with everything from my Homey.

Is there some setting in the config file (.yml) where i can specify what to scrape? I allready set the interval to 5 minutes.

1 Like

Does anybody know how to get the data from pometheus back to Homey? :slight_smile:

I would like to have the following flow:
when: it’s start to rain
then: write me a push msg with all open windows
curl -s "http://prometheus:9090/api/v1/query?query=homey_device_alarm_contact>0" | jq -r '.data.result[].metric.name'

The tricky part is how to parse the json from prometheus in homey. Query works perfectly on my laptop though.

You can use the HTTP request flow cards app to perform the query and extract the data with its JSONPath support.

You can use http://jsonpath.com/ to test JSONPath queries against the data that Prometheus returns.

You could also have a look at using the Alert functionality within Grafana to do the heavy lifting, instead relying on webhooks.

I have not used this in the context of Homey, but I have been using Grafana Alerting in some enterprise application I have been working (during my day job) and it sometimes does the job well if you can overlook the somewhat quirky setup process.

I see other people already reported this, but I only noticed yesterday that prometheus.io exporter is creating an unacceptable load on my Homey pro. I uninstalled the app around 9 pm yesterday, and the system load is significantly lower since then.

Anything you can optimize in your code to reduce the load maybe @Kyrcio? I really love your app, but it takes my average load above 1 :hushed: As you can see the app started working on June 25th, and I uninstallled on June 29th.

Could you please install dashboard 10586 and paste back what it spends CPU time on. I think last time I saw this, the physical storage of the Homey was slow due to a hardware or OS issue IIRC. The new polling should also be much nicer on the system so this is potentially a new issue.

I already de-installed prometheus. So I need to set that up again, including grafana to get the dashboard running. Maybe if I’m realy bored I will try that :thinking:

Edit: OK, I just got bored. Dashboard 10586 is running. So now what do you need from me?

Anything you want me to look at in the dashboard @Kyrcio?

The interesting graphs would be the ones showing what time is spent on, especially the systeminfo call.

Those remain empty (no data)

Sorry, I did not realize the old beta version expired once Athom changed the dev experience. New test version published here: https://homey.app/a/io.prometheus/test/

OK, reinstalled everything again with your test version. It is collecting data now.I shall post the graphs in some hours.

edit: this is after 30 minutes running:

edit: 3 hrs graph:

Hi @Gruijter

If i compare yours to mine, the time spent per device seems factor 10 higher. this was the case on my homey too, before the change below.

Can you try this:
edited this line (in the app.js file) :

setTimeout(this.updateSystemInfo.bind(this), 30000);

To this:

setTimeout(this.updateSystemInfo.bind(this), 300000);

after i made that change, my load went down.

I’m new with docker files. How can i change the yml file… it’s not on my local system. I installed the docker on my NAS

@Gruijter The problem here is that your Homey spends lots of time refreshing devices. Normally, updatedevicelist and registerdevice times should be more or less zero. I suspect that there is something (an app?) that cause the Homey to spam device changes events. Can you please create a diagnostic report for the Prometheus app and send me the UUID for it?

@matrover Actually, the system info loops looks quite normal. Of course it will always be a trade off between update frequency and system load. Note that this metric has its own y-scale in the chart, and that time spent does not equal system load (lots of async calls to the Homey APIs).

df243a78-2382-4593-895d-83e1237ad3bc

I only had the app running for 5 minutes when creating the report. Is that ok @Kyrcio ?

Thanks. I can see that the device update event is indeed triggered very frequently. I would have to add more logging to get a better understanding of why this is happening.

well, I have a lot of devices that each have a lot of updates :slight_smile: E.g. my power plugs update every 10 seconds, and I have around 30 plugs or so. And another 50 devices updating every minute. And then I have apps monitoring these devices and turning them into new virtual devices. like the PowerByTheHour app.

@Gruijter It is not the state changes that trigger device update events (https://developer.athom.com/docs/api/HomeyAPI.ManagerDevices.html#.event:%22device.update%22), rather updates to device metadata. I have created version 0.2.7 which improves logging (in addition to a larger timeout on device updates). Could you please try that and do the diagnostics report again? This should at least tell us which driver is the culprit.