forked from sysdiglabs/sysdig-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint_user_info.py
More file actions
executable file
·50 lines (40 loc) · 906 Bytes
/
print_user_info.py
File metadata and controls
executable file
·50 lines (40 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
#
# Print email, current and maximum number of agents for the Sysdig Cloud user
# identified by the given token.
#
import sys
from sdcclient import SdcClient
#
# Parse arguments
#
if len(sys.argv) != 2:
print(('usage: %s <sysdig-token>' % sys.argv[0]))
print('You can find your token at https://app.sysdigcloud.com/#/settings/user')
sys.exit(1)
sdc_token = sys.argv[1]
#
# Instantiate the SDC client
#
sdclient = SdcClient(sdc_token)
#
# Get the required info
#
ok, res = sdclient.get_user_info()
if ok:
uinfo = res
else:
print(res)
sys.exit(1)
ok, res = sdclient.get_n_connected_agents()
#
# Print the results
#
if ok:
nagents = res
else:
print(res)
sys.exit(1)
print(('User Email: ' + uinfo['user']['username']))
print(('Current Agents: %d' % nagents))
print(('Max Agents: %s' % uinfo['user']['customerSettings']['plan']['maxAgents']))