From 8439eeb90ce5685e52b266e5288fe6fc84fa0df1 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Thu, 26 Oct 2023 14:40:02 +0200 Subject: [PATCH] Reporting/Health - new rrd fetchData.py can't cope with rrd files containing a single measurement very well. https://forum.opnsense.org/index.php?topic=36634.0 --- src/opnsense/scripts/health/fetchData.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opnsense/scripts/health/fetchData.py b/src/opnsense/scripts/health/fetchData.py index 222cf8343..79dd64c0a 100755 --- a/src/opnsense/scripts/health/fetchData.py +++ b/src/opnsense/scripts/health/fetchData.py @@ -76,7 +76,7 @@ if len(sys.argv) > 1: 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': [] @@ -90,7 +90,7 @@ if len(sys.argv) > 1: 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,