new options

This commit is contained in:
Mateusz Gruszczyński
2025-11-03 09:53:30 +01:00
parent 7a33291342
commit acef7eb610

View File

@@ -51,24 +51,24 @@ def parse_haproxy_stats(stats_data):
try:
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):
bytes_in_mb = '0.00'
bytes_in_mb = 0.0
try:
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):
bytes_out_mb = '0.00'
bytes_out_mb = 0.0
data.append({
'frontend_name': row.get('pxname', 'Unknown'),
'server_name': row.get('svname', 'Unknown'),
'4xx_errors': hrsp_4xx,
'5xx_errors': hrsp_5xx,
'bytes_in_mb': bytes_in_mb,
'bytes_out_mb': bytes_out_mb,
'conn_tot': conn_tot, # ✅ Teraz INT
'bytes_in_mb': bytes_in_mb, # ✅ Float
'bytes_out_mb': bytes_out_mb, # ✅ Float
'conn_tot': conn_tot, # ✅ Int
})
return data