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

Aggregate MRTG data broken in 4.6.0 #348

Closed
rasssta opened this issue Oct 5, 2017 · 5 comments
Closed

Aggregate MRTG data broken in 4.6.0 #348

rasssta opened this issue Oct 5, 2017 · 5 comments

Comments

@rasssta
Copy link

rasssta commented Oct 5, 2017

Hi,

I noticed that, most of, my aggregate graphs (for switches / infras / ixp) were broken since I upgraded from 4.5 to 4.6.0. Seems like the MaxBytes value for these types are calulated with a value being 1/1000 out of what it should be. I did a diff on one of the switch aggregates from 4.5.0 and found this result:

< MaxBytes[switch-aggregate-00019-bits]:  9750000000
---
> MaxBytes[switch-aggregate-00019-bits]:  9750000

The reason I said "most of" above is because some of my switches / infras that are running very low on usage (below 1/1000) works just fine.

When I did a manual maxbytes*1000 change on MaxBytes on my infra and ixp sections in mrtg.cfg they started to work again.

Funny thing is that customer graphs work just fine, the calculation for cust aggregates are correct for some reason.

How do I change this in a proper way?

@rasssta
Copy link
Author

rasssta commented Oct 6, 2017

Temp fix:

# diff -u resources/views/services/grapher/mrtg/aggregates.foil.php resources/skins/sthix/services/grapher/mrtg/aggregates.foil.php 
--- resources/views/services/grapher/mrtg/aggregates.foil.php	2017-10-06 10:54:21.888493837 +0200
+++ resources/skins/sthix/services/grapher/mrtg/aggregates.foil.php	2017-10-06 10:58:34.379089094 +0200
@@ -39,7 +39,7 @@
                 'data'         => $t->data,
                 'graphTitle'   => sprintf( config('identity.orgname') . " %%s / second on %s", $infra->getName() ),
                 'directory'    => sprintf( "infras/%03d", $infraid ),
-                'maxbytes'     => $t->data['infraports_maxbytes'][$infraid],
+                'maxbytes'     => ($t->data['infraports_maxbytes'][$infraid] * 1000),
             ]
         );
 
@@ -57,7 +57,7 @@
                 'data'         => $t->data,
                 'graphTitle'   => sprintf( config('identity.orgname') . " - %%s / second" ),
                 'directory'    => sprintf( "ixp" ),
-                'maxbytes'     => $t->data['ixpports_maxbytes'],
+                'maxbytes'     => ($t->data['ixpports_maxbytes'] * 1000),
             ]
         );
     endif;
# diff -u resources/views/services/grapher/mrtg/switch-aggregates.foil.php resources/skins/sthix/services/grapher/mrtg/switch-aggregates.foil.php 
--- resources/views/services/grapher/mrtg/switch-aggregates.foil.php	2017-08-14 21:36:05.751873450 +0200
+++ resources/skins/sthix/services/grapher/mrtg/switch-aggregates.foil.php	2017-10-06 10:54:44.317086185 +0200
@@ -39,7 +39,7 @@
                 'data'         => $t->data,
                 'graphTitle'   => sprintf( config('identity.orgname') . " - Peering %%s / second on %s", $switch->getName() ),
                 'directory'    => sprintf( "switches/%03d", $switchid ),
-                'maxbytes'     => $t->data['swports_maxbytes'][$switchid],
+                'maxbytes'     => ($t->data['swports_maxbytes'][$switchid] * 1000),
             ]
         );

@nickhilliard
Copy link
Member

this patch shouldn't be necessary - all the maxbytes figures are multipled by 1000000/8 before they are emitted to the mrtg template:

https://github.com/inex/IXP-Manager/blob/master/app/Services/Grapher/Backend/Mrtg.php#L198-L201

If you need to multiply them explicitly by 1000 in the foil template, then that means they're stored incorrectly in the switchport table.

@barryo
Copy link
Member

barryo commented Oct 6, 2017

@rasssta - not sure how you were getting working values with this bug... but it's fixed now and a CI test added to ensure no regressions.

@barryo barryo closed this as completed Oct 6, 2017
@barryo
Copy link
Member

barryo commented Oct 6, 2017

Or, I should say: I fixed the bug I found when looking at this.

Not sure at all how you were getting working values with this bug in effect.

I was going to guess that you had the wrong port speeds configured (e.g.. 10Mb instead of 10,000Mb) but the correct code actually uses the port speed as discovered by SNMP polls of the switch.

I.e. https://github.com/inex/IXP-Manager/wiki/Updating-Switches-and-Ports-via-SNMP

@rasssta
Copy link
Author

rasssta commented Oct 6, 2017

I've deployed the fix and it seems to work. Thx! :)

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

No branches or pull requests

3 participants