예제 #1
0
    def update(self, entry_collection):
        """Update this monitor from a MonitorEntryCollection

        This function gets a file descriptor to process name
        mapping, and re-parses the ip_conntrack data. The
        current time is saved as sample time, and the data is
        then converted into an aggregated monitoring value.

        @param entry_collection: The collection from where to take data
        """
        self.fd_map.update(proc.get_fd_map())
        self.last_conntrack = copy.deepcopy(self.conntrack)
        self.conntrack.update( self.sub_conntrack(proc.parse_ip_conntrack(), self.init_conntrack) )
        self.connections.update(proc.get_connections())
        entry_collection.expire()
        self.sample_time = time.time()
        self.convert(entry_collection)
예제 #2
0
    def update(self, entry_collection):
        """Update this monitor from a MonitorEntryCollection

        This function gets a file descriptor to process name
        mapping, and re-parses the ip_conntrack data. The
        current time is saved as sample time, and the data is
        then converted into an aggregated monitoring value.

        @param entry_collection: The collection from where to take data
        """
        self.fd_map.update(proc.get_fd_map())
        self.last_conntrack = copy.deepcopy(self.conntrack)
        self.conntrack.update(
            self.sub_conntrack(proc.parse_ip_conntrack(), self.init_conntrack))
        self.connections.update(proc.get_connections())
        entry_collection.expire()
        self.sample_time = time.time()
        self.convert(entry_collection)
예제 #3
0
    def __init__(self, lookback=True, ignorelocal=False):
        """Create a new Monitor object

        This initializes the monitor object. In case the
        lookback value is False, this call already takes
        the first measurement from ip_conntrack.

        @param lookback: indicates if data already existing in ip_conntrack should be considered (True) or ignored (False)
        @param ignorelocal: indicates if the Monitor should ignore loopback traffic (True) or include it in the calculations (False)
        """
        self.fd_map = {}
        self.sample_time = time.time()
        self.conntrack = {}
        self.last_conntrack = {}
        self.init_conntrack = {} if lookback else proc.parse_ip_conntrack()
        self.connections = {}
        self.update_frequency = self.DEFAULT_UPDATE_FREQUENCY
        self.entries = model.MonitorEntryCollection(self.update_frequency)
        self.include_filter = []
        self.exclude_filter = []
        self.ignorelocal = ignorelocal
예제 #4
0
    def __init__(self, lookback=True, ignorelocal=False):
        """Create a new Monitor object

        This initializes the monitor object. In case the
        lookback value is False, this call already takes
        the first measurement from ip_conntrack.

        @param lookback: indicates if data already existing in ip_conntrack should be considered (True) or ignored (False)
        @param ignorelocal: indicates if the Monitor should ignore loopback traffic (True) or include it in the calculations (False)
        """
        self.fd_map = {}
        self.sample_time = time.time()
        self.conntrack = {}
        self.last_conntrack = {}
        self.init_conntrack = {} if lookback else proc.parse_ip_conntrack()
        self.connections = {}
        self.update_frequency = self.DEFAULT_UPDATE_FREQUENCY
        self.entries = model.MonitorEntryCollection(self.update_frequency)
        self.include_filter = []
        self.exclude_filter = []
        self.ignorelocal = ignorelocal