Add functionality to graph DHCP stats on each VLAN page and Prefix page in NAV #3633
Add functionality to graph DHCP stats on each VLAN page and Prefix page in NAV #3633lunkwill42 merged 4 commits intoUninett:masterfrom
Conversation
3439a9d to
90682bc
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3633 +/- ##
==========================================
+ Coverage 63.31% 63.32% +0.01%
==========================================
Files 618 618
Lines 45761 45873 +112
Branches 43 43
==========================================
+ Hits 28973 29051 +78
- Misses 16778 16812 +34
Partials 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
db85e5a to
50cb13a
Compare
|
lunkwill42
left a comment
There was a problem hiding this comment.
Overall the code seems nicely structured. After a long F2F session, I would say my most important suggestion is to split this into two PRs: One for the rewrite of the backend functionality, and one for the purely front-end related additions.
Lastly, I understand there is also a documentation PR coming, which is nice.
Also a reminder to properly enable the pre-commit hooks in each clone you have: Linting failures abound here... |
|
Re: Tip about splitting into multiple PRs: I cannot recall whether you have permission to push branches on the upstream repo, but if you do, it makes it easier to build PRs that depend on each other. The first PR would have |
800fb70 to
00ee9a5
Compare
|
00ee9a5 to
29bc3fb
Compare
|
Rebasing on top of #3766.. |
29bc3fb to
2aac743
Compare
lunkwill42
left a comment
There was a problem hiding this comment.
Alright, let's go with this!
I have an inline concern that should be followed up with a new issue or PR.
There's also this non-blocking follow-up item: If Graphite is unavailable, I get a very useful red "Graphite unavailable" message in the GUI. However, the backend request fails with an unhandled 500 message, which ultimately gets sent as an e-mail to the site admin. These should really be handled, there is no reason to bother the site admin with lots of tracebacks for an issue that ultimately is not a problem in NAV but a problem with how Graphite is operating (which should be monitored in other ways)
bb55cb4 to
7413313
Compare
These can be used instead of string interpolations which quickly become unwieldy when you want a little bit more advanced Graphite renders.
The function fetch_graph_urls_for_prefixes takes a set of prefixes (e.g. obtained from a models.manage.Prefix or from a models.manage.Vlan) and returns one url per DHCP graph from Graphite related to one or more of the prefixes. Each url returns a JSON with graph data.
..a VLAN/Prefix page has DHCP graphs displayed if NAV has collected some recent enough DHCP stats for IP addresses that intersect that VLAN/Prefix.
2aac743 to
9518a66
Compare
|





Scope and purpose
Fixes #2373. Another PR intends to add documentation and release notes.
This pull request
Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.
Added/changed documentationsee Add documentation for DHCP stats #3785<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.Testing It For Yourself
You can use the script below to fill the prefixes
192.0.0.0/24,192.0.1.0/24,192.0.0.0/26, and::2:0:0/96with DHCP stats (you might need to installsocatandgawk, and you might need to change127.0.0.1to the address of your Carbon/Graphite database):Here's a screencast (which, after the most recent changes, is a bit outdated, but still representative):
screencast.mp4
At
2:00in the video, notice that the graph labelledDHCP ranges in 'guest' on server 'kea-trd'has stats from ranges in both192.0.2.0/24and198.51.100.0/24despite vlan 20 only containing192.0.2.0/24. This is because whenever a group (here:'guest' on server 'kea-trd') has at least one range/pool/subnet overlapping with the VLAN/Prefix, the whole group will be displayed on that VLAN/Prefix's page.