def run(self, accessor, scale, threshold=None): result = {} if threshold.has_key(accessor["name"]): threshold_val = threshold[accessor["name"]] elif accessor.has_key("threshold"): threshold_val = accessor["threshold"] else: threshold_val = None for bucket, bucket_stats in stats_buffer.node_stats.iteritems(): stats = [] for node, stats_info in bucket_stats.iteritems(): if accessor["counter"] not in stats_info.keys(): stats.append((node, "N/A")) continue for key, value in stats_info.iteritems(): if isinstance(value, dict): continue if key.find(accessor["counter"]) >= 0: if accessor.has_key("threshold"): if int(value) > threshold_val: stats.append((node, (key, value))) else: if accessor.has_key("unit"): if accessor["unit"] == "time": stats.append((node, util.time_label(value))) elif accessor["unit"] == "size": stats.append((node, util.size_label(int(value)))) else: stats.append((node, (key,value))) result[bucket] = stats return result
def run(self, accessor, scale, threshold=None): result = {} for bucket, stats_info in stats_buffer.buckets.iteritems(): values = stats_info[scale][accessor["counter"]] timestamps = values["timestamp"] timestamps = [x - timestamps[0] for x in timestamps] nodeStats = values["nodeStats"] for node, vals in nodeStats.iteritems(): if len(vals): avg = vals[-1] else: avg = 0 if accessor.has_key("unit"): if accessor["unit"] == "size": avg = util.size_label(avg) elif accessor["unit"] == "number": avg = util.number_label(avg) elif accessor["unit"] == "time": avg = util.time_label(avg) else: avg = util.pretty_float(avg) if result.has_key(node): result[node].append((bucket, avg)) else: result[node] = [(bucket, avg)] return result
def run(self, accessor, threshold=None): result = {} if threshold.has_key("MemoryFragmentation"): threshold_val = threshold["MemoryFragmentation"][accessor["name"]] else: threshold_val = accessor["threshold"] for bucket, bucket_stats in stats_buffer.node_stats.iteritems(): num_error = [] for node, stats_info in bucket_stats.iteritems(): for key, value in stats_info.iteritems(): if key.find(accessor["counter"]) >= 0: if accessor.has_key("threshold"): if int(value) > threshold_val: if accessor.has_key("unit"): if accessor["unit"] == "time": symptom = accessor["symptom"].format(util.time_label(value), util.time_label(threshold_val)) num_error.append({"node":node, "value": symptom}) elif accessor["unit"] == "size": symptom = accessor["symptom"].format(util.size_label(value), util.size_label(threshold_val)) num_error.append({"node":node, "value": symptom}) else: symptom = accessor["symptom"].format(value, threshold_val) num_error.append({"node":node, "value": symptom}) else: symptom = accessor["symptom"].format(value, threshold_val) num_error.append({"node":node, "value": symptom}) if len(num_error) > 0: result[bucket] = {"error" : num_error} return result
def run(self, accessor, scale, threshold=None): result = {} sizing = {} if threshold.has_key(accessor["name"]): threshold_val = threshold[accessor["name"]] elif accessor.has_key("threshold"): threshold_val = accessor["threshold"] else: threshold_val = None for bucket, bucket_stats in stats_buffer.node_stats.iteritems(): stats = [] for node, stats_info in bucket_stats.iteritems(): if not sizing.has_key(node): sizing[node] = [] if accessor["counter"][0] not in stats_info.keys(): stats.append((node, "N/A")) sizing[node].append((bucket, "N/A")) continue for key, value in stats_info.iteritems(): if isinstance(value, dict): continue if key.find(accessor["counter"][0]) >= 0: if accessor["counter"][1] in stats_info and \ accessor["counter"][2] in stats_info: total_item_resident = int(stats_info[accessor["counter"][1]]) -\ int(stats_info[accessor["counter"][2]]) if total_item_resident: value = float(value) / total_item_resident else: value = 0 if accessor.has_key("unit"): if accessor["unit"] == "time": stats.append((node, util.time_label(value))) sizing[node].append((bucket, util.time_label(value))) elif accessor["unit"] == "size": stats.append((node, util.size_label(int(value)))) sizing[node].append((bucket, util.size_label(int(value)))) else: stats.append((node, (key,value))) result[bucket] = stats result["_sizing"] = sizing return result
def run(self, accessor): result = {} for bucket, bucket_stats in stats_buffer.node_stats.iteritems(): stats = [] for node, stats_info in bucket_stats.iteritems(): for key, value in stats_info.iteritems(): if key.find(accessor["counter"]) >= 0: if accessor.has_key("threshold"): if int(value) > accessor["threshold"]: stats.append((node, (key, value))) else: if accessor.has_key("unit"): if accessor["unit"] == "time": stats.append((node, util.time_label(value))) elif accessor["unit"] == "size": stats.append((node, util.size_label(int(value)))) else: stats.append((node, (key,value))) result[bucket] = stats return result
def run(self, accessor): result = {} for bucket, bucket_stats in stats_buffer.node_stats.iteritems(): stats = [] for node, stats_info in bucket_stats.iteritems(): for key, value in stats_info.iteritems(): if key.find(accessor["counter"]) >= 0: if accessor.has_key("threshold"): if int(value) > accessor["threshold"]: stats.append((node, (key, value))) else: if accessor.has_key("unit"): if accessor["unit"] == "time": stats.append( (node, util.time_label(value))) elif accessor["unit"] == "size": stats.append( (node, util.size_label(int(value)))) else: stats.append((node, (key, value))) result[bucket] = stats return result
def run(self, accessor): result = {} for bucket, bucket_stats in stats_buffer.node_stats.iteritems(): num_error = [] for node, stats_info in bucket_stats.iteritems(): for key, value in stats_info.iteritems(): if key.find(accessor["counter"]) >= 0: if accessor.has_key("threshold"): if int(value) > accessor["threshold"]: if accessor.has_key("unit"): if accessor["unit"] == "time": num_error.append({"node":node, "value": (key, util.time_label(value))}) elif accessor["unit"] == "size": num_error.append({"node":node, "value": (key, util.size_label(value))}) else: num_error.append({"node":node, "value": (key, value)}) else: num_error.append({"node":node, "value": (key, value)}) if len(num_error) > 0: result[bucket] = {"error" : num_error} return result