Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add more unit for stats values

  • Loading branch information...
commit 43d8951888f8222ed342c6e503028fe9b83b5972 1 parent c3a4db9
@bcui6611 bcui6611 authored
Showing with 22 additions and 11 deletions.
  1. +16 −5 cluster_stats.py
  2. +5 −5 diskqueue_stats.py
  3. +1 −1  prescription.py
View
21 cluster_stats.py
@@ -184,7 +184,7 @@ def run(self, accessor, scale, threshold=None):
value = max(0, value)
total.append(value)
if value > thresholdval:
- symptom = accessor["symptom"].format(value, thresholdval)
+ symptom = accessor["symptom"].format(util.pretty_float(value), thresholdval)
num_error.append({"node":node, "value":symptom})
trend.append((node, {"value" : util.pretty_float(value) + "%",
"raw" : vals,
@@ -466,7 +466,8 @@ def run(self, accessor, scale, threshold=None):
for key, value in stats_info.iteritems():
if key == accessor["counter"]:
if accessor.has_key("threshold") and not isinstance(value, dict):
- if int(value) > threshold_val:
+ value = int(value)
+ if value > threshold_val:
symptom = ""
if accessor.has_key("unit"):
if accessor["unit"] == "time":
@@ -483,7 +484,7 @@ def run(self, accessor, scale, threshold=None):
if accessor["unit"] == "time":
trend.append((node, {"value":util.time_label(value), "raw":value}))
elif accessor["unit"] == "size":
- trend.append((node, {"value":util.size_label(int(value)), "raw":value}))
+ trend.append((node, {"value":util.size_label(value), "raw":value}))
else:
trend.append((node, value))
if len(num_error) > 0:
@@ -510,7 +511,15 @@ def run(self, accessor, scale, threshold=None):
num_error.append({"node":node, "value": accessor["symptom"]})
else:
if value > threshold_val:
- symptom = accessor["symptom"].format(value, threshold_val)
+ if accessor.has_key("unit"):
+ if accessor["unit"] == "time":
+ symptom = accessor["symptom"].format(util.time_label(int(value)), util.time_label(threshold_val))
+ elif accessor["unit"] == "size":
+ symptom = accessor["symptom"].format(util.size_label(int(value)), util.size_label(threshold_val))
+ else:
+ symptom = accessor["symptom"].format(value, threshold_val)
+ 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}
@@ -595,7 +604,7 @@ def run(self, accessor, scale, threshold=None):
{
"name" : "cacheMissRatio",
"description" : "Cache miss ratio",
- "symptom" : "Cache miss ratio '{0}' is higher than threshold '{1}'",
+ "symptom" : "Cache miss ratio '{0}%' is higher than threshold '{1}%'",
"counter" : "ep_cache_miss_rate",
"scale" : "hour",
"code" : "CacheMissRatio",
@@ -861,6 +870,7 @@ def run(self, accessor, scale, threshold=None):
"description" : "Average item loaded time",
"counter" : "ep_bg_load_avg",
"code" : "EPEnginePerformance",
+ "unit" : "time",
"threshold" : 100,
"symptom" : "Average time '{0}' for items to be loaded is slower than '{1}'",
"formula" : "Avg(ep_bg_load_avg) > threshold",
@@ -870,6 +880,7 @@ def run(self, accessor, scale, threshold=None):
"description" : "Average item waited time",
"counter" : "ep_bg_wait_avg",
"code" : "EPEnginePerformance",
+ "unit" : "time",
"threshold" : 100,
"symptom" : "Average wait time '{0}' for items to be serviced by dispatcher is slower than '{1}'",
"formula" : "Avg(ep_bg_wait_avg) > threshold",
View
10 diskqueue_stats.py
@@ -56,11 +56,11 @@ def run(self, accessor, scale, threshold=None):
for node, vals in nodeStats.iteritems():
a, b = util.linreg(timestamps, vals)
if a > threshold_val["high"]:
- symptom = accessor["symptom"].format(util.pretty_float(a), threshold_val["high"])
+ symptom = accessor["symptom"].format(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"].format(util.pretty_float(a), threshold_val["low"])
+ symptom = accessor["symptom"].format(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:
@@ -102,13 +102,13 @@ def run(self, accessor, scale, threshold=None):
res.append((active[0], 0))
else:
ratio = 100.0 * replica[1] / active[1]
- delta = replica[1]
+ delta = int(replica[1])
if ratio > threshold_val["percentage"]["high"]:
symptom = accessor["symptom"].format(util.pretty_float(ratio), threshold_val["percentage"]["high"])
num_error.append({"node":active[0], "value": symptom})
res.append((active[0], util.pretty_float(ratio)))
elif delta > threshold_val["number"]["high"]:
- symptom = accessor["symptom"].format(int(delta), threshold_val["number"]["high"])
+ symptom = accessor["symptom"].format(util.number_label(delta), util.number_label(threshold_val["number"]["high"]))
num_error.append({"node":active[0], "value": symptom})
res.append((active[0], int(delta)))
elif ratio > threshold_val["percentage"]["low"]:
@@ -116,7 +116,7 @@ def run(self, accessor, scale, threshold=None):
num_warn.append({"node":active[0], "value": symptom})
res.append((active[0], util.pretty_float(ratio)))
elif delta > threshold_val["number"]["low"]:
- symptom = accessor["symptom"].format(int(delta), threshold_val["number"]["low"])
+ symptom = accessor["symptom"].format(util.number_label(delta), util.number_label(threshold_val["number"]["low"]))
num_warn.append({"node":active[0], "value": symptom})
res.append((active[0], int(delta)))
active_total += active[1]
View
2  prescription.py
@@ -38,7 +38,7 @@
"action" : "Replace problem node. If issue persists, please contact support@couchbase.com",
},
"EPEnginePerformance" : {
- "cause" : "Poor engine Key Performance Indicators",
+ "cause" : "Poor ep-engine key performance indicators",
"impact" : "To be defined",
"action" : "Please contact support@couchbase.com",
},
Please sign in to comment.
Something went wrong with that request. Please try again.