Changeset 15


Ignore:
Timestamp:
03/22/05 16:59:14 (18 years ago)
Author:
bastiaans
Message:

daemon/togad.py:

Added rrd updating

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/togad.py

    r14 r15  
    102102                for metric in self.metrics:
    103103                        self.rrd.createCheck( hostname, metric )       
    104                         self.rrd.update( hostname, metric['name'], metric['val'] )
     104                        self.rrd.update( hostname, metric )
    105105                        debug_msg( 9, 'stored metric %s for %s: %s' %( hostname, metric['name'], metric['val'] ) )
    106106                        sys.exit(1)
     
    262262                "Check if an .rrd allready exists for this metric, create if not"
    263263
    264                 rrd_parameters = [ ]
    265264                rrd_dir = '%s/%s/%s' %( check_dir(ARCHIVE_PATH), self.cluster, host )
    266265                rrd_file = '%s/%s.rrd' %( rrd_dir, metric['name'] )
     
    288287                        debug_msg( 9, 'created rrd %s' %( str(rrd_file) ) )
    289288
    290         def update( self, metric, timestamp, val ):
    291 
    292                 pass
    293 
    294                 #rrd.update( bla )
    295                
     289        def update( self, host, metric ):
     290
     291                rrd_dir = '%s/%s/%s' %( check_dir(ARCHIVE_PATH), self.cluster, host )
     292                rrd_file = '%s/%s.rrd' %( rrd_dir, metric['name'] )
     293
     294                timestamp = metric['time']
     295                val = metric['val']
     296
     297                update_string = '%s:%s' %(timestamp, val)
     298
     299                rrdtool.update( str(rrd_file), str(update_string) )
     300                debug_msg( 9, 'updated rrd %s with %s' %( str(rrd_file), update_string ) )
    296301
    297302def main():
Note: See TracChangeset for help on using the changeset viewer.