Module: check_mk
Branch: master
Commit: 93efd34f6f31a8d29089d82dc5ad9610ef71bc8e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=93efd34f6f31a8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 19 18:45:33 2015 +0100
Minor code changes in code for PNP graphs
---
web/htdocs/check_mk.css | 1 +
web/htdocs/htmllib.py | 5 +++--
web/htdocs/valuespec.py | 3 +++
web/plugins/metrics/check_mk.py | 4 ++--
web/plugins/views/painters.py | 22 ++++++++++++++++------
5 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css
index 8ff0a64..99a8146 100644
--- a/web/htdocs/check_mk.css
+++ b/web/htdocs/check_mk.css
@@ -551,6 +551,7 @@ table.graph {
border-spacing: 0px;
background-color: #f8f4f0;
padding: 8px 16px 4px 8px;
+ margin-bottom: 5px;
}
table.graph td.title {
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 624941e..d5509df 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -773,9 +773,10 @@ class html:
self.add_custom_style_sheet()
# Load specified Javascript files
- for js in [ "checkmk", "hover" ] + javascripts:
+ for js in [ "checkmk", "hover", "graphs" ] +
javascripts:
if defaults.omd_root:
- fname = 'js/%s-%s.js' % (js, defaults.check_mk_version)
+ if os.path.exists(defaults.omd_root +
"/share/check_mk/web/htdocs/js/" + js + ".js"):
+ fname = 'js/%s-%s.js' % (js, defaults.check_mk_version)
else:
fname = 'js/%s.js' % js
self.write('<script type="text/javascript"
src="%s"></script>\n' % fname)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 37194f8..1b55091 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -2193,6 +2193,9 @@ class Timerange(CascadingDropdown):
CascadingDropdown.__init__(self, **kwargs)
def compute_range(self, rangespec):
+ if rangespec == None:
+ rangespec = "4h"
+
now = time.time()
if rangespec[0] == 'age':
from_time = now - rangespec[1]
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index 484c5c6..fd1bcf0 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -730,7 +730,7 @@ perfometer_info.append({
"fs_used(%)",
"fs_provisioning(%),fs_used(%),-#ffc030",
],
- "total" : "100",
+ "total" : 100,
"label" : ( "fs_used(%)", "%" ),
})
@@ -823,7 +823,7 @@ graph_info.append({
( "user,system,io_wait,+,+#004080", "line",
_("Total") ),
],
"mirror_legend" : True,
- "range" : (0, 100),
+ # "range" : (0, 100),
})
graph_info.append({
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index fb049e4..52a8ef6 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -781,7 +781,18 @@ multisite_painters["svc_group_memberlist"] = {
}
# PNP Graphs
-def paint_pnpgraph(sitename, host, service = "_HOST_"):
+def paint_pnpgraph(row):
+ try:
+ css, htmlcode = paint_svc_time_graph(row)
+ if htmlcode:
+ return css, htmlcode
+ except NameError:
+ pass
+
+ sitename = row["site"]
+ host = row["host_name"]
+ service = row.get("service_description", "_HOST_")
+
container_id = "%s_%s_%s_graph" % (sitename, host, service)
pnp_url = html.site_status[sitename]["site"]["url_prefix"] +
"pnp4nagios/"
if 'X' in html.display_options:
@@ -806,11 +817,10 @@ def paint_pnpgraph(sitename, host, service = "_HOST_"):
defaults.url_prefix + "check_mk/", pnp_url,
with_link, _('Add this graph to...'), from_ts, to_ts)
multisite_painters["svc_pnpgraph" ] = {
- "title" : _("PNP service graph"),
- "short" : _("PNP graph"),
- "columns" : [ "host_name", "service_description" ],
+ "title" : _("Service Graphs"),
+ "columns" : [ "host_name", "service_description",
"service_perf_data", "service_check_command" ],
"options" : [ 'pnp_timerange' ],
- "paint" : lambda row: paint_pnpgraph(row["site"],
row["host_name"], row["service_description"]),
+ "paint" : paint_pnpgraph,
"printable" : False,
}
@@ -1163,7 +1173,7 @@ multisite_painters["host_pnpgraph" ] = {
"short" : _("PNP graph"),
"columns" : [ "host_name" ],
"options" : [ 'pnp_timerange' ],
- "paint" : lambda row: paint_pnpgraph(row["site"],
row["host_name"]),
+ "paint" : paint_pnpgraph,
"printable" : False,
}