In [22]:
import json
from pprint import pprint
from IPython.display import Image
In [ ]:
 
In [ ]:
 
In [3]:
data = json.loads(open('sample_data_with_shapes_and_notices.json').read())
In [4]:
data.keys()
Out[4]:
dict_keys(['renderer', 'name', 'nodes', 'connections', 'serverUpdateTime'])
In [5]:
data['renderer']
Out[5]:
'global'
In [6]:
data['name']
Out[6]:
'edge'
In [7]:
data['serverUpdateTime']
Out[7]:
1477691777441
In [25]:
Image("04dec21-2.PNG")
Out[25]:
In [16]:
for idx, node in enumerate(data['nodes']):
    tnode = dict(**node)
    tnode['nodes'] = len(node['nodes'])
    tnode['connections'] = len(node['connections'])
    print(idx)
    pprint(tnode)
0
{'class': 'normal',
 'connections': 0,
 'displayName': 'INTERNET',
 'metadata': {},
 'name': 'INTERNET',
 'nodes': 0,
 'renderer': 'region'}
1
{'class': 'normal',
 'connections': 157,
 'displayName': 'US-EAST-1',
 'maxVolume': 96035.538,
 'metadata': {},
 'name': 'us-east-1',
 'nodes': 73,
 'props': {'maxSemaphores': [{'region': 'us-east-1',
                              'targetRegion': 'eu-west-1',
                              'value': '20'},
                             {'region': 'eu-west-1',
                              'targetRegion': 'us-west-2',
                              'value': '20'},
                             {'region': 'us-east-1',
                              'targetRegion': 'us-west-2',
                              'value': '200'},
                             {'region': 'us-west-2',
                              'targetRegion': 'us-east-1',
                              'value': '160'},
                             {'region': 'eu-west-1',
                              'targetRegion': 'us-east-1',
                              'value': '20'}]},
 'renderer': 'region',
 'updated': 1477690448572}
2
{'class': 'normal',
 'connections': 137,
 'displayName': 'EU-WEST-1',
 'maxVolume': 73535.998,
 'metadata': {},
 'name': 'eu-west-1',
 'nodes': 74,
 'props': {'maxSemaphores': [{'region': 'us-east-1',
                              'targetRegion': 'eu-west-1',
                              'value': '20'},
                             {'region': 'us-west-2',
                              'targetRegion': 'us-east-1',
                              'value': '160'},
                             {'region': 'eu-west-1',
                              'targetRegion': 'us-east-1',
                              'value': '20'},
                             {'region': 'eu-west-1',
                              'targetRegion': 'us-west-2',
                              'value': '20'},
                             {'region': 'us-east-1',
                              'targetRegion': 'us-west-2',
                              'value': '200'}]},
 'renderer': 'region',
 'updated': 1477690450280}
3
{'class': 'normal',
 'connections': 151,
 'displayName': 'US-WEST-2',
 'maxVolume': 67936.982,
 'metadata': {},
 'name': 'us-west-2',
 'nodes': 78,
 'props': {'maxSemaphores': [{'region': 'us-east-1',
                              'targetRegion': 'eu-west-1',
                              'value': '20'},
                             {'region': 'us-west-2',
                              'targetRegion': 'us-east-1',
                              'value': '160'},
                             {'region': 'eu-west-1',
                              'targetRegion': 'us-east-1',
                              'value': '20'},
                             {'region': 'eu-west-1',
                              'targetRegion': 'us-west-2',
                              'value': '20'},
                             {'region': 'us-east-1',
                              'targetRegion': 'us-west-2',
                              'value': '200'}]},
 'renderer': 'region',
 'updated': 1477690452072}
In [52]:
n
Out[52]:
{'metadata': {'streaming': 1},
 'nodes': [],
 'name': 'INTERNET',
 'renderer': 'focusedChild'}
In [ ]:
 
