def run(self, accessor): result = {} start_cluster = 0 end_cluster = 0 for bucket, stats_info in stats_buffer.buckets.iteritems(): trend = [] values = stats_info[accessor["scale"]][accessor["counter"]] timestamps = values["timestamp"] timestamps = [x - timestamps[0] for x in timestamps] nodeStats = values["nodeStats"] samplesCount = values["samplesCount"] for node, vals in nodeStats.iteritems(): a, b = util.linreg(timestamps, vals) if b < 1: trend.append((node, 0)) else: start_val = b start_cluster += b end_val = a * timestamps[-1] + b end_cluster += end_val rate = (end_val * 1.0 / b - 1.0) * 100 trend.append((node, util.pretty_float(rate) + "%")) result[bucket] = trend if len(stats_buffer.buckets) > 0: rate = (end_cluster * 1.0 / start_cluster - 1.0) * 100 result["cluster"] = util.pretty_float(rate) + "%" return result
def run(self, accessor, scale, threshold=None): result = {} if threshold.has_key("DiskQueueDiagnosis"): threshold_val = threshold["DiskQueueDiagnosis"][accessor["name"]] else: threshold_val = accessor["threshold"] for bucket, stats_info in stats_buffer.buckets.iteritems(): trend_error = [] trend_warn = [] res = [] values = stats_info[scale][accessor["counter"]] timestamps = values["timestamp"] timestamps = [x - timestamps[0] for x in timestamps] nodeStats = values["nodeStats"] samplesCount = values["samplesCount"] for node, vals in nodeStats.iteritems(): a, b = util.linreg(timestamps, vals) if a > threshold_val["high"]: symptom = accessor["symptom"] % (util.pretty_float(a, 3), threshold_val["high"]) trend_error.append({"node":node, "level":"red", "value":symptom}) res.append((node, util.pretty_float(a))) elif a > threshold_val["low"]: symptom = accessor["symptom"] % (util.pretty_float(a, 3), threshold_val["low"]) trend_warn.append({"node":node, "level":"yellow", "value":symptom}) res.append((node, util.pretty_float(a))) if len(trend_error) > 0: res.append(("error", trend_error)) if len(trend_warn) > 0: res.append(("warn", trend_warn)) result[bucket] = res return result
def run(self, accessor): result = {} for bucket, stats_info in stats_buffer.buckets.iteritems(): values = stats_info[accessor["scale"]][accessor["counter"]] timestamps = values["timestamp"] timestamps = [x - timestamps[0] for x in timestamps] nodeStats = values["nodeStats"] samplesCount = values["samplesCount"] trend = [] for node, vals in nodeStats.iteritems(): a, b = util.linreg(timestamps, vals) trend.append((node, a)) result[bucket] = trend 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"] samplesCount = values["samplesCount"] for node, vals in nodeStats.iteritems(): trend = 0 if len(vals): trend, b = util.linreg(timestamps, vals) if result.has_key(node): result[node].append((bucket, trend)) else: result[node] = [(bucket, trend)] 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"] samplesCount = values["samplesCount"] trend = [] for node, vals in nodeStats.iteritems(): if len(vals) == 0: trend.append((node, 0, 0)) else: a, b = util.linreg(timestamps, vals) trend.append((node, a, vals[-1])) result[bucket] = trend return result
def run(self, accessor): result = {} for bucket, stats_info in stats_buffer.buckets.iteritems(): trend_error = [] trend_warn = [] values = stats_info[accessor["scale"]][accessor["counter"]] timestamps = values["timestamp"] timestamps = [x - timestamps[0] for x in timestamps] nodeStats = values["nodeStats"] samplesCount = values["samplesCount"] for node, vals in nodeStats.iteritems(): a, b = util.linreg(timestamps, vals) if a > accessor["threshold"]["high"]: trend_error.append({"node":node, "level":"red", "value":a}) elif a > accessor["threshold"]["low"]: trend_warn.append({"node":node, "level":"yellow", "value":a}) if len(trend_error) > 0: result[bucket] = {"error" : trend_error} if len(trend_warn) > 0: result[bucket] = {"warn" : trend_warn} return result