# pie chart is a serie of key-value pairs widget.setProperties(interface.sflowStats(i)) widget.removeKey("total") # =============================== # CPackets Widget Data # =============================== if widgetId.lower() == "cpacketstats": # pie chart is a serie of key-value pairs widget.setProperties(interface.cpacketStats(i)) widget.removeKey("total") # ================================= # Interface Throughput Widget Data # ================================= if widgetId.lower() == "interfacethroughput": # grouped table is a serie of key-value pairs of dictionaries rs = interface.throughputStats(i) total = rs.pop("total", sum(rs.values())) widget.setKeyAndValue( "actual", {"packets": rs.pop("actualPkts", ""), "bytes": rs.pop("actualBytes", "")} ) widget.setKeyAndValue("peak", {"packets": rs.pop("peakPkts", ""), "bytes": rs.pop("peakBytes", "")}) widget.setKeyAndValue( "last minute", {"packets": rs.pop("lastMinPkts", ""), "bytes": rs.pop("lastMinBytes", "")} ) widget.setKeyAndValue( "last 5 minutes", {"packets": rs.pop("lastFiveMinsPkts", ""), "bytes": rs.pop("lastFiveMinsBytes", "")}, ) if len(rs) > 0: widget.setKeyAndValue("other", rs) # ====================================
info['speed'] = interface.speed(i) info['mtu'] = interface.mtu(i) info['bpf'] = interface.bpf(i) addr = {} addr['ipv4'] = interface.ipv4(i) addr['network'] = interface.network(i) addr['numHosts'] = interface.numHosts(i) addr['ipv6'] = interface.ipv6(i) info['address'] = addr if ((len(mode) == 0) or not (mode == "list")): stats = {} stats['pktsStats'] = interface.pktsStats(i) stats['bytesStats'] = interface.bytesStats(i) stats['throughputStats'] = interface.throughputStats(i) ip = {} ip['tcp'] = interface.tcpStats(i) ip['udp'] = interface.udpStats(i) ip['icmp'] = interface.icmpStats(i) ip['ip'] = interface.ipStats(i) stats['securityPkts'] = interface.securityPkts(i) stats['netflowStats'] = interface.netflowStats(i) stats['sflowStats'] = interface.sflowStats(i) stats['cpacketStats'] = interface.cpacketStats(i) stats['ip'] = ip info['stats'] = stats rsp[interface.uniqueName(i)] = info
# pie chart is a serie of key-value pairs widget.setProperties(interface.sflowStats(i)) widget.removeKey('total') # =============================== # CPackets Widget Data # =============================== if (widgetId.lower() == "cpacketstats"): # pie chart is a serie of key-value pairs widget.setProperties(interface.cpacketStats(i)) widget.removeKey('total') # ================================= # Interface Throughput Widget Data # ================================= if (widgetId.lower() == "interfacethroughput"): # grouped table is a serie of key-value pairs of dictionaries rs = interface.throughputStats(i) total = rs.pop('total', sum(rs.values())) widget.setKeyAndValue( 'actual', { 'packets': rs.pop('actualPkts', ''), 'bytes': rs.pop('actualBytes', '') }) widget.setKeyAndValue( 'peak', { 'packets': rs.pop('peakPkts', ''), 'bytes': rs.pop('peakBytes', '') }) widget.setKeyAndValue( 'last minute', { 'packets': rs.pop('lastMinPkts', ''), 'bytes': rs.pop('lastMinBytes', '')
info['speed'] = interface.speed(i) info['mtu'] = interface.mtu(i) info['bpf'] = interface.bpf(i) addr = {} addr['ipv4'] = interface.ipv4(i) addr['network'] = interface.network(i) addr['numHosts'] = interface.numHosts(i) addr['ipv6'] = interface.ipv6(i) info['address'] = addr if((len(mode) == 0) or not(mode == "list")): stats = {} stats['pktsStats'] = interface.pktsStats(i) stats['bytesStats'] = interface.bytesStats(i) stats['throughputStats'] = interface.throughputStats(i) ip = {} ip['tcp'] = interface.tcpStats(i) ip['udp'] = interface.udpStats(i) ip['icmp'] = interface.icmpStats(i) ip['ip'] = interface.ipStats(i) stats['securityPkts'] = interface.securityPkts(i) stats['netflowStats'] = interface.netflowStats(i) stats['sflowStats'] = interface.sflowStats(i) stats['cpacketStats'] = interface.cpacketStats(i) stats['ip'] = ip info['stats'] = stats rsp[interface.uniqueName(i)] = info