#NEWLINE# def read_values( self , oid , files , metrics ) : #NEWLINE# #INDENT# '\n        Reads values from owfs/oid/{files} and update\n        metrics with format [oid.alias] = value\n        ' #NEWLINE# oid_path = os . path . join ( self . config [ 'owfs' ] , oid ) #NEWLINE# oid = oid . replace ( '.' , '_' ) #NEWLINE# for ( fn , alias ) in files . iteritems ( ) : #NEWLINE# #INDENT# fv = os . path . join ( oid_path , fn ) #NEWLINE# if os . path . isfile ( fv ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# f = open ( fv ) #NEWLINE# v = f . read ( ) #NEWLINE# f . close ( ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . log . error ( 'Unable to read %s' , fv ) #NEWLINE# raise #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# v = float ( v ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . log . error ( 'Unexpected value %s in %s' , v , fv ) #NEWLINE# raise #NEWLINE# #UNINDENT# metrics [ ( '%s.%s' % ( oid , alias ) ) ] = v