Module: check_mk
Branch: master
Commit: d6f5294d0ba1c637ba8d1ee344b260353d523207
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d6f5294d0ba1c6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jun 1 12:47:44 2018 +0200
6281 Add Edition and running core to crash reports
---
.werks/6281 | 10 ++++++++++
cmk/crash_reporting.py | 13 +++++++++++--
web/htdocs/crash_reporting.py | 7 +++++--
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/.werks/6281 b/.werks/6281
new file mode 100644
index 0000000..e2cb48a
--- /dev/null
+++ b/.werks/6281
@@ -0,0 +1,10 @@
+Title: Add Edition and running core to crash reports
+Level: 1
+Component: core
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1530520342
+Class: feature
+
+
diff --git a/cmk/crash_reporting.py b/cmk/crash_reporting.py
index d709a3c..467994a 100644
--- a/cmk/crash_reporting.py
+++ b/cmk/crash_reporting.py
@@ -35,13 +35,14 @@ import pprint
import sys
import time
import traceback
+import subprocess
try:
import simplejson as json
except ImportError:
import json
-from . import __version__
+import cmk
# The default JSON encoder raises an exception when detecting unknown types. For the
crash
# reporting it is totally ok to have some string representations of the objects.
@@ -62,7 +63,7 @@ def create_crash_info(crash_type, details=None, version=None):
details = {}
if version == None:
- version = __version__
+ version = cmk.__version__
exc_type, exc_value, exc_traceback = sys.exc_info()
@@ -71,6 +72,8 @@ def create_crash_info(crash_type, details=None, version=None):
"time" : time.time(),
"os" : get_os_info(),
"version" : version,
+ "edition" : cmk.edition_short(),
+ "core" : _current_monitoring_core(),
"python_version": sys.version,
"python_paths" : sys.path,
"exc_type" : exc_type.__name__,
@@ -106,6 +109,12 @@ def get_os_info():
return "UNKNOWN"
+def _current_monitoring_core():
+ p = subprocess.Popen(["omd", "config", "show",
"CORE"], close_fds=True, shell=False,
+ stdin=open(os.devnull), stdout=subprocess.PIPE, stderr=open(os.devnull,
"w"))
+ return p.communicate()[0]
+
+
def get_local_vars_of_last_exception():
local_vars = {}
try:
diff --git a/web/htdocs/crash_reporting.py b/web/htdocs/crash_reporting.py
index f49d302..d2dad34 100644
--- a/web/htdocs/crash_reporting.py
+++ b/web/htdocs/crash_reporting.py
@@ -313,11 +313,14 @@ def show_crash_report(info):
else:
version_title = _("Check_MK Version")
_crash_row(version_title, info["version"], True)
+ _crash_row(_("Edition"), info.get("edition", ""),
False)
+ _crash_row(_("Core"), info.get("core", ""), True)
_crash_row(_("Python Version"), info.get("python_version",
_("Unknown")), False)
_crash_row(_("Exception"), "%s (%s)" %
(info["exc_type"], info["exc_value"]), odd=True, pre=True)
_crash_row(_("Traceback"),
format_traceback(info["exc_traceback"]), odd=False, pre=True)
- if "local_vars" in info:
- _crash_row(_("Local Variables"),
format_local_vars(info["local_vars"]), odd=True, pre=True)
+ _crash_row(_("Local Variables"),
+ format_local_vars(info["local_vars"]) if "local_vars" in info
else "", odd=True, pre=True)
+
joined_paths = "<br>".join([ html.attrencode(p) for p in
info.get("python_paths", [_("Unknown")]) ])
_crash_row(_("Python Module Paths"), joined_paths, odd=False)