In [57]:
for n in data['nodes'][1]['nodes']:
    print({
        k:v
        for k,v in n.items()
        if k in ['name', 'renderer', 'node_type', 'class', 'metrics']
    })
{'name': 'viraemic', 'node_type': 'azure', 'class': 'warning', 'renderer': 'focusedChild'}
{'name': 'foetal', 'renderer': 'focusedChild'}
{'name': 'buglers', 'node_type': 'pipe', 'renderer': 'focusedChild'}
{'name': 'lassoing', 'renderer': 'focusedChild'}
{'name': 'proletarianised', 'renderer': 'focusedChild'}
{'name': 'neuritics', 'renderer': 'focusedChild'}
{'name': 'disseat', 'renderer': 'focusedChild'}
{'name': 'risks', 'renderer': 'focusedChild'}
{'name': 'wickyups', 'renderer': 'focusedChild'}
{'name': 'disenthral', 'renderer': 'focusedChild'}
{'name': 'macrurous', 'renderer': 'focusedChild'}
{'name': 'parrocks', 'renderer': 'focusedChild'}
{'name': 'yuppifies', 'renderer': 'focusedChild'}
{'name': 'commanderies', 'renderer': 'focusedChild'}
{'name': 'malvasias', 'renderer': 'focusedChild'}
{'name': 'perfectibilians', 'renderer': 'focusedChild'}
{'name': 'nanuas', 'renderer': 'focusedChild'}
{'name': 'overburning', 'renderer': 'focusedChild'}
{'name': 'veniremen', 'renderer': 'focusedChild'}
{'name': 'quittors', 'renderer': 'focusedChild'}
{'name': 'gainfully', 'renderer': 'focusedChild'}
{'name': 'unapproachabilities', 'renderer': 'focusedChild'}
{'name': 'arabesk', 'renderer': 'focusedChild'}
{'name': 'mispricing', 'renderer': 'focusedChild'}
{'name': 'majordomo', 'renderer': 'focusedChild'}
{'name': 'tanrec', 'renderer': 'focusedChild'}
{'name': 'semitropics', 'renderer': 'focusedChild'}
{'name': 'legwork', 'renderer': 'focusedChild'}
{'name': 'relocator', 'renderer': 'focusedChild'}
{'name': 'spuds', 'renderer': 'focusedChild'}
{'name': 'schemozzling', 'renderer': 'focusedChild'}
{'name': 'profulgent', 'renderer': 'focusedChild'}
{'name': 'brazed', 'renderer': 'focusedChild'}
{'name': 'gerents', 'renderer': 'focusedChild'}
{'name': 'infectivities', 'renderer': 'focusedChild'}
{'name': 'shidduchim', 'renderer': 'focusedChild'}
{'name': 'prickliest', 'renderer': 'focusedChild'}
{'name': 'imbalmers', 'renderer': 'focusedChild'}
{'name': 'blastodiscs', 'renderer': 'focusedChild'}
{'name': 'uraei', 'renderer': 'focusedChild'}
{'name': 'multiracialisms', 'renderer': 'focusedChild'}
{'name': 'cylindricalness', 'renderer': 'focusedChild'}
{'name': 'compellation', 'renderer': 'focusedChild'}
{'name': 'microparasites', 'node_type': 'user', 'renderer': 'focusedChild'}
{'name': 'immedicably', 'renderer': 'focusedChild'}
{'name': 'commerce', 'renderer': 'focusedChild'}
{'name': 'alignment', 'node_type': 'service', 'class': 'danger', 'renderer': 'focusedChild'}
{'name': 'methadone', 'renderer': 'focusedChild'}
{'name': 'remarkableness', 'renderer': 'focusedChild'}
{'name': 'reoxidize', 'renderer': 'focusedChild'}
{'name': 'salvability', 'renderer': 'focusedChild'}
{'name': 'playlisted', 'renderer': 'focusedChild'}
{'name': 'karroos', 'node_type': 'users', 'renderer': 'focusedChild'}
{'name': 'accounts', 'renderer': 'focusedChild'}
{'name': 'hounding', 'renderer': 'focusedChild'}
{'name': 'priviest', 'renderer': 'focusedChild'}
{'name': 'lycee', 'renderer': 'focusedChild'}
{'name': 'concatenates', 'renderer': 'focusedChild'}
{'name': 'oiks', 'renderer': 'focusedChild'}
{'name': 'nicompoops', 'renderer': 'focusedChild'}
{'name': 'corfhouses', 'renderer': 'focusedChild'}
{'name': 'overdosed', 'renderer': 'focusedChild'}
{'name': 'rummlegumptions', 'renderer': 'focusedChild'}
{'name': 'precited', 'renderer': 'focusedChild'}
{'name': 'previsionary', 'renderer': 'focusedChild'}
{'name': 'kaoliangs', 'renderer': 'focusedChild'}
{'name': 'bypath', 'node_type': 'storage', 'class': 'warning', 'renderer': 'focusedChild'}
{'name': 'hydroxyureas', 'renderer': 'focusedChild'}
{'name': 'gradine', 'renderer': 'focusedChild'}
{'name': 'atma', 'renderer': 'focusedChild'}
{'name': 'cleavage', 'renderer': 'focusedChild'}
{'name': 'appropriable', 'node_type': 'default', 'class': 'danger', 'renderer': 'focusedChild'}
{'name': 'INTERNET', 'renderer': 'focusedChild'}
In [23]:
Image("04dec21-1.PNG")
Out[23]:
In [24]:
[i for i in data['nodes'][3]['connections'] if i['source'] == 'INTERNET' and i['target'] == 'proxy-prod']
Out[24]:
[{'source': 'INTERNET',
  'target': 'proxy-prod',
  'metadata': {'streaming': 1},
  'metrics': {'warning': 0.9199999999999999,
   'danger': 55.14600000000001,
   'normal': 21140.684},
  'notices': [{'title': 'CPU usage average at 80%',
    'link': 'http://link/to/relevant/thing',
    'severity': 1},
   {'title': 'Reticulating splines'}]}]
