new options
This commit is contained in:
@@ -51,24 +51,24 @@ def parse_haproxy_stats(stats_data):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bin_bytes = float(row.get('bin', 0) or 0)
|
bin_bytes = float(row.get('bin', 0) or 0)
|
||||||
bytes_in_mb = f'{bin_bytes / (1024 * 1024):.2f}'
|
bytes_in_mb = bin_bytes / (1024 * 1024) # ✅ FLOAT, nie string!
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
bytes_in_mb = '0.00'
|
bytes_in_mb = 0.0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bout_bytes = float(row.get('bout', 0) or 0)
|
bout_bytes = float(row.get('bout', 0) or 0)
|
||||||
bytes_out_mb = f'{bout_bytes / (1024 * 1024):.2f}'
|
bytes_out_mb = bout_bytes / (1024 * 1024) # ✅ FLOAT, nie string!
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
bytes_out_mb = '0.00'
|
bytes_out_mb = 0.0
|
||||||
|
|
||||||
data.append({
|
data.append({
|
||||||
'frontend_name': row.get('pxname', 'Unknown'),
|
'frontend_name': row.get('pxname', 'Unknown'),
|
||||||
'server_name': row.get('svname', 'Unknown'),
|
'server_name': row.get('svname', 'Unknown'),
|
||||||
'4xx_errors': hrsp_4xx,
|
'4xx_errors': hrsp_4xx,
|
||||||
'5xx_errors': hrsp_5xx,
|
'5xx_errors': hrsp_5xx,
|
||||||
'bytes_in_mb': bytes_in_mb,
|
'bytes_in_mb': bytes_in_mb, # ✅ Float
|
||||||
'bytes_out_mb': bytes_out_mb,
|
'bytes_out_mb': bytes_out_mb, # ✅ Float
|
||||||
'conn_tot': conn_tot, # ✅ Teraz INT
|
'conn_tot': conn_tot, # ✅ Int
|
||||||
})
|
})
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|||||||
Reference in New Issue
Block a user