- Timestamp:
- 04/06/05 14:02:15 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/togad.py
r43 r44 23 23 # 7 = daemon threading 24 24 # 25 DEBUG_LEVEL = 725 DEBUG_LEVEL = 8 26 26 27 27 # Where is the gmetad.conf located … … 124 124 self.config = config 125 125 self.clusters = { } 126 self.gatherClusters() 127 128 def gatherClusters( self ): 129 130 archive_dir = '%s/%s' %( check_dir(ARCHIVE_PATH), self.cluster ) 131 132 hosts = [ ] 133 134 if os.path.exists( archive_dir ): 135 136 dirlist = os.listdir( archive_dir ) 137 138 for item in dirlist: 139 140 clustername = item 141 142 if not self.clusters.has_key( clustername ) and clustername in ARCHIVE_SOURCES: 143 144 self.clusters[ clustername ] = RRDHandler( self.config, clustername ) 126 145 127 146 def startElement( self, name, attrs ): … … 348 367 # Store metrics somewhere between every 60 and 180 seconds 349 368 # 350 STORE_INTERVAL = random.randint( 60, 180 )351 #STORE_INTERVAL = 30369 #STORE_INTERVAL = random.randint( 360, 640 ) 370 STORE_INTERVAL = 16 352 371 353 372 storethread = threading.Thread( None, self.storeThread, 'storemetricthread' ) … … 489 508 490 509 def __init__( self, config, cluster ): 510 self.block = 0 491 511 self.cluster = cluster 492 512 self.config = config … … 495 515 self.gatherLastUpdates() 496 516 517 def isBlocking( self ): 518 519 return self.block 520 497 521 def gatherLastUpdates( self ): 498 522 "Populate the lastStored list, containing timestamps of all last updates" 499 523 524 self.block = 1 525 500 526 cluster_dir = '%s/%s' %( check_dir(ARCHIVE_PATH), self.cluster ) 501 527 … … 504 530 if os.path.exists( cluster_dir ): 505 531 506 for root, dirs, files in os.walk( cluster_dir ): 507 508 for dir in dirs: 509 510 valid_dir = 1 511 512 for letter in dir: 513 if letter not in string.digits: 514 valid_dir = 0 515 516 if valid_dir: 517 host = root.split( '/' )[-1] 518 hosts.append( host ) 532 dirlist = os.listdir( cluster_dir ) 533 534 for dir in dirlist: 535 536 hosts.append( dir ) 519 537 520 538 for host in hosts: … … 526 544 if os.path.exists( metric_dir ): 527 545 528 for root, dirs, files in os.walk( metric_dir ):529 530 for file in files:531 532 533 534 535 536 537 538 546 dirlist = os.listdir( metric_dir ) 547 548 for file in dirlist: 549 550 metricname = file.split( '.rrd' )[0] 551 552 if not self.lastStored.has_key( host ): 553 554 self.lastStored[ host ] = { } 555 556 self.lastStored[ host ][ metricname ] = self.rrdm.grabLastUpdate( metric_dir + '/' + file ) 539 557 540 558 def getClusterName( self ): … … 672 690 if os.path.exists( rrd_dir ): 673 691 674 for root, dirs, files in os.walk( rrd_dir ):675 676 for dir in dirs:677 678 679 680 681 682 683 684 685 686 687 692 dirlist = os.listdir( rrd_dir ) 693 694 for dir in dirlist: 695 696 valid_dir = 1 697 698 for letter in dir: 699 if letter not in string.digits: 700 valid_dir = 0 701 702 if valid_dir: 703 timeserial = dir 704 if timeserial > newest_timeserial: 705 newest_timeserial = timeserial 688 706 689 707 if newest_timeserial:
Note: See TracChangeset
for help on using the changeset viewer.