In [58]:
Image("04dec21-5.PNG")
Out[58]:
In [59]:
[i for i in data['nodes'][1]['connections'] if i['source'] == 'viraemic']
Out[59]:
[{'source': 'viraemic',
  'target': 'disseat',
  'metadata': {'streaming': 1},
  'metrics': {'normal': 732.346, 'danger': 0.126}},
 {'source': 'viraemic',
  'target': 'compellation',
  'metadata': {'streaming': 1},
  'metrics': {'normal': 180.482}},
 {'source': 'viraemic',
  'target': 'risks',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.268, 'normal': 1447.2420000000002}},
 {'source': 'viraemic',
  'target': 'tanrec',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.042, 'normal': 82.05000000000001}},
 {'source': 'viraemic',
  'target': 'commerce',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.004, 'normal': 110.86400000000002}},
 {'source': 'viraemic',
  'target': 'remarkableness',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.254, 'normal': 104.708}},
 {'source': 'viraemic',
  'target': 'nanuas',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.37200000000000005, 'normal': 1767.798}},
 {'source': 'viraemic',
  'target': 'semitropics',
  'metadata': {'streaming': 1},
  'metrics': {'normal': 533.23, 'danger': 0.05}},
 {'source': 'viraemic',
  'target': 'blastodiscs',
  'metadata': {'streaming': 1},
  'metrics': {'normal': 281.146}},
 {'source': 'viraemic',
  'target': 'prickliest',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.828, 'normal': 279.064}},
 {'source': 'viraemic',
  'target': 'disenthral',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.002, 'normal': 37.564}},
 {'source': 'viraemic',
  'target': 'priviest',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.028000000000000004, 'normal': 20.408}},
 {'source': 'viraemic',
  'target': 'veniremen',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.118, 'normal': 242.05}},
 {'source': 'viraemic',
  'target': 'arabesk',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 3.1300000000000003, 'normal': 821.4280000000001}},
 {'source': 'viraemic',
  'target': 'methadone',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.072, 'normal': 128.96400000000003}},
 {'source': 'viraemic',
  'target': 'perfectibilians',
  'metadata': {'streaming': 1},
  'metrics': {'normal': 1814.65, 'danger': 2.5220000000000002}},
 {'source': 'viraemic',
  'target': 'multiracialisms',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.7000000000000001, 'normal': 174.942}},
 {'source': 'viraemic',
  'target': 'proletarianised',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 1.3820000000000001, 'normal': 6140.146000000001}},
 {'source': 'viraemic',
  'target': 'commanderies',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.41600000000000004, 'normal': 1858.862}},
 {'source': 'viraemic',
  'target': 'gainfully',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.198, 'normal': 97.298}},
 {'source': 'viraemic',
  'target': 'malvasias',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 1.69, 'normal': 1827.1240000000003}},
 {'source': 'viraemic',
  'target': 'foetal',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 58.584, 'normal': 10003.208}},
 {'source': 'viraemic',
  'target': 'neuritics',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 67.046, 'normal': 4505.166}},
 {'source': 'viraemic',
  'target': 'legwork',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 1.6420000000000003, 'normal': 647.144}},
 {'source': 'viraemic',
  'target': 'relocator',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 9.032, 'normal': 502.846}},
 {'source': 'viraemic',
  'target': 'brazed',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.382, 'normal': 187.06400000000002}},
 {'source': 'viraemic',
  'target': 'unapproachabilities',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 2.7420000000000004, 'normal': 1089.852}},
 {'source': 'viraemic',
  'target': 'parrocks',
  'metadata': {'streaming': 1},
  'metrics': {'danger': 0.544, 'normal': 1640.478}}]
