HolgerHees / smartserver

SmartHome Server deployment setup
http://www.intranet-of-things.com/smarthome/infrastructure/server/setup/
GNU General Public License v3.0
26 stars 7 forks source link

IndexError on roles/system_service/templates/opt/system_service_libs/lib/netflow/processor.py #9

Closed toffee closed 1 year ago

toffee commented 1 year ago

The query

results = self.influxdb.query('SELECT "group","value" FROM "netflow_size" WHERE time >= now() - 358m AND "group"::tag != \'normal\'')

in my system returns an empty array. This leads to an exception (IndexError: list index out of range) here

Adding a check if the array is empty solve the issue. Proposed changes in this commit.

Thank you!

HolgerHees commented 1 year ago

thanks for telling me. I refactored the related part a bit and it should be now more robust.

https://github.com/HolgerHees/smartserver/commit/4d9c97ccdab42cc27ce186ce4c7bcee50da58481#diff-089e2b2c8c5ef65780514639ac78a1417a04e2e4db10696f84606c377f846de4