Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHCP graph for Vlan #2405

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

stveit
Copy link
Contributor

@stveit stveit commented May 5, 2022

Fixes #2373

Graph dhcp statistics on vlan page

@github-actions
Copy link

github-actions bot commented May 5, 2022

Test results

     12 files       12 suites   11m 31s ⏱️
3 083 tests 2 987 ✔️   96 💤 0
8 724 runs  8 436 ✔️ 288 💤 0

Results for commit d47a49f.

♻️ This comment has been updated with latest results.

stveit added 4 commits May 5, 2022 09:48
if there havent been added any new datapoints in gaphite recently  (5 or 10 minutes
 it seems) then the previous function would not work, even if you changed
start to 1year instead of 5 min
maybe shouldnt use max as a variable name
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good so far, but the failing tests need to be addresses, as mentioned in my inline comments.

Also (and I realize this is on me, not having formally defined the metric path "standard" yet), the metric paths will not necessarilly conform to nav\.dhcp\.vlan\d+\.. As the original spec says in #2369:

The network names can also be something like vlan1100_some_description, or some_description_vlan1100, but this should still match as VLAN 1100 in NAV.

An extra level in the metric path for location may also be needed. This could in reality be any prefix configured into the integration script, something like:

VLAN numbers can be reused, even though they are separate broadcast domains. This typically happens on separate locations in a WAN, though - so be prepared that the path pattern may become a bit more complex...

<h2>DHCP graphs</h2>

<ul class="small-block-grid-1 large-block-grid-2">
{% if vlan.has_dhcp_stats %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As evidenced by the failing tests, this introduces a dependency to a running Graphite server in the CI test suite - and the CI suite doesn't currently spin up a Graphite server. This causes the rendering of this page to crash with a GraphiteUnreachableError.

We could go about this by adding a Graphite server to the CI suite, but this page would still crash if the production Graphite becomes unreachable.

I suggest you handle this the same as some other places where the rendered HTML is dependent on querying Graphite: If Graphite isn't reachable, just display the error message "Graphite server is not reachable" instead of the graph widget (this is done where availability stats are concerned in the main tab of a device's ipdevinfo page).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graphite error fixed, so i guess this is on hold until the metric path is defined

@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #2405 (d47a49f) into master (7363b53) will increase coverage by 0.07%.
The diff coverage is 20.83%.

@@            Coverage Diff             @@
##           master    #2405      +/-   ##
==========================================
+ Coverage   52.55%   52.62%   +0.07%     
==========================================
  Files         552      552              
  Lines       40152    40165      +13     
==========================================
+ Hits        21100    21136      +36     
+ Misses      19052    19029      -23     
Impacted Files Coverage Δ
python/nav/web/info/vlan/views.py 24.57% <14.28%> (-0.65%) ⬇️
python/nav/models/manage.py 71.19% <21.42%> (-0.57%) ⬇️
python/nav/metrics/templates.py 53.48% <33.33%> (-0.73%) ⬇️
python/nav/report/generator.py 71.25% <0.00%> (-1.40%) ⬇️
python/nav/web/seeddb/page/vlan.py 59.57% <0.00%> (ø)
python/nav/web/info/images/utils.py 40.00% <0.00%> (ø)
python/nav/web/seeddb/page/prefix.py 59.25% <0.00%> (ø)
python/nav/statemon/RunQueue.py 65.18% <0.00%> (+0.95%) ⬆️
python/nav/web/api/v1/serializers.py 94.39% <0.00%> (+1.72%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7363b53...d47a49f. Read the comment docs.

stveit added 2 commits June 13, 2022 09:33
this check was existed, then was removed in a previous commit
when checking for connectiong errors to graphite, and now
im bringing it back
@sonarcloud
Copy link

sonarcloud bot commented Jun 13, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add functionality to NAV to graph DHCP lease stats on each VLAN page in NAV
2 participants