Commit c3faadf3 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(cpativeportal) ... and add the field to the print :)

(cherry picked from commit fa9639fe)
parent e3c4614c
...@@ -59,17 +59,17 @@ if parameters['output_type'] != 'json': ...@@ -59,17 +59,17 @@ if parameters['output_type'] != 'json':
'total_bytes': 'total_bytes', 'total_bytes': 'total_bytes',
'idletime': 'idletime', 'idletime': 'idletime',
'totaltime': 'totaltime', 'totaltime': 'totaltime',
'acc_session_timeout': 'acc_session_timeout' 'acc_timeout': 'acc_session_timeout'
} }
heading_format = '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s '\ heading_format = '%(sessionId)-30s %(userName)-25s %(ipAddress)-20s %(macAddress)-20s '\
+ '%(total_bytes)-15s %(idletime)-10s %(totaltime)-10s' + '%(total_bytes)-15s %(idletime)-10s %(totaltime)-10s %(acc_timeout)-10s'
print (heading_format % heading) 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']
frmt = '%(sessionId)-30s %(userName)-20s %(ipAddress)-20s %(macAddress)-20s '\ frmt = '%(sessionId)-30s %(userName)-25s %(ipAddress)-20s %(macAddress)-20s '\
+ '%(total_bytes)-15s %(idletime)-10d %(totaltime)-10d' + '%(total_bytes)-15s %(idletime)-10d %(totaltime)-10d %(acc_session_timeout)-10s'
print (frmt % item) 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