コード例 #1
0
 )
 # Add specific NetFLow Stats only for those interfaces that have them
 if len(interface.netflowStats(i)) > 0:
     container.addWidget(
         Widget(
             {
                 "type": Widget.__WidgetTypeTable__,
                 "id": "netflowstats",
                 "title": "NetFlow Statistics",
                 "mode": "counter",
                 "unit": "bytes",
             }
         )
     )
     # Add specific SFlow Stats only for those interfaces that have them
 if len(interface.sflowStats(i)) > 0:
     container.addWidget(
         Widget(
             {
                 "type": Widget.__WidgetTypePieChart__,
                 "id": "sflowstats",
                 "title": "SFlow Statistics",
                 "mode": "counter",
                 "unit": "bytes",
             }
         )
     )
     # Add specific CPackets Stats only for those interfaces that have them
 if len(interface.cpacketStats(i)) > 0:
     container.addWidget(
         Widget(
コード例 #2
0
ファイル: interfaces.py プロジェクト: jiningeast/netcontrol
         'title': 'Security Packets Statistics',
         'mode': 'counter',
         'unit': 'packets'
     }))
 # Add specific NetFLow Stats only for those interfaces that have them
 if (len(interface.netflowStats(i)) > 0):
     container.addWidget(
         Widget({
             'type': Widget.__WidgetTypeTable__,
             'id': 'netflowstats',
             'title': 'NetFlow Statistics',
             'mode': 'counter',
             'unit': 'bytes'
         }))
 # Add specific SFlow Stats only for those interfaces that have them
 if (len(interface.sflowStats(i)) > 0):
     container.addWidget(
         Widget({
             'type': Widget.__WidgetTypePieChart__,
             'id': 'sflowstats',
             'title': 'SFlow Statistics',
             'mode': 'counter',
             'unit': 'bytes'
         }))
 # Add specific CPackets Stats only for those interfaces that have them
 if (len(interface.cpacketStats(i)) > 0):
     container.addWidget(
         Widget({
             'type': Widget.__WidgetTypePieChart__,
             'id': 'cpacketstats',
             'title': 'CPackets Statistics',
コード例 #3
0
            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

except Exception as inst:
    print type(inst)  # the exception instance
    print inst.args  # arguments stored in .args
    print inst  # __str__ allows args to printed directly

ntop.sendHTTPHeader(1)  # 1 = HTML
ntop.sendString(json.dumps(rsp, sort_keys=True, indent=4))
コード例 #4
0
ファイル: ifdata.py プロジェクト: jiningeast/netcontrol
                rs = interface.netflowStats(i)
                if (len(rs) > 0):
                    total = rs.pop('total', sum(rs.values()))
                    if_traffic.append({
                        "metadata": {
                            "type": "table",
                            "title": "Netflow Statistics",
                            "unit": "bytes",
                            "mode": "counter",
                            "total": total
                        },
                        "data": rs
                    })

                rs = interface.sflowStats(i)
                if (len(rs) > 0):
                    total = rs.pop('total', sum(rs.values()))
                    if_traffic.append({
                        "metadata": {
                            "type": "piechart",
                            "title": "SFlow Statistics",
                            "unit": "bytes",
                            "mode": "counter",
                            "total": total
                        },
                        "data": rs
                    })

                rs = interface.cpacketStats(i)
                if (len(rs) > 0):
コード例 #5
0
	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

except Exception as inst:
    print type(inst)     # the exception instance
    print inst.args      # arguments stored in .args
    print inst           # __str__ allows args to printed directly

ntop.sendHTTPHeader(1) # 1 = HTML    
ntop.sendString(json.dumps(rsp, sort_keys=True, indent=4))

コード例 #6
0
ファイル: ifdata.py プロジェクト: GabrielDiniz/FluxNetControl
				if (len(rs) > 0): adapter['other'] = rs
				
				throughputStats = { "metadata": { "type":"groupedtable", "title":"Interface Throughput", "unit": "bps", "mode" : "gauge", "total": total }, "data" : adapter }
			
				rs = interface.securityPkts(i)
				total = rs.pop('total',sum(rs.values()))
				securityPkts = { "metadata": { "type":"barchart", "title":"Security Packet Statistics", "unit": "packets", "mode" : "counter", "total": total}, "data" : rs }
				# Build traffic info for interface
				if_traffic = [pktsStats, bytesStats, securityPkts, throughputStats]
				
				rs = interface.netflowStats(i)
				if(len(rs) > 0):
					total = rs.pop('total',sum(rs.values()))
					if_traffic.append({"metadata": {"type":"table", "title":"Netflow Statistics", "unit": "bytes", "mode" : "counter", "total": total}, "data":rs})

				rs = interface.sflowStats(i)
				if(len(rs) > 0):
					total = rs.pop('total',sum(rs.values()))
					if_traffic.append({"metadata": {"type":"piechart", "title":"SFlow Statistics", "unit": "bytes", "mode" : "counter", "total": total}, "data":rs})

				rs = interface.cpacketStats(i)
				if(len(rs) > 0):
					total = rs.pop('total',sum(rs.values()))
					if_traffic.append({"metadata": {"type":"piechart", "title":"CPackets Statistics", "unit": "bytes", "mode" : "counter", "total": total}, "data":rs})
				
				rsp[interface.uniqueName(i)]['protocols'] = if_traffic

			if (len(topic) == 0 or topic.lower() == "ip"):
				# IP packets and breadcrumb
				rs = interface.tcpStats(i) 
				total = rs.pop('total',sum(rs.values()))