Example #1
0
    def find_metric(self, datasource, sysname=None, info_object=None):
        descr = datasource.description
        if descr in self.cpus:
            metric = metric_path_for_cpu_load(sysname, 'cpu',
                                              self.get_interval(descr))
        elif descr in self.memories:
            metric = metric_prefix_for_memory(sysname, descr)
        elif descr in self.bandwidths:
            if descr.endswith(('Max', 'max')):
                if descr.startswith('c5000'):
                    metric = metric_path_for_bandwith_peak(sysname, True)
                else:
                    metric = metric_path_for_bandwith_peak(sysname, False)
            else:
                if descr.startswith('c5000'):
                    metric = metric_path_for_bandwith(sysname, True)
                else:
                    metric = metric_path_for_bandwith(sysname, False)
        elif descr == 'sysUpTime':
            metric = metric_path_for_sysuptime(sysname)
        else:
            _logger.info('Could not find metric for %s' % descr)
            metric = None

        return metric
Example #2
0
    def find_metric(self, datasource, sysname=None, info_object=None):
        descr = datasource.description
        if descr in self.cpus:
            metric = metric_path_for_cpu_load(
                sysname, 'cpu', self.get_interval(descr))
        elif descr in self.memories:
            metric = metric_prefix_for_memory(sysname, descr)
        elif descr in self.bandwidths:
            if descr.endswith(('Max', 'max')):
                if descr.startswith('c5000'):
                    metric = metric_path_for_bandwith_peak(
                        sysname, True)
                else:
                    metric = metric_path_for_bandwith_peak(
                        sysname, False)
            else:
                if descr.startswith('c5000'):
                    metric = metric_path_for_bandwith(
                        sysname, True)
                else:
                    metric = metric_path_for_bandwith(
                        sysname, False)
        elif descr == 'sysUpTime':
            metric = metric_path_for_sysuptime(sysname)
        else:
            _logger.info('Could not find metric for %s' % descr)
            metric = None

        return metric
Example #3
0
    def _collect_bandwidth_from_mib(self, mib, netboxes):
        try:
            bandwidth = yield mib.get_bandwidth()
            bandwidth_peak = yield mib.get_bandwidth_peak()
            percent = False
        except AttributeError:
            bandwidth = yield mib.get_bandwidth_percent()
            bandwidth_peak = yield mib.get_bandwidth_percent_peak()
            percent = True

        if bandwidth or bandwidth_peak:
            self._logger.debug(
                "Found bandwidth values from %s: %s, %s",
                mib.mib['moduleName'],
                bandwidth,
                bandwidth_peak,
            )
            timestamp = time.time()
            metrics = []
            for netbox in netboxes:
                metrics += [
                    (metric_path_for_bandwith(netbox, percent), (timestamp,
                                                                 bandwidth)),
                    (
                        metric_path_for_bandwith_peak(netbox, percent),
                        (timestamp, bandwidth_peak),
                    ),
                ]
            defer.returnValue(metrics)
Example #4
0
    def _collect_bandwidth_from_mib(self, mib):
        try:
            bandwidth = yield mib.get_bandwidth()
            bandwidth_peak = yield mib.get_bandwidth_peak()
            percent = False
        except AttributeError:
            bandwidth = yield mib.get_bandwidth_percent()
            bandwidth_peak = yield mib.get_bandwidth_percent_peak()
            percent = True

        if bandwidth or bandwidth_peak:
            self._logger.debug("Found bandwidth values from %s: %s, %s",
                               mib.mib['moduleName'], bandwidth,
                               bandwidth_peak)
            timestamp = time.time()
            metrics = [
                (metric_path_for_bandwith(self.netbox, percent),
                 (timestamp, bandwidth)),
                (metric_path_for_bandwith_peak(self.netbox, percent),
                 (timestamp, bandwidth_peak)),
            ]
            defer.returnValue(metrics)