#NEWLINE# def main( ) : #NEWLINE# #INDENT# args = parse_args ( ) #NEWLINE# vgname = args . vgname #NEWLINE# command = ( 'vgs %s --noheadings --units M --nosuffix -o vg_size,vg_free' % vgname ) #NEWLINE# ( retcode , output , err ) = run_command ( command ) #NEWLINE# if ( retcode > 0 ) : #NEWLINE# #INDENT# status_err ( err ) #NEWLINE# #UNINDENT# if ( not output ) : #NEWLINE# #INDENT# status_err ( 'No output received from vgs command. Cannot gather metrics.' ) #NEWLINE# #UNINDENT# ( totalsize , free ) = [ int ( float ( x ) ) for x in output . split ( ) ] #NEWLINE# used = ( totalsize - free ) #NEWLINE# sizes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# sizes [ 'totalsize' ] = totalsize #NEWLINE# sizes [ 'free' ] = free #NEWLINE# sizes [ 'used' ] = used #NEWLINE# print_metrics ( sizes , vgname )