mweinelt / kea-exporter

Export Kea Metrics in the Prometheus Exposition Format
MIT License
34 stars 17 forks source link

Support failed allocation metrics in 2.2.0 #25

Closed mweinelt closed 2 years ago

mweinelt commented 2 years ago
2. **New statistics**: New statistics were have been added to kea-dhcp4 
to counts cases of host reservation conflicts. They are tracked at both 
the global and subnet level as `v4-reservation-conflicts` and 
`subnet[id].v4-reservation-conflicts`, respectively [#2419].
9. **New statistics for failed allocations**. If the class requirements 
for your address pools are defined too tightly, it is possible that some 
clients will not get an address. To ease the investigation of this 
problem, many new statistics were added:
`v4-allocation-fail`, `v4-allocation-fail-shared-network`, 
`v4-allocation-fail-subnet`, `v4-allocation-fail-no-pools`, 
`v4-allocation-fail-classes`, `subnet[X].v4-allocation-fail`, 
`subnet[X].v4-allocation-fail-shared-network`, 
`subnet[X].v4-allocation-fail-subnet`, 
`subnet[X].v4-allocation-fail-no-pools`, 
`subnet[X].v4-allocation-fail-classes`,
`v6-allocation-fail`, `v6-allocation-fail-shared-network`, 
`v6-allocation-fail-subnet`, `v6-allocation-fail-no-pools`, 
`v6-allocation-fail-classes`, `subnet[X].v6-allocation-fail`, 
`subnet[X].v6-allocation-fail-shared-network`, 
`subnet[X].v6-allocation-fail-subnet`, 
`subnet[X].v6-allocation-fail-no-pools`, and 
`subnet[X].v6-allocation-fail-classes` [#2054].

https://downloads.isc.org/isc/kea/2.2.0/Kea-2.2.0-ReleaseNotes.txt

glendekoning commented 2 years ago

Heya @mweinelt, i think i have covered everything. let me know if you think i should make any changes.

jmbaur commented 2 years ago

I am getting this crash without the new metrics supported:

Oct 11 18:17:37 artichoke kea-exporter[2626]: Listening on http://0.0.0.0:9547
Oct 11 18:17:37 artichoke kea-exporter[2626]: Traceback (most recent call last):
Oct 11 18:17:37 artichoke kea-exporter[2626]:   File "/nix/store/8rvb3c4xi1rcbi19kwjgc447pp1jv9b8-kea-exporter-0.4.2/bin/.kea-exporter-wrapped", line 9, in <module>
Oct 11 18:17:37 artichoke kea-exporter[2626]:     sys.exit(cli())
Oct 11 18:17:37 artichoke kea-exporter[2626]:   File "/nix/store/m13lkjba0kf26aa4j65lj858lx7drs14-python3.10-click-8.1.3/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
Oct 11 18:17:37 artichoke kea-exporter[2626]:     return self.main(*args, **kwargs)
Oct 11 18:17:37 artichoke kea-exporter[2626]:   File "/nix/store/m13lkjba0kf26aa4j65lj858lx7drs14-python3.10-click-8.1.3/lib/python3.10/site-packages/click/core.py", line 1055, in main
Oct 11 18:17:37 artichoke kea-exporter[2626]:     rv = self.invoke(ctx)
Oct 11 18:17:37 artichoke kea-exporter[2626]:   File "/nix/store/m13lkjba0kf26aa4j65lj858lx7drs14-python3.10-click-8.1.3/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
Oct 11 18:17:37 artichoke kea-exporter[2626]:     return ctx.invoke(self.callback, **ctx.params)
Oct 11 18:17:37 artichoke kea-exporter[2626]:   File "/nix/store/m13lkjba0kf26aa4j65lj858lx7drs14-python3.10-click-8.1.3/lib/python3.10/site-packages/click/core.py", line 760, in invoke
Oct 11 18:17:37 artichoke kea-exporter[2626]:     return __callback(*args, **kwargs)
Oct 11 18:17:37 artichoke kea-exporter[2626]:   File "/nix/store/8rvb3c4xi1rcbi19kwjgc447pp1jv9b8-kea-exporter-0.4.2/lib/python3.10/site-packages/kea_exporter/cli.py", line 22, in cli
Oct 11 18:17:37 artichoke kea-exporter[2626]:     exporter.update()
Oct 11 18:17:37 artichoke kea-exporter[2626]:   File "/nix/store/8rvb3c4xi1rcbi19kwjgc447pp1jv9b8-kea-exporter-0.4.2/lib/python3.10/site-packages/kea_exporter/kea.py", line 518, in update
Oct 11 18:17:37 artichoke kea-exporter[2626]:     metric_info = self.metrics_dhcp6_map[key]
Oct 11 18:17:37 artichoke kea-exporter[2626]: KeyError: 'v6-allocation-fail'
Oct 11 18:17:38 artichoke systemd[1]: prometheus-kea-exporter.service: Main process exited, code=exited, status=1/FAILURE
mweinelt commented 2 years ago

In the meantime I've released version 0.4.4 that fails much more gracefully in the face of unknown metrics.