Commit 6e9a10aa authored by Ad Schellevis's avatar Ad Schellevis

(captiveportal) add acc_session_timeout to session info

parent ba7db37e
...@@ -58,15 +58,18 @@ if parameters['output_type'] != 'json': ...@@ -58,15 +58,18 @@ if parameters['output_type'] != 'json':
'macAddress': 'mac_address', 'macAddress': 'mac_address',
'total_bytes': 'total_bytes', 'total_bytes': 'total_bytes',
'idletime': 'idletime', 'idletime': 'idletime',
'totaltime': 'totaltime' 'totaltime': 'totaltime',
'acc_session_timeout': 'acc_session_timeout'
} }
print '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s '\ heading_format = '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s '\
+ '%(total_bytes)-15s %(idletime)-10s %(totaltime)-10s' % heading + '%(total_bytes)-15s %(idletime)-10s %(totaltime)-10s'
print (heading_format % heading)
for item in response: for item in response:
item['total_bytes'] = (item['bytes_out'] + item['bytes_in']) item['total_bytes'] = (item['bytes_out'] + item['bytes_in'])
item['idletime'] = time.time() - item['last_accessed'] item['idletime'] = time.time() - item['last_accessed']
item['totaltime'] = time.time() - item['startTime'] item['totaltime'] = time.time() - item['startTime']
print '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s '\ frmt = '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s '\
+ '%(total_bytes)-15s %(idletime)-10d %(totaltime)-10d' % item + '%(total_bytes)-15s %(idletime)-10d %(totaltime)-10d'
print (frmt % item)
else: else:
print(ujson.dumps(response)) print(ujson.dumps(response))
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