Example #1
0
    def setup_address (self):
        self.multicast_addr = self.reporter_config.get('multicast_addr')
        if not self.multicast_addr:
            raise ConfigError('reporter::multicast_addr must be specified')

        self.multicast_port = self.reporter_config.get('multicast_port')
        if not self.multicast_port:
            raise ConfigError('reporter::multicast_port must be specified')
        else:
            try:
                self.multicast_port = convert_to_integer(self.multicast_port)
            except ConversionError:
                raise ConfigError('reporter::multicast_port must be an integer number')

        self.multicast_ttl = self.reporter_config.get('multicast_ttl')
        if self.multicast_ttl:
            try:
                self.multicast_ttl = convert_to_integer(self.multicast_ttl)
            except ConversionError:
                raise ConfigError('reporter::multicast_ttl must be an integer number')

        self.multicast_loopback = self.reporter_config.get('multicast_loopback', True)
        try:
            self.multicast_loopback = convert_to_bool(self.multicast_loopback)
        except ConversionError:
            raise ConfigError('reporter::multicast_loopback must be a boolean')


        self.log.info('Reporting to multicast address:  %s:%s' % (self.multicast_addr,
                                                                  self.multicast_port))
        if self.multicast_ttl is not None:
            self.log.info('MulticastReporter will send reports beyond this network (multicast_ttl = %d)' % self.multicast_ttl)
        if self.multicast_loopback == False:
            self.log.info('MulticastReporter will NOT send reports to this machine (multicast_loopback = False)')
Example #2
0
 def configure_selfstats (self):
     try:
         if convert_to_bool(self.config.get('common::selfstats', True)) == True:
             self.selfstats = selfstats.SelfStatistics(self.config, self.metrics_recorder)
             self.metrics_recorder.set_selfstats(self.selfstats)
     except ConversionError:
         raise ConfigError("noselfstats must be a boolean")
Example #3
0
 def daemonize (self):
     nodaemon = self.nodaemon
     if nodaemon == False:
         try:
             if convert_to_bool(self.config.get('common::nodaemon', False)) == False:
                 if self.daemonized == False:
                     utility.daemonize()
                     self.daemonized = True
         except ConversionError:
             raise ConfigError("nodaemon must be a boolean")
Example #4
0
    def setup_interfaces (self):
        physical_only = self.config.get('physical_interfaces_only')
        if physical_only is None:
            self.physical_only = True
        else:
            try:
                self.physical_only = convert_to_bool(physical_only)
            except ConversionError:
                raise ConfigError('%s::physical_interfaces_only must be a boolean' % self.name)

        exclude_rex = self.config.get('exclude_interfaces')
        if exclude_rex is None:
            self.exclude_rex = None
        else:
            try:
                self.exclude_rex = re.compile(exclude_rex)
            except Exception, why:
                raise ConfigError('%s::exclude_interfaces must be a valid regular expression' % self.name)