Module: check_mk
Branch: master
Commit: d1d8fe42a5f0027fcb5d6d974299c50490e6686e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d1d8fe42a5f002…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 29 08:53:02 2016 +0200
Fixed exception in WATO web API introduced by changes some weeks ago
---
web/htdocs/htmllib.py | 7 +++++--
web/htdocs/webapi.py | 8 ++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 7a5a746..5226135 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -377,11 +377,14 @@ class html(GUITester):
# The concept is that the user can either provide the data in a single "request" variable,
# which contains the request data encoded as JSON, or provide multiple GET/POST vars which
# are then used as top level entries in the request object.
- def get_request(self):
+ def get_request(self, exclude_vars=None):
+ if exclude_vars == None:
+ exclude_vars = []
+
request = json.loads(self.var("request", "{}"))
for key, val in self.all_vars().items():
- if key not in [ "request", "output_format" ]:
+ if key not in [ "request", "output_format" ] + exclude_vars:
request[key] = val
return request
diff --git a/web/htdocs/webapi.py b/web/htdocs/webapi.py
index 34b18e2..a14cdc8 100644
--- a/web/htdocs/webapi.py
+++ b/web/htdocs/webapi.py
@@ -83,11 +83,11 @@ def page_api():
# Most of the time the request is given as json
# However, the plugin may have an own mechanism to interpret the request
request_object = {}
- if html.var("request"):
- if api_actions[action].get("dont_eval_request"):
+ if api_actions[action].get("dont_eval_request"):
+ if html.var("request"):
request_object = html.var("request")
- else:
- request_object = html.get_request()
+ else:
+ request_object = html.get_request(exclude_vars=["action"])
if api_actions[action].get("locking", True):
lock_exclusive() # unlock is done automatically
Module: check_mk
Branch: master
Commit: 8fc2638cd56a6b0121c043f0999174f74ab18f8a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fc2638cd56a6b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 29 08:17:01 2016 +0200
3726 FIX Web API: Fixed default output format - using JSON as intended
The WATO Web API was using Python as default output format since version
1.2.8b8 and commit 36142e6d, which was not intended.
The Web API is able to output JSON and Python formated data, which can be
toggled using the variable <tt>output_format=json</tt> or
<tt>output_format=python</tt>. The default has now been changed back to
be JSON.
In case you created scripts against this API since 1.2.8b8, did not use
a JSON parser to load the data and used something like <tt>eval()</tt>
in Python instead, you will have to change your scripts. You can either
add the variable <tt>output_format=python</tt> or replace your <tt>eval()</tt>
with <tt>json.loads()</tt> in Python.
---
.werks/3726 | 22 ++++++++++++++++++++++
ChangeLog | 1 +
web/htdocs/webapi.py | 6 +++++-
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/.werks/3726 b/.werks/3726
new file mode 100644
index 0000000..05e7684
--- /dev/null
+++ b/.werks/3726
@@ -0,0 +1,22 @@
+Title: Web API: Fixed default output format - using JSON as intended
+Level: 2
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1469772716
+
+The WATO Web API was using Python as default output format since version
+1.2.8b8 and commit 36142e6d, which was not intended.
+
+The Web API is able to output JSON and Python formated data, which can be
+toggled using the variable <tt>output_format=json</tt> or
+<tt>output_format=python</tt>. The default has now been changed back to
+be JSON.
+
+In case you created scripts against this API since 1.2.8b8, did not use
+a JSON parser to load the data and used something like <tt>eval()</tt>
+in Python instead, you will have to change your scripts. You can either
+add the variable <tt>output_format=python</tt> or replace your <tt>eval()</tt>
+with <tt>json.loads()</tt> in Python.
diff --git a/ChangeLog b/ChangeLog
index 2e7777b..5873df9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -509,6 +509,7 @@
* 3557 FIX: Web API: get_host/get_all_hosts action now also returns the nodes of cluster host
* 3718 FIX: Changes not needing a core restart are not showing up pending changes anymore...
* 3719 FIX: Fixed possible wrong encoding of audit log messages when editing global settings
+ * 3726 FIX: Web API: Fixed default output format - using JSON as intended...
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/htdocs/webapi.py b/web/htdocs/webapi.py
index 5440e90..02dd0a3 100644
--- a/web/htdocs/webapi.py
+++ b/web/htdocs/webapi.py
@@ -59,13 +59,17 @@ def load_plugins(force):
def page_api():
try:
+ # The API uses JSON format by default and python as optional alternative
+ output_format = html.var("output_format", "json")
+ if output_format not in [ "json", "python" ]:
+ html.set_output_format("json")
+ raise MKUserError(None, "Only \"json\" and \"python\" are supported as output formats")
if not config.user.get("automation_secret"):
raise MKAuthException("The WATO API is only available for automation users")
config.need_permission("wato.use")
config.need_permission("wato.api_allowed")
-
action = html.var('action')
if action not in api_actions:
raise MKUserError(None, "Unknown API action %s" % html.attrencode(action))
Module: check_mk
Branch: master
Commit: b675387019da7632e69edad542c866b49163487a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b675387019da76…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 29 08:22:40 2016 +0200
WATO webapi: now really fixed format
---
web/htdocs/webapi.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/webapi.py b/web/htdocs/webapi.py
index 02dd0a3..34b18e2 100644
--- a/web/htdocs/webapi.py
+++ b/web/htdocs/webapi.py
@@ -62,8 +62,10 @@ def page_api():
# The API uses JSON format by default and python as optional alternative
output_format = html.var("output_format", "json")
if output_format not in [ "json", "python" ]:
- html.set_output_format("json")
raise MKUserError(None, "Only \"json\" and \"python\" are supported as output formats")
+ else:
+ html.set_output_format(output_format)
+
if not config.user.get("automation_secret"):
raise MKAuthException("The WATO API is only available for automation users")
@@ -104,5 +106,4 @@ def page_api():
if html.output_format == "json":
html.write(json.dumps(response))
else:
- html.set_output_format("python")
html.write(repr(response))
Module: check_mk
Branch: master
Commit: edd676c6d820beab7189f81f8c9f6806e7f1755a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=edd676c6d820be…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 28 16:05:40 2016 +0200
Added missing help text about macros to datasource programs
---
web/htdocs/wato.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index b44880d..d3c2b44 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2472,8 +2472,7 @@ def mode_diag_host(phase):
"program that should be called by Check_MK instead of connecting the agent "
"via TCP. That program must output the agent's data on standard output in "
"the same format the agent would do. This is for example useful for monitoring "
- "via SSH. The command line may contain the placeholders <tt><IP></tt> and "
- "<tt><HOST></tt>.")
+ "via SSH.") + monitoring_macro_help(),
))
]
)
Module: check_mk
Branch: master
Commit: ab0e3884a39cd98ae588c12587c80f09b8ac844b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ab0e3884a39cd9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 28 14:54:07 2016 +0200
3725 mssql_instance: Changed MSSQL monitoring to report connection issues with only one service
The MSSQL monitoring has been reworked to have one single service per database instance that
reports connection issues like a stopped database. This is done by the <tt>mssql_instance</tt>
check.
All other MSSQL checks have been reworked to become <i>stale</i> in case there is a connection
issue and no data is present.
As a result you will only receive one notification and see only the relevant issue in the GUI
in case an instance goes down.
To make this work you will have to update the <tt>mssql.vbs</tt> agent plugin on all your
database servers.
---
.werks/3725 | 20 +++++++++
ChangeLog | 1 +
agents/windows/plugins/mssql.vbs | 92 ++++++++++++++++++++++++++++++--------
checkman/mssql_instance | 24 ++++++++++
checks/mssql.include | 9 +++-
checks/mssql_backup | 7 +++
checks/mssql_blocked_sessions | 22 ++++-----
checks/mssql_counters | 30 +++++++++++--
checks/mssql_instance | 91 +++++++++++++++++++++++++++++++++++++
checks/mssql_tablespaces | 4 +-
checks/mssql_versions | 10 +++++
11 files changed, 276 insertions(+), 34 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=ab0e3884a3…