Hi. I have a problem when request subnet utilization report with many subnet. This change fix this problem for me
diff --git a/Netdisco/lib/App/Netdisco/DB/Result/Virtual/SubnetUtilization.pm b/Netdisco/lib/App/Netdisco/DB/Result/Virtual/SubnetUtilization.pm
index 1ce4d9d..e3b6778 100644
--- a/Netdisco/lib/App/Netdisco/DB/Result/Virtual/SubnetUtilization.pm
+++ b/Netdisco/lib/App/Netdisco/DB/Result/Virtual/SubnetUtilization.pm
@@ -14,7 +14,7 @@ PACKAGE->result_source_instance->view_definition(<<'ENDSQL');
SELECT net as subnet,
power(2, (32 - masklen(net))) as subnet_size,
count(DISTINCT ip) as active,
- round(100 * count(DISTINCT ip) / (power(2, (32 - masklen(net))) - 2)) as percent
+ round(100 * count(DISTINCT ip) / (power(2, (32 - masklen(net))))) as percent
FROM (
SELECT DISTINCT net, ni.ip
FROM subnets s1, node_ip ni
May be, this way is wrong. Can you explain is my fix is correct?
Thank you.
Hello, yes, thanks for this bug report and patch!!
What is happening is that if you have a /31 prefix on your network then the maths causes a divide-by-zero error. Your fix removes this error.
More info on /31:
http://packetlife.net/blog/2008/jun/18/using-31-bit-subnets-on-point-point-links/
I have applied the fix for the next release.