- Timestamp:
- 04/04/05 11:53:39 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/togad.py
r33 r34 20 20 # <=7 = daemon threading - NOTE: Daemon will 'halt on all errors' from this level 21 21 # 22 DEBUG_LEVEL = 922 DEBUG_LEVEL = 10 23 23 24 24 # Where is the gmetad.conf located … … 89 89 if not self.clusters.has_key( self.clusterName ): 90 90 91 self.clusters[ self.clusterName ] = RRDHandler( self.c lusterName )91 self.clusters[ self.clusterName ] = RRDHandler( self.config, self.clusterName ) 92 92 93 93 debug_msg( 10, ' |-Cluster found: %s' %( self.clusterName ) ) … … 112 112 myMetric['time'] = self.hostReported 113 113 114 self.clusters[ self.clusterName ].memMetric( self.hostname, myMetric ) 115 116 debug_msg( 11, ' | | |-metric: %s:%s' %( myMetric['name'], myMetric['val'] ) ) 117 118 def storeMetrics( self, hostname, timeserial ): 119 120 for cluster in self.clusters: 121 122 cluster.storeMetrics() 114 self.clusters[ self.clusterName ].memMetric( self.hostName, myMetric ) 115 116 debug_msg( 11, ' | | |-metric: %s:%s' %( myMetric['name'], myMetric['val'] ) ) 117 118 def storeMetrics( self ): 119 120 for clustername, rrdh in self.clusters.items(): 121 122 print 'storing metrics of cluster ' + clustername 123 rrdh.storeMetrics() 123 124 124 125 class GangliaXMLGatherer: … … 264 265 # Make sure XML is processed on time and at regular intervals 265 266 266 debug_msg( 7, self.printTime() + ' - mainthread() - Sleep '+ str( self.config.get Interval() ) +'s: zzzzz..' )267 time.sleep( self.config.getInterval() )267 debug_msg( 7, self.printTime() + ' - mainthread() - Sleep '+ str( self.config.getLowestInterval() ) +'s: zzzzz..' ) 268 time.sleep( float( self.config.getLowestInterval() ) ) 268 269 debug_msg( 7, self.printTime() + ' - mainthread() - Awoken: waiting for XML thread..' ) 269 270 … … 309 310 class GangliaConfigParser: 310 311 311 sources = { }312 sources = [ ] 312 313 313 314 def __init__( self, config ): … … 363 364 return None 364 365 366 def getLowestInterval( self ): 367 368 lowest_interval = 0 369 370 for source in self.sources: 371 372 if not lowest_interval or source['interval'] <= lowest_interval: 373 374 lowest_interval = source['interval'] 375 376 # Return 15 when nothing is found, so that the daemon won't go insane with 0 sec delays 377 if lowest_interval: 378 return lowest_interval 379 else: 380 return 15 381 365 382 class RRDHandler: 366 383 … … 376 393 def memMetric( self, host, metric ): 377 394 378 for m in self.myMetrics[ host ]: 379 380 if m['time'] == metric['time']: 381 382 # Allready have this metric, abort 383 return 1 384 385 if not self.myMetrics.has_key( host ): 386 395 if self.myMetrics.has_key( host ): 396 397 if self.myMetrics[ host ].has_key( metric['name'] ): 398 399 for mymetric in self.myMetrics[ host ][ metric['name'] ]: 400 401 if mymetric['time'] == metric['time']: 402 403 # Allready have this metric, abort 404 return 1 405 else: 406 self.myMetrics[ host ][ metric['name'] ] = [ ] 407 else: 387 408 self.myMetrics[ host ] = { } 388 389 if not self.myMetrics[ host ].has_key( metric['name'] ):390 391 409 self.myMetrics[ host ][ metric['name'] ] = [ ] 410 392 411 393 412 self.myMetrics[ host ][ metric['name'] ].append( metric )
Note: See TracChangeset
for help on using the changeset viewer.