Changeset 14 for trunk


Ignore:
Timestamp:
03/22/05 16:52:04 (19 years ago)
Author:
bastiaans
Message:

daemon/togad.py:

Added ARCHIVE_SOURCE checking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/togad.py

    r13 r14  
    6767                        debug_msg( 10, ' |-Cluster found: %s' %( self.clusterName ) )
    6868
    69                 elif name == 'HOST':     
     69                elif name == 'HOST' and self.clusterName in ARCHIVE_SOURCES:     
    7070                        self.hostName = attrs.get('NAME',"")
    7171                        self.hostIp = attrs.get('IP',"")
     
    7575                        debug_msg( 10, ' | |-Host found: %s - ip %s reported %s' %( self.hostName, self.hostIp, self.hostReported ) )
    7676
    77                 elif name == 'METRIC':
     77                elif name == 'METRIC' and self.clusterName in ARCHIVE_SOURCES:
    7878                        myMetric = { }
    7979                        myMetric['name'] = attrs.get('NAME',"")
     
    9393                #if name == 'CLUSTER':
    9494
    95                 if name == 'HOST':     
     95                if name == 'HOST' and self.clusterName in ARCHIVE_SOURCES:     
    9696                        self.storeMetrics( self.hostName )
    9797
     
    264264                rrd_parameters = [ ]
    265265                rrd_dir = '%s/%s/%s' %( check_dir(ARCHIVE_PATH), self.cluster, host )
     266                rrd_file = '%s/%s.rrd' %( rrd_dir, metric['name'] )
    266267
    267268                if not os.path.exists( rrd_dir ):
    268269                        os.makedirs( rrd_dir )
    269 
    270                 rrd_file = '%s/%s.rrd' %( rrd_dir, metric['name'] )
    271 
    272                 interval = self.gmetad_conf.getInterval( self.cluster )
    273                 heartbeat = 8 * int(interval)
    274 
    275                 param_step1 = '--step'
    276                 param_step2 = str( interval )
    277 
    278                 param_start1 = '--start'
    279                 param_start2 = str( int( metric['time'] ) - 1 )
    280 
    281                 param_ds = 'DS:sum:GAUGE:%d:U:U' %heartbeat
    282                 param_rra = 'RRA:AVERAGE:0.5:1:%s' %(ARCHIVE_HOURS_PER_RRD * 240)
    283 
    284                 rrdtool.create( str(rrd_file), param_step1, param_step2, param_start1, param_start2, param_ds, param_rra )
     270                        debug_msg( 9, 'created dir %s' %( str(rrd_dir) ) )
     271
     272                if not os.path.exists( rrd_file ):
     273
     274                        interval = self.gmetad_conf.getInterval( self.cluster )
     275                        heartbeat = 8 * int(interval)
     276
     277                        param_step1 = '--step'
     278                        param_step2 = str( interval )
     279
     280                        param_start1 = '--start'
     281                        param_start2 = str( int( metric['time'] ) - 1 )
     282
     283                        param_ds = 'DS:sum:GAUGE:%d:U:U' %heartbeat
     284                        param_rra = 'RRA:AVERAGE:0.5:1:%s' %(ARCHIVE_HOURS_PER_RRD * 240)
     285
     286                        rrdtool.create( str(rrd_file), param_step1, param_step2, param_start1, param_start2, param_ds, param_rra )
     287
     288                        debug_msg( 9, 'created rrd %s' %( str(rrd_file) ) )
    285289
    286290        def update( self, metric, timestamp, val ):
Note: See TracChangeset for help on using the changeset viewer.