Chapter 09/circuit-oneops-1-master/components/cookbooks/diagnostic_cache/files/default/couchbase_monitor.rb
#Custom formula to compute data availability for a bucket
Custom formula to compute data availability for a bucket
Custom formula to compute data availability for a bucket
def data_availability(node_size, replica_count, healthy_nodes, failover_nodes)
    logger.info "data_availability:start: node_size = #{node_size}, replica_count = #{replica_count},
      healthy_nodes = #{healthy_nodes}, failover_nodes = #{failover_nodes}"
    data_percent_per_node = 1.0 / node_size
    replica_data_percent_per_node = data_percent_per_node * replica_count
    replica_data_percent_per_node_with_failover = 0
    availability = 0
    if (0 < failover_nodes)
        replica_data_percent_per_node_with_failover = replica_data_percent_per_node / (node_size - failover_nodes)
    end
    availability = (data_percent_per_node + replica_data_percent_per_node_with_failover) * healthy_nodes
    if (availability > 1)
        availability = 1
    end
    return_value = "#{'%.2f' % (availability * 100)}"
    logger.info "data_availability:end: return_value = #{return_value}"
    return return_value
  end
def data_availability ( node_size , replica_count , healthy_nodes , failover_nodes ) logger . info "data_availability:start: node_size = #{node_size}, replica_count = #{replica_count},
      healthy_nodes = #{healthy_nodes}, failover_nodes = #{failover_nodes}" data_percent_per_node = 1.0 / node_size replica_data_percent_per_node = data_percent_per_node * replica_count replica_data_percent_per_node_with_failover = 0 availability = 0 if ( 0 < failover_nodes ) replica_data_percent_per_node_with_failover = replica_data_percent_per_node / ( node_size - failover_nodes ) end availability = ( data_percent_per_node + replica_data_percent_per_node_with_failover ) * healthy_nodes if ( availability > 1 ) availability = 1 end return_value = "#{'%.2f' % (availability * 100)}" logger . info "data_availability:end: return_value = #{return_value}" return return_value end
Custom formula to compute data availability for a bucket
Custom formula to compute data availability for a bucket
node_size
<not_specific>
replica_count
<not_specific>
healthy_nodes
<not_specific>
failover_nodes
<not_specific>