(self, device, host, port, community)
Collect SNMP interface data from device
Collect SNMP interface data from device
Collect SNMP interface data from device
def collect_snmp(self, device, host, port, community):
        """
        Collect SNMP interface data from device
        """
        self.log.debug(
            'Collecting raw SNMP statistics from device \'{}\''.format(device))

        dev_config = self.config['devices'][device]
        if 'oids' in dev_config:
            for oid, metricName in dev_config['oids'].items():

                if (device, oid) in self.skip_list:
                    self.log.debug(
                        'Skipping OID \'{}\' ({}) on device \'{}\''.format(
                            oid, metricName, device))
                    continue

                timestamp = time.time()
                value = self._get_value(device, oid, host, port, community)
                if value is None:
                    continue

                self.log.debug(
                    '\'{}\' ({}) on device \'{}\' - value=[{}]'.format(
                        oid, metricName, device, value))

                path = '.'.join([self.config['path_prefix'], device,
                                 self.config['path_suffix'], metricName])
                metric = Metric(path=path, value=value, timestamp=timestamp,
                                precision=self._precision(value),
                                metric_type='GAUGE')
                self.publish_metric(metric)
def collect_snmp ( self , device , host , port , community ) : self . log . debug ( 'Collecting raw SNMP statistics from device \'{}\'' . format ( device ) ) dev_config = self . config [ 'devices' ] [ device ] if 'oids' in dev_config : for oid , metricName in dev_config [ 'oids' ] . items ( ) : if ( device , oid ) in self . skip_list : self . log . debug ( 'Skipping OID \'{}\' ({}) on device \'{}\'' . format ( oid , metricName , device ) ) continue timestamp = time . time ( ) value = self . _get_value ( device , oid , host , port , community ) if value is None : continue self . log . debug ( '\'{}\' ({}) on device \'{}\' - value=[{}]' . format ( oid , metricName , device , value ) ) path = '.' . join ( [ self . config [ 'path_prefix' ] , device , self . config [ 'path_suffix' ] , metricName ] ) metric = Metric ( path = path , value = value , timestamp = timestamp , precision = self . _precision ( value ) , metric_type = 'GAUGE' ) self . publish_metric ( metric )