File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -191,9 +191,18 @@ def get_metrics(name):
191191
192192 #CG Lag and WAN stats are in the Link stats section
193193 for repname in rawmetrics ['Group' ][group ]['Link stats' ]:
194- #Get CG WAN metrics (remove 'Mbps' from end + convert to float and then bits)
195- metrics [group + '_WAN_Traffic' ] = float (rawmetrics ['Group' ][group ]['Link stats' ][repname ]['Replication' ]['WAN traffic' ][:- 4 ]) * 1024 * 1024
196-
194+ #Get CG WAN metrics (Work out the unit from end + convert to float and then bits)
195+ ##(remove 'Mbps' from end + convert to float and then bits)
196+ #metrics[group + '_WAN_Traffic'] = float(rawmetrics['Group'][group]['Link stats'][repname]['Replication']['WAN traffic'][:-4]) * 1024 * 1024
197+ cg_wan_str = rawmetrics ['Group' ][group ]['Link stats' ][repname ]['Replication' ]['WAN traffic' ]
198+ cg_wan_bw = float (cg_wan_str [:- 4 ])
199+ cg_wan_unit = cg_wan_str [- 4 :]
200+ if 'Mbps' in cg_wan_unit :
201+ cg_wan_bw = cg_wan_bw * 1024 * 1024
202+ else :
203+ cg_wan_bw = cg_wan_bw * 1024
204+ metrics [group + '_WAN_Traffic' ] = cg_wan_bw
205+
197206 #Get CG Lag metrics
198207 for lagfields in rawmetrics ['Group' ][group ]['Link stats' ][repname ]['Replication' ]['Lag' ]:
199208 if 'Data' in lagfields :
You can’t perform that action at this time.
0 commit comments