Esempio n. 1
0
    def __init__(self, config, reportingInterval, workingdir):
        BaseAnalyzer.__init__(self, config, reportingInterval, workingdir)

        print "Initializing FlowStat module ..."
        if len(config) == 0 or not isinstance(config[0], dict):
            raise Exception("Configuration error cannot configure FlowStat!")

        self.configDict = config.pop(0)

        if not "imgDir" in self.configDict:
            raise Exception("FlowStat: imgDir not configured!")
        self.imgDir = os.path.join(self.workdir, self.configDict["imgDir"])

        if not "rrdDir" in self.configDict:
            raise Exception("FlowStat: rrdDir not configured!")
        self.rrdDir = os.path.join(self.workdir, self.configDict["rrdDir"])

        if not os.access(self.imgDir, os.R_OK | os.W_OK):
            os.mkdir(self.imgDir)

        rrdintervals = (60, 180, 720)
        rrdgraphhist = (120, 1440, 43200)

        # generate report objects from config file
        self.reports = []
        for reportConfig in config:
            if not "reportName" in reportConfig:
                raise Exception("FlowStat: Found report configuration without 'reportName' field: %s" % (reportConfig))
            if not "idx" in reportConfig:
                raise Exception("FlowStat: Found report configuration without 'idx' field: %s" % (reportConfig))
            if not "filter" in reportConfig:
                raise Exception("FlowStat: Found report configuration without 'filter' field: %s" % (reportConfig))
            self.reports.append(
                RRDGenerator(reportConfig["reportName"], self.rrdDir, rrdintervals, rrdgraphhist, reportConfig["idx"])
            )
Esempio n. 2
0
	def __init__(self, config, reportIntervals, workingdir):
		BaseAnalyzer.__init__(self, config, reportIntervals, workingdir)
		if 'subnetCSV' in self.config:
			self.parseSubnetCSV(self.config['subnetCSV'])
		self.subnets = SubnetTree.SubnetTree()
	
		self.reports = []
		for i in reportIntervals:
			# create a number of reportinstances
			self.reports.append(ReportInstance(0))
Esempio n. 3
0
	def __init__(self, config, reportIntervals, workingdir):
		BaseAnalyzer.__init__(self, config, reportIntervals, workingdir)
		subnetFile = self.config['subnets']
		self.subnets = 	SubnetTree.SubnetTree()
		for line in open(subnetFile):
			line = line.rstrip('\n')
			self.subnets[line] = line

		self.outputFile = open(self.config['outputFile'], 'w+')
		self.outputFile.write('# startTime endTime subnet in/out(0 == going into the subnet / 1 == coming from the subnet)\n')
Esempio n. 4
0
    def __init__(self, config, reportIntervals, workingdir):
        BaseAnalyzer.__init__(self, config, reportIntervals, workingdir)

        self.flowmap = dict()
Esempio n. 5
0
	def __init__(self, config, reportingInterval, workingdir):
		BaseAnalyzer.__init__(self, config, reportingInterval, workingdir)