Skip to content

Commit 3fe5390

Browse files
committed
Device: Handle uptime field even when poller info is missing
Signed-off-by: Dinesh Dutt <[email protected]>
1 parent 08dbe99 commit 3fe5390

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

suzieq/engines/pandas/device.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def get(self, **kwargs):
8484
(df['status_y'] != 0) & (df['status_y'] != 200) &
8585
(df['status'] == "N/A"),
8686
'neverpoll', df['status'])
87+
8788
if 'version' in df.columns:
8889
df['version'] = np.where(df.status_y == 418, 'unsupported',
8990
df.version)
@@ -100,13 +101,13 @@ def get(self, **kwargs):
100101
df.address = np.where(df['address'] == 'N/A', df['hostname'],
101102
df['address'])
102103

103-
if 'uptime' in columns or columns == ['*']:
104-
uptime_cols = (df['timestamp'] -
105-
humanize_timestamp(df['bootupTimestamp']*1000,
106-
self.cfg.get('analyzer', {}).get('timezone',
107-
None)))
108-
uptime_cols = pd.to_timedelta(uptime_cols, unit='s')
109-
df.insert(len(df.columns)-1, 'uptime', uptime_cols)
104+
if 'uptime' in columns or columns == ['*']:
105+
uptime_cols = (df['timestamp'] -
106+
humanize_timestamp(df['bootupTimestamp']*1000,
107+
self.cfg.get('analyzer', {}).get('timezone',
108+
None)))
109+
uptime_cols = pd.to_timedelta(uptime_cols, unit='s')
110+
df.insert(len(df.columns)-1, 'uptime', uptime_cols)
110111

111112
if df.empty:
112113
return df[fields]

0 commit comments

Comments
 (0)