Changeset 855
- Timestamp:
- 05/14/13 14:12:49 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/jobarchived/jobarchived.py
r829 r855 1541 1541 if line.find( 'data_source' ) != -1 and line[0] != '#': 1542 1542 1543 source = { } 1544 source['name'] = line.split( '"' )[1] 1545 source_words = line.split( '"' )[2].split( ' ' ) 1546 1547 for word in source_words: 1548 1549 valid_interval = 1 1550 1551 for letter in word: 1552 1553 if letter not in string.digits: 1554 1555 valid_interval = 0 1556 1557 if valid_interval and len(word) > 0: 1558 1559 source['interval'] = word 1560 debug_msg( 9, 'polling interval for %s = %s' %(source['name'], source['interval'] ) ) 1561 1562 # No interval found, use Ganglia's default 1563 if not source.has_key( 'interval' ): 1543 source = { } 1544 source['name'] = line.split( '"' )[1] 1545 source_value_words = line.split( '"' )[2].split( ' ' ) 1546 1547 check_interval = source_value_words[0] 1548 1549 try: 1550 1551 source['interval'] = int( check_interval ) 1552 debug_msg( 9, 'polling interval for %s = %s' %(source['name'], str( source['interval'] ) ) ) 1553 except ValueError: 1554 1564 1555 source['interval'] = 15 1565 1556 debug_msg( 9, 'polling interval for %s defaulted to 15' %(source['name']) ) 1566 1557 1567 1558 self.sources.append( source ) 1559 1560 readcfg.close() 1561 1562 def clusterExists( self, source_name ): 1563 1564 for source in self.sources: 1565 1566 if source['name'] == source_name: 1567 1568 return True 1569 1570 return False 1568 1571 1569 1572 def getInterval( self, source_name ): … … 1979 1982 if not os.path.exists( rrd_file ): 1980 1983 1981 interval = self.config.getInterval( self.cluster )1984 interval = self.config.getInterval( self.cluster ) 1982 1985 heartbeat = 8 * int( interval ) 1983 1986 … … 2062 2065 """Threading start""" 2063 2066 2067 global ARCHIVE_DATASOURCES 2068 2064 2069 config = GangliaConfigParser( GMETAD_CONF ) 2070 2071 for ds in ARCHIVE_DATASOURCES: 2072 2073 if not config.clusterExists( ds ): 2074 2075 print "FATAL ERROR: Data source with name '%s' not found in %s" %( ds, GMETAD_CONF ) 2076 sys.exit( 1 ) 2077 2065 2078 s_timeout = int( config.getLowestInterval() - 1 ) 2066 2079
Note: See TracChangeset
for help on using the changeset viewer.