madron / iptables-exporter

90 stars 12 forks source link

ImportError #3

Open LilLilth opened 3 years ago

LilLilth commented 3 years ago

Hello,

By following step by step I am constantly getting following error after executing iptables-exporter --dump-data Error: ImportError:cannot import name 'HTTPServer' from 'prometheus_client.exposition' (/usr/local/lib/python3.8/dist-packages/prometheus_client/exposition.py)`

For testing purposes I have removed import HTTPServer from /usr/local/lib/python3.8/dist-packages/iptables_exporter/main.py. After that iptables-exporter --dump-data is working but it's not possible to expose data on iptables-exporter --port 9119. because HTTPServer is not defined.

If you check prometheus_client.exposition you can see that HTTPServer is not called out at all..

Did you face any of issues above? Which version of Python are you using?

Any advice is welcome :)

Thank you in advance!

tommie commented 3 years ago

This really does seem broken, so I'm curious why you closed the issue. Did you solve?

It looks like HTTPServer was removed from prometheus_client in version 0.9.0 after lint checking: https://github.com/prometheus/client_python/commit/3889a5d4d0be8d47160148cec6093c149db0e82d

tommie commented 3 years ago

Oh, it seems like master is fixed for 0.9.0, but the pip package isn't released since 2019: https://pypi.org/project/iptables-exporter/#history

madron commented 3 years ago

I need to fix it. In the meanwhile force version 0.9.0 for prometheus_client. Or just use the docker image: https://hub.docker.com/r/madron/iptables-exporter (madron/iptables-exporter:0.9.3)

Lusitaniae commented 2 years ago

Just need to release a new tag to solve this?

the patch in master is not tagged yet

madron commented 2 years ago

Just need to release a new tag to solve this?

Yes, a new release could solve this issue but in #5a423c16aaaaf17216f0c87f08b2c495929a6dad I introduced a breaking change in the output format. So anyone upgrading to next release needs to update alerting rules. I still need to document the change and find the courage to release it. ;-)

Lusitaniae commented 2 years ago

:)

Also could add some updates on README, I started looking at this recently and it's a bit difficult to get started

e.g.

--comment "iptables-exporter ssh traffic", it's not clear that I explicitly need to make a "rule" by adding a comment in this format, which will enable data/packet exporting