Commit a818fb3f authored by Ad Schellevis's avatar Ad Schellevis

(netflow/flowd) validate connection in BaseFlowAggregator

parent 62362038
......@@ -221,7 +221,8 @@ class BaseFlowAggregator(object):
:param expire: cleanup table, remove data older then [expire] seconds
:return: None
"""
if 'timeserie' in self._known_targets and self.resolution in self.history_per_resolution():
if self.is_db_open() and 'timeserie' in self._known_targets \
and self.resolution in self.history_per_resolution():
self._update_cur.execute('select max(mtime) as "[timestamp]" from timeserie')
last_timestamp = self._update_cur.fetchall()[0][0]
if type(last_timestamp) == datetime.datetime:
......@@ -238,6 +239,7 @@ class BaseFlowAggregator(object):
:param fields: fields to retrieve
:return: iterator returning dict records (start_time, end_time, [fields], octets, packets)
"""
if self.is_db_open() and 'timeserie' in self._known_targets:
# validate field list (can only select fields in self.agg_fields)
select_fields = list()
for field in self.agg_fields:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment