Skip to content

Commit

Permalink
Reporting/Health - new rrd fetchData.py can't cope with rrd files con…
Browse files Browse the repository at this point in the history
…taining a single measurement very well. https://forum.opnsense.org/index.php?topic=36634.0
  • Loading branch information
AdSchellevis committed Oct 26, 2023
1 parent 837de47 commit 8439eeb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/opnsense/scripts/health/fetchData.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def element_to_dict(elem):
if rra.get('cf') == 'AVERAGE':
record = {'ds': []}
ds_count = len(ruleData['ds'])
for ds in ruleData['ds']:
for ds in (ruleData['ds'] if type(ruleData['ds']) is list else [ruleData['ds']]):
record['ds'].append({
'key': ds['name'].strip() if ds.get('name') else '',
'values': []
Expand All @@ -90,7 +90,7 @@ def element_to_dict(elem):
record['recorded_time'] = last_ts - first_ts
for idx, row in enumerate(rra['database']['row']):
this_ts = first_ts + (record['step_size'] * idx)
for vidx, v in enumerate(row['v']):
for vidx, v in enumerate(row['v'] if type(row['v']) is list else [row['v']]):
if ds_count >= vidx:
record['ds'][vidx]['values'].append([
this_ts * 1000,
Expand Down

0 comments on commit 8439eeb

Please sign in to comment.