In [26]:
# us-east-1
Image("04dec21-3.PNG")
Out[26]:
In [30]:
Image("04dec21-4.PNG")
Out[30]:
In [32]:
[i for i in data['nodes'][1]['nodes'] if i['name'] == 'alignment']
Out[32]:
[{'name': 'alignment',
  'node_type': 'service',
  'class': 'danger',
  'metadata': {'streaming': 1},
  'nodes': [{'name': 'madronos',
    'metrics': {'normal': 156.94000000000003, 'danger': 0.006}}],
  'renderer': 'focusedChild',
  'notices': [{'severity': 1, 'title': 'notice test 1'}]}]
In [35]:
Image("04dec21-5.PNG")
Out[35]:
In [36]:
[i for i in data['nodes'][1]['nodes'] if i['name'] == 'viraemic']
Out[36]:
[{'name': 'viraemic',
  'node_type': 'azure',
  'class': 'warning',
  'metadata': {'streaming': 1},
  'nodes': [{'name': 'tetrabrach',
    'metrics': {'normal': 41515.944, 'danger': 66.144}},
   {'name': 'colloidal',
    'metrics': {'danger': 0.166, 'normal': 126.34000000000002}},
   {'name': 'wardrobers'},
   {'name': 'yplast'},
   {'name': 'benet',
    'metrics': {'danger': 0.22400000000000003, 'normal': 130.17600000000002}},
   {'name': 'imping',
    'metrics': {'danger': 0.22000000000000003, 'normal': 130.19000000000003}},
   {'name': 'virility',
    'metrics': {'danger': 0.18600000000000003, 'normal': 130.158}},
   {'name': 'eng', 'metrics': {'danger': 0.244, 'normal': 129.494}},
   {'name': 'use', 'metrics': {'danger': 0.2, 'normal': 126.536}},
   {'name': 'racegoings',
    'metrics': {'danger': 0.06999999999999999, 'normal': 43.19200000000001}}],
  'renderer': 'focusedChild',
  'notices': [{'severity': 1, 'title': 'notice test 5'}]}]
In [42]:
Image("http://api-dupi2.localshi.com/image/f9d053da00a94dbda0db53044aad447d.png")
Out[42]:
In [38]:
[i for i in data['nodes'][1]['nodes'] if i['name'] == 'microparasites']
Out[38]:
[{'name': 'microparasites',
  'node_type': 'user',
  'metadata': {'streaming': 1},
  'nodes': [{'name': 'ribbonwoods',
    'metrics': {'danger': 1.5460000000000003, 'normal': 848.7139999999999}}],
  'renderer': 'focusedChild'}]
In [43]:
Image("http://api-dupi2.localshi.com/image/a9943a2321cd47cab4313c429d610da6.png")
Out[43]:
In [39]:
[i for i in data['nodes'][1]['nodes'] if i['name'] == 'commerce']
Out[39]:
[{'name': 'commerce',
  'metadata': {'streaming': 1},
  'nodes': [{'name': 'gimmes', 'metrics': {'normal': 180.044}}],
  'renderer': 'focusedChild',
  'notices': [{'severity': 2, 'title': 'notice test 2'}]}]
In [44]:
Image("http://api-dupi2.localshi.com/image/82e88f94b4d7434fb3ea02884ab8269e.png")
Out[44]:
In [40]:
[i for i in data['nodes'][1]['nodes'] if i['name'] == 'bypath']
Out[40]:
[{'name': 'bypath',
  'node_type': 'storage',
  'class': 'warning',
  'metadata': {'streaming': 1},
  'nodes': [],
  'renderer': 'focusedChild',
  'notices': [{'severity': 2, 'title': 'notice test 4'}]}]
In [45]:
Image("http://api-dupi2.localshi.com/image/2539992fb8aa42dbb777b35a0ed7f771.png")
Out[45]:
In [41]:
[i for i in data['nodes'][1]['nodes'] if i['name'] == 'immedicably']
Out[41]:
[{'name': 'immedicably',
  'metadata': {'streaming': 1},
  'nodes': [{'name': 'remit', 'metrics': {'normal': 185.476}}],
  'renderer': 'focusedChild',
  'notices': [{'severity': 1, 'title': 'notice test 3'}]}]
In [46]:
Image("http://api-dupi2.localshi.com/image/21b442b5817b49e9af539744bc099bba.png")
Out[46]:
In [47]:
[i for i in data['nodes'][1]['nodes'] if i['name'] == 'appropriable']
Out[47]:
[{'name': 'appropriable',
  'node_type': 'default',
  'class': 'danger',
  'metadata': {'streaming': 1},
  'nodes': [{'name': 'talkathon',
    'metrics': {'normal': 613.17, 'danger': 0.006}}],
  'renderer': 'focusedChild'}]
In [ ]: