<s> import time <EOL> from snmpraw import SNMPRawCollector <EOL> from diamond . metric import Metric <EOL> class SNMPProxyCollector ( SNMPRawCollector ) : <EOL> def collect_snmp ( self , device , host , port , community ) : <EOL> """<STR_LIT>""" <EOL> self . log . debug ( <EOL> '<STR_LIT>' . format ( device ) <EOL> ) <EOL> try : <EOL> self . skip_time <EOL> except : <EOL> self . skip_time = time . time ( ) <EOL> time_diff = time . time ( ) - self . skip_time <EOL> if ( time_diff ) > <NUM_LIT:30> : <EOL> self . skip_list [ : ] = [ ] <EOL> self . skip_time = time . time ( ) <EOL> dev_config = self . config [ '<STR_LIT>' ] [ device ] <EOL> if '<STR_LIT>' in dev_config : <EOL> for oid , metricName in dev_config [ '<STR_LIT>' ] . items ( ) : <EOL> if ( device , oid ) in self . skip_list : <EOL> self . log . debug ( <EOL> '<STR_LIT>' . format ( <EOL> oid , metricName , device ) ) <EOL> continue <EOL> timestamp = time . time ( ) <EOL> value = self . _get_value ( device , oid , host , port , community ) <EOL> if value is None : <EOL> continue <EOL> self . log . debug ( <EOL> '<STR_LIT>' . format ( <EOL> oid , metricName , device , value ) ) <EOL> device_path = '<STR_LIT>' . format ( <EOL> dev_config [ '<STR_LIT>' ] , <EOL> device , <EOL> dev_config [ '<STR_LIT>' ] <EOL> ) <EOL> path = '<STR_LIT:.>' . join ( [ self . config [ '<STR_LIT>' ] , device_path , <EOL> self . config [ '<STR_LIT>' ] , metricName ] ) <EOL> metric = Metric ( path = path , value = value , timestamp = timestamp , <EOL> precision = self . _precision ( value ) , <EOL> host = device_path , metric_type = '<STR_LIT>' ) <EOL> self . publish_metric ( metric ) </s>
