def collect_snmp(self, device, host, port, community):
        """
        Collect SNMP interface data from device
        """
        # Log
        self.log.info("Collecting SNMP interface statistics from: %s", device)

        # Define a list of interface indexes
        ifIndexes = []

        # Get Interface Indexes
        ifIndexOid = '.'.join([self.IF_MIB_INDEX_OID])
        ifIndexData = self.walk(ifIndexOid, host, port, community)
        ifIndexes = [v for v in ifIndexData.values()]

        for ifIndex in ifIndexes:
            # Get Interface Type
            ifTypeOid = '.'.join([self.IF_MIB_TYPE_OID, ifIndex])
            ifTypeData = self.get(ifTypeOid, host, port, community)
            if ifTypeData[ifTypeOid] not in self.IF_TYPES:
                # Skip Interface
                continue
            # Get Interface Name
            ifNameOid = '.'.join([self.IF_MIB_NAME_OID, ifIndex])
            ifNameData = self.get(ifNameOid, host, port, community)
            ifName = ifNameData[ifNameOid]
            # Remove quotes from string
            ifName = re.sub(r'(\"|\')', '', ifName)

            # Get Gauges
            for gaugeName, gaugeOid in self.IF_MIB_GAUGE_OID_TABLE.items():
                ifGaugeOid = '.'.join([self.IF_MIB_GAUGE_OID_TABLE[gaugeName],
                                       ifIndex])
                ifGaugeData = self.get(ifGaugeOid, host, port, community)
                ifGaugeValue = ifGaugeData[ifGaugeOid]
                if not ifGaugeValue:
                    continue

                # Get Metric Name and Value
                metricIfDescr = re.sub(r'\W', '_', ifName)
                metricName = '.'.join([metricIfDescr, gaugeName])
                metricValue = int(ifGaugeValue)
                # Get Metric Path
                metricPath = '.'.join(['devices',
                                       device,
                                       self.config['path'],
                                       metricName])
                # Publish Metric
                self.publish_gauge(metricPath, metricValue)

            # Get counters (64bit)
            counterItems = self.IF_MIB_COUNTER_OID_TABLE.items()
            for counterName, counterOid in counterItems:
                ifCounterOid = '.'.join(
                    [self.IF_MIB_COUNTER_OID_TABLE[counterName], ifIndex])
                ifCounterData = self.get(ifCounterOid, host, port, community)
                ifCounterValue = ifCounterData[ifCounterOid]
                if not ifCounterValue:
                    continue

                # Get Metric Name and Value
                metricIfDescr = re.sub(r'\W', '_', ifName)

                if counterName in ['ifHCInOctets', 'ifHCOutOctets']:
                    for unit in self.config['byte_unit']:
                        # Convert Metric
                        metricName = '.'.join([metricIfDescr,
                                               counterName.replace('Octets',
                                                                   unit)])
                        metricValue = diamond.convertor.binary.convert(
                            value=ifCounterValue,
                            oldUnit='byte',
                            newUnit=unit)

                        # Get Metric Path
                        metricPath = '.'.join(['devices',
                                               device,
                                               self.config['path'],
                                               metricName])
                        # Publish Metric
                        self.publish_counter(metricPath,
                                             metricValue,
                                             max_value=18446744073709600000,
                                             )
                else:
                    metricName = '.'.join([metricIfDescr, counterName])
                    metricValue = int(ifCounterValue)

                    # Get Metric Path
                    metricPath = '.'.join(['devices',
                                           device,
                                           self.config['path'],
                                           metricName])
                    # Publish Metric
                    self.publish_counter(metricPath,
                                         metricValue,
                                         max_value=18446744073709600000,
                                         )

        Collect SNMP interface data from device
        
src/collectors/snmpinterface/snmpinterface.py