joaofl / hassio-addons

More add-ons for your Hass.io.
17 stars 22 forks source link

telegraf2hassio docker stats #24

Closed Hadatko closed 4 months ago

Hadatko commented 10 months ago

Hi, your addon is great but for docker stats it was terrible. Maybe you will be interesting in python changes i made in my fork. I was trying to keep backward compatibility (in python files, others are changed to work in my environment).

https://github.com/joaofl/hassio-addons/commit/6f9b6503534612c1c8bd66da22309869be026923

joaofl commented 10 months ago

Hi @Hadatko

Indeed you've got some interesting improvements there. I am not sure about some of yours changes, neither I've got the chance to test it. Could you make a PR?

Backward compatibility might not be a big issue here I would say...

Hadatko commented 10 months ago

I want do one more change. Currently all docker containers are under one mqtt device TELEGRAF. I want do change that every container will be one device. I hope i need only edit device key in measurement from host to host_containerName. But i didn't have time to test it. For backward compatibility i was thinking that device could be without feature postfix. But i don't know how data are structured and from where they are taken.....

Hadatko commented 10 months ago

FYI what i am doing is have ability of your feature available for docker outside of HA environment. All docker containers i am handle manually I added my docker to dockerhub: https://hub.docker.com/repository/docker/hadatko/telegraf2hassio/general

I am curios if we can do support directly to telegraf repository or keep our implementations.

Hadatko commented 10 months ago

Hmm if we can manage merge our works, then your repo would be enough. I will try prepare first PR.

joaofl commented 10 months ago

Agreed. Its nice to have interested people contributing and testing as well. Thanks for that.

joaofl commented 10 months ago

I am curios if we can do support directly to telegraf repository or keep our implementations.

You mean to make it an upstream plugin to telegraf?

Hadatko commented 10 months ago

I am curios if we can do support directly to telegraf repository or keep our implementations.

You mean to make it an upstream plugin to telegraf?

I was thinking only about dataFormat update. But maybe we would need plugin https://docs.influxdata.com/telegraf/v1.9/data_formats/output/

Hadatko commented 10 months ago

Actually it is plugin parser written in go. Hmm should i start to learning it? :D https://github.com/influxdata/telegraf/blob/master/plugins/parsers/json_v2/parser.go

Hadatko commented 10 months ago

This is what i want to achieve. Not great implementation but it is doing what it should. https://github.com/Hadatko/hassio-addons/commit/951f4a729e977085ac1b870944553dabc4cc9dcc

Correct solution would be new group sensor class result (thank you for easy understandable/modificable code ;) ): image image

joaofl commented 10 months ago

Looks like good stuff. Maybe we need a config to toggle it on/off? Also, how does your telegraf configs look like? A PR would be welcome.

Hadatko commented 10 months ago

Here is mine telegraf config: https://github.com/Hadatko/hassio-addons Do you mean config for setting one sensor or multiple sensors? I will prepare PR once i will get more time. Not sleeping much last 4weeks :DDD

Hadatko commented 9 months ago

Hi @joaofl , i found out that HACS has integration Docker Monitor, which i doing the same i wanted with this project. So sorry for that but i am not going to continue on this. Still you can get some inspiration from my repository if you want. Maybe i will join in future if i will use telegraf for something else ;)