Module: check_mk
Branch: master
Commit: c565f636bd96305f43bd05526ccf3325fa395d34
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c565f636bd9630…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Sep 14 14:16:30 2016 +0200
3874 FIX fixed graphs displaying wrong labels
---
.werks/3874 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/lib.py | 15 ++++++---------
web/plugins/metrics/check_mk.py | 6 ++++++
4 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/.werks/3874 b/.werks/3874
new file mode 100644
index 0000000..4f0d816
--- /dev/null
+++ b/.werks/3874
@@ -0,0 +1,10 @@
+Title: fixed graphs displaying wrong labels
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1473855295
+
+
diff --git a/ChangeLog b/ChangeLog
index 5210c40..db7bf5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -495,6 +495,7 @@
* 3767 FIX: Fixed possible UnicodeDecodeError when having users with umlauts in the
user ID
* 3850 FIX: Fixed JS error when quicksearch snapin not in sidebar
* 3871 FIX: stale services view: excluded services in downtime per default
+ * 3874 FIX: fixed graphs displaying wrong labels
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index 148697c..dfaf6b1 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -560,7 +560,7 @@ def nic_speed_human_readable(bits_per_second):
# and drop useless zeroes at the end of the fraction
# 45.1 -> "45.1"
# 45.0 -> "45"
-def drop_dotzero(v, digits=1):
+def drop_dotzero(v, digits=2):
t = "%%.%df" % digits % v
if "." in t:
return t.rstrip("0").rstrip(".")
@@ -700,7 +700,6 @@ def date_month_human_readable(timestamp):
def calculate_scaled_number(v, base=1024.0, precision=1):
base = float(base)
- digits = 1
if v >= base ** 4:
symbol = "T"
scale = base ** 4
@@ -725,14 +724,9 @@ def calculate_scaled_number(v, base=1024.0, precision=1):
def calculate_scaled_bytes(v, base=1024.0, bytefrac=True):
+ digits = 2
if not bytefrac:
digits = 0
- elif v >= 100:
- digits = 0
- elif v >= 10:
- digits = 1
- else:
- digits = 2
return calculate_scaled_number(v, base, precision=digits)
@@ -749,7 +743,10 @@ def bytes_human_readable(b, *args, **kwargs):
scale_symbol, places_after_comma, scale_factor = calculate_scaled_bytes(b, *args,
**kwargs)
scaled_value = float(b) / scale_factor
- return (u"%%.%df %%s%%s" % places_after_comma) % (scaled_value,
scale_symbol, unit)
+ if scale_symbol == "" and unit == "B":
+ return u"%.0f %s%s" % (scaled_value, scale_symbol, unit)
+ else:
+ return (u"%%.%df %%s%%s" % places_after_comma) % (scaled_value,
scale_symbol, unit)
def bytes_human_readable_list(values, *args, **kwargs):
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index 2cac0b9..51739e4 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -512,6 +512,12 @@ metric_info["mem_used"] = {
"unit" : "bytes",
}
+metric_info["mem_available"] = {
+ "color" : "21/a",
+ "title" : _("RAM available"),
+ "unit" : "bytes",
+}
+
metric_info["pagefile_used"] = {
"color": "#408f20",
"title" : _("Commit Charge"),