iptables-exporter icon indicating copy to clipboard operation
iptables-exporter copied to clipboard

ImportError

Open LilLilth opened this issue 4 years ago • 6 comments

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!

LilLilth avatar Jul 07 '21 09:07 LilLilth

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 avatar Sep 03 '21 21:09 tommie

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

tommie avatar Sep 03 '21 21:09 tommie

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)

madron avatar Sep 05 '21 13:09 madron

Just need to release a new tag to solve this?

the patch in master is not tagged yet

Lusitaniae avatar Feb 14 '22 17:02 Lusitaniae

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. ;-)

madron avatar Feb 15 '22 10:02 madron

:)

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

Lusitaniae avatar Feb 15 '22 10:02 Lusitaniae