return round((net_stat.rx_tx_bits('eth0')[0]) / (8192), 2) def simulated_device(): return random.randint(0, 20) #--------------------------------------------------------------------------- # In this example, we demonstrate how gateway health and som simluated data # can be directed to two data center components (vrops and graphite) using Liota. # The program illustrates the ease of use Liota brings to IoT application developers. if __name__ == '__main__': # create a data center object, vROps in this case, using websocket as a transport layer # this object encapsulates the formats and protocols neccessary for the agent to interact with the dcc # UID/PASS login for now. vrops = Vrops(config['vROpsUID'], config['vROpsPass'], WebSocket(url=config['WebSocketUrl'])) # create a gateway object encapsulating the particulars of a gateway/board # argument is the name of this gateway gateway = DellEdge5000(config['Gateway1Name']) # resister the gateway with the vrops instance # this call creates a representation (a Resource) in vrops for this gateway with the name given vrops_gateway = vrops.register(gateway) if vrops_gateway.registered: # these call set properties on the Resource representing the gateway in the vrops instance # properties are a key:value store vrops.set_properties(vrops_gateway, config['Gateway1PropList']) # ---------- Create metrics 'on' the Resource in vrops representing the gateway
def simulated_device(): return random.randint(0, 20) #--------------------------------------------------------------------------- # In this example, we demonstrate how gateway health and some simluated data # can be directed to vrops, VMware's data center component using Liota. # The program illustrates the ease of use Liota brings to IoT application developers. if __name__ == '__main__': # create a data center object, vROps in this case, using websocket as a transport layer # this object encapsulates the formats and protocols neccessary for the agent to interact with the dcc # UID/PASS login for now. vrops = Vrops(config['vROpsUID'], config['vROpsPass'], WebSocket(url=config['WebSocketUrl'])) # create a gateway object encapsulating the particulars of a gateway/board # argument is the name of this gateway gateway = Dk300(config['Gateway1Name']) # resister the gateway with the vrops instance # this call creates a representation (a Resource) in vrops for this gateway with the name given vrops_gateway = vrops.register(gateway) if vrops_gateway.registered: # these call set properties on the Resource representing the gateway in the vrops instance # properties are a key:value store # arguments are (key, value) for item in config['Gateway1PropList']: for key, value in item.items():