GEODB Crashed
Opened this issue · 4 comments
DoM1niC commented
Python 3.9 without Docker without Database all works so far for me
INFO:nftables-exporter:listing on :9630
INFO:nftables-exporter:geoip lookup enabled
INFO:nftables-exporter:maxmind database stored at data/GeoLite2-Country_20211026/GeoLite2-Country.mmdb
INFO:nftables-exporter:startup complete
Traceback (most recent call last):
File "/opt/prometheus-nftables-exporter/./main.py", line 294, in <module>
main()
File "/opt/prometheus-nftables-exporter/./main.py", line 42, in main
collect_metrics(*metrics, geoip_db=database)
File "/opt/prometheus-nftables-exporter/./main.py", line 108, in collect_metrics
for labels, value in annotate_elements_with_country(item, geoip_db):
File "/opt/prometheus-nftables-exporter/./main.py", line 152, in annotate_elements_with_country
raise TypeError(f'got element of unexpected type {element.__class__.__name__}')
TypeError: got element of unexpected type list
dadevel commented
I can't reproduce the issue, so please provide the following info to aid in debugging:
- Are you running the latest version (v2.0.0) of nftables-exporter?
- Output of
cat /etc/os-release
- Output of
python3 --version
- Output of
nft --version
- Output of
NFTABLES_EXPORTER_LOG_LEVEL=DEBUG nftables-exporter
DoM1niC commented
PRETTY_NAME="Debian GNU/Linux bookworm/sid"
NAME="Debian GNU/Linux"
ID=debian
Python 3.9.7
nftables v1.0.0 (Fearless Fosdick #2)
yep latest git Commits
root@firewall:/opt/prometheus-nftables-exporter# git pull
Already up to date.
added in the End of my NFT Config
# Monitoring
tcp dport { 80, 443 } meter http-limit { ip saddr limit rate over 100/second} counter name http-denied drop
tcp dport { 80, 443 } meter http6-limit { ip6 saddr limit rate over 100/second } counter name http-denied drop
tcp dport { 80, 443 } counter name http-allowed accept
Bash Log
root@firewall:/opt/prometheus-nftables-exporter# NFTABLES_EXPORTER_LOG_LEVEL=DEBUG MAXMIND_LICENSE_KEY=<maxindkey> NFTABLES_EXPORTER_UPDATE_PERIOD=0 python3 ./main.py
INFO:nftables-exporter:listing on :9630
INFO:nftables-exporter:geoip lookup enabled
DEBUG:nftables-exporter:database checksum 6f28a480539a2f6a46a824127b2006c118acfc1e09eeb6b2d32d08e31ad74f00
INFO:nftables-exporter:maxmind database stored at data/GeoLite2-Country_20211026/GeoLite2-Country.mmdb
INFO:nftables-exporter:startup complete
DEBUG:nftables-exporter:collecting metrics
DEBUG:nftables-exporter:fetching nftables ruleset
DEBUG:nftables-exporter:fetching nftables ruleset
DEBUG:nftables-exporter:fetching nftables counters
DEBUG:nftables-exporter:fetching nftables maps
Traceback (most recent call last):
File "/opt/prometheus-nftables-exporter/./main.py", line 294, in <module>
main()
File "/opt/prometheus-nftables-exporter/./main.py", line 42, in main
collect_metrics(*metrics, geoip_db=database)
File "/opt/prometheus-nftables-exporter/./main.py", line 108, in collect_metrics
for labels, value in annotate_elements_with_country(item, geoip_db):
File "/opt/prometheus-nftables-exporter/./main.py", line 152, in annotate_elements_with_country
raise TypeError(f'got element of unexpected type {element.__class__.__name__}')
TypeError: got element of unexpected type list
dadevel commented
Thanks, I'll have a detailed look later this week and report back.
dadevel commented
The bug is not really fixed, but at least it should not crash anymore. It would be nice if you could try the new version (v2.0.1) and post the debug log again.