Yes the regular expression is trying to run on something that is not a string.
1. We fetch the results of dhcpd-pools in 'exec_dhcpd_pools()' and store it as json 2. The result is a dictionary/hashmap where we care about the key "shared_networks" only. The value of the key is a list. 3. Then in 'render()' we use '_tuplify()' to loop over the list from "shared-networks" and push every key-value pair to graphite 4. Tuplify assumes that all "location"s have values that are strings that contain "vlan"
So, it crashes on your location being "All networks"! This must be considered a bug.
I think I'll add a debug option to make it easier to see what is going on as well.
________________________________________ From: Ingeborg Hellemo ingeborg.hellemo@uit.no Sent: Friday, November 11, 2022 15:20 To: nav-users@lister.sikt.no Subject: [Nav-users] Re: Any documentation about contrib/isc_dhpcd_graphite.py ?
ingeborg.hellemo@uit.no said:
File "/root/bin/isc_dhpcd_graphite.py", line 163, in _tuplify vlan = _clean_vlan(vlan_stat["location"]) File "/root/bin/isc_dhpcd_graphite.py", line 173, in _clean_vlan return regex.group() AttributeError: 'NoneType' object has no attribute 'group'
I've tried to look at the code and I think the error is related to the output of dhcpd-pools. We run our DHCP-server in failover-mode. I don't know if this has an impact of the output, but here are some output examples from our server(s):
{ "location":"All networks", "range":"158.39.125.10 - 158.39.125.254", "first_ip":"158.39.125.10", "last_ip":"158.39.125.254", "defined":245, "used":80, "touched":100, "free":165, "percent":32.6531, "touch_count":180, "touch_percent":73.4694, "backup_count":65, "backup_percent":26.5306, "status":0 }, { "location":"All networks", "range":"158.39.132.16 - 158.39.135.254", "first_ip":"158.39.132.16", "last_ip":"158.39.135.254", "defined":1007, "used":261, "touched":449, "free":746, "percent":25.9186, "touch_count":710, "touch_percent":70.5065, "backup_count":297, "backup_percent":29.4935, "status":0 },
--Ingeborg -- Ingeborg Østrem Hellemo -- ingeborg.hellemo@uit.no Dep. of Information Technology --- Univ. of Tromsø
_______________________________________________ Nav-users mailing list -- nav-users@lister.sikt.no To unsubscribe send an email to nav-users-leave@lister.sikt.no