def check_current_lock(con, host, port, warning, critical, perf_data):
 warning = (warning or 10)
 critical = (critical or 30)
 data = get_server_status(con)
 lockTime = float(data['globalLock']['lockTime'])
 totalTime = float(data['globalLock']['totalTime'])
 (err, delta) = maintain_delta([totalTime, lockTime], host, port, 'locktime')
 if (err == 0):
  lock_percentage = ((delta[2] / delta[1]) * 100)
  message = ('Current Lock Percentage: %.2f%%' % lock_percentage)
  message += performance_data(perf_data, [(('%.2f' % lock_percentage), 'current_lock_percentage', warning, critical)])
  return check_levels(lock_percentage, warning, critical, message)
 else:
  return exit_with_general_warning('problem reading data from temp file')

def check_current_lock ( con , host , port , warning , critical , perf_data ) : warning = ( warning or 10 ) critical = ( critical or 30 ) data = get_server_status ( con ) lockTime = float ( data [ 'globalLock' ] [ 'lockTime' ] ) totalTime = float ( data [ 'globalLock' ] [ 'totalTime' ] ) ( err , delta ) = maintain_delta ( [ totalTime , lockTime ] , host , port , 'locktime' ) if ( err == 0 ) : lock_percentage = ( ( delta [ 2 ] / delta [ 1 ] ) * 100 ) message = ( 'Current Lock Percentage: %.2f%%' % lock_percentage ) message += performance_data ( perf_data , [ ( ( '%.2f' % lock_percentage ) , 'current_lock_percentage' , warning , critical ) ] ) return check_levels ( lock_percentage , warning , critical , message ) else : return exit_with_general_warning ( 'problem reading data from temp file' )
a function to get current lock percentage and not a global one .