Skip to content

Commit fca0fb5

Browse files
committed
Fixed the recoverpoint consistency group WAN units when traffic is low
1 parent 30917fd commit fca0fb5

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

recoverpoint/recoverpoint.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff 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:

0 commit comments

Comments
 (0)