Module: check_mk
Branch: master
Commit: 8323642972e776566b145e2bb015b18070f74887
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8323642972e776…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 22 14:41:01 2017 +0200
4733 Check_MK graphs can now be exported as PNG images
It is now possible to export the Check_MK graphs as static PNG images. This mechanism
can be used to to integrate the graphs in 3rd party tools. For example, you can use it
to add graphs to NagVis maps or to the hover menu of NagVis.
The new page is named <tt>graph_image.py</tt>. The page is receiving a single request
parameter that is structured equal to the JSON/python graph API (See werk #8643).
The request object is structured like this:
F+:
{
"specification": [..., ...],
"data_range": {
"time_range" : [..., ...],
}
}
F-:
The specification is using the Check_MK internal graph specification
format. The first element is the specification type (<tt>template</tt>,
<tt>custom</tt> or <tt>explicit</tt>. The structure of the second element
depends on the type. Please take a look at the examples below to get an idea
of it.
The time range is given in two unix timestamps, the start time and the
end time. But the whole <tt>data_range</tt> specification is optional. In
case you don't provide it, the 25h graph will be rendered.
The answer to this request is a single, dynamically rendered, PNG image.
Please note that this request is done in the context of the currently logged
in user. So the user that opens a page containing this snippet needs to be
authenticated with the Check_MK GUI and able to see the image. Otherwise the
user won't be able to see the image.
The most common use case will be to add the image generated by this. The
following snippets show how it can be embedded:
F+:
<img src="http://mycmkserver/mysite/check_mk/graph_image.py?request={%22specification…">
F-:
This will try to open the image from the Check_MK site <tt>mysite</tt> on
the server <tt>mycmkserver</tt>. The graph is specified by the following
request object in URL encoded form:
F+:
{
"specification": ["template", {
"service_description": "CPU load",
"site": "mysite",
"host_name": "myhost"
}]
}
F-:
It is also possible to adapt the rendering attributes of the graph using the
<tt>render_options</tt> data structure. This example hides the legend and the
title of the graph and sets a custom image size:
F+:
<img src="http://mycmkserver/mysite/check_mk/graph_image.py?request={%22specification…">
F-:
Again, the human friendly formated request object:
F+:
{
"specification": ["template", {
"service_description": "CPU load",
"site": "mysite",
"host_name": "myhost"
}],
"render_options": {
"show_legend": false,
"show_title": false,
"size": [ 50, 15 ]
}
}
F-:
In case you want to render custom graphs, you can use a specification like this
in your request. Replace <tt>custom_graph_1</tt> with the ID of the custom graph
you like to see:
F+:
["custom", "custom_graph_1"]
F-:
Change-Id: I148b6cf526b4ac19ea5ae604d948438c76f2a826
---
.werks/4733 | 97 ++++++++++++++++++++++++++++++++++++++++++++++++
tests/web/test_webapi.py | 67 +++++++++++++++++++++++++++++----
2 files changed, 156 insertions(+), 8 deletions(-)
diff --git a/.werks/4733 b/.werks/4733
new file mode 100644
index 0000000..23032a3
--- /dev/null
+++ b/.werks/4733
@@ -0,0 +1,97 @@
+Title: Check_MK graphs can now be exported as PNG images
+Level: 2
+Component: metrics
+Compatible: compat
+Edition: cee
+Version: 1.5.0i1
+Date: 1495455247
+Class: feature
+
+It is now possible to export the Check_MK graphs as static PNG images. This mechanism
+can be used to to integrate the graphs in 3rd party tools. For example, you can use it
+to add graphs to NagVis maps or to the hover menu of NagVis.
+
+The new page is named <tt>graph_image.py</tt>. The page is receiving a single request
+parameter that is structured equal to the JSON/python graph API (See werk #8643).
+
+The request object is structured like this:
+
+F+:
+{
+ "specification": [..., ...],
+ "data_range": {
+ "time_range" : [..., ...],
+ }
+}
+F-:
+
+The specification is using the Check_MK internal graph specification
+format. The first element is the specification type (<tt>template</tt>,
+<tt>custom</tt> or <tt>explicit</tt>. The structure of the second element
+depends on the type. Please take a look at the examples below to get an idea
+of it.
+
+The time range is given in two unix timestamps, the start time and the
+end time. But the whole <tt>data_range</tt> specification is optional. In
+case you don't provide it, the 25h graph will be rendered.
+
+The answer to this request is a single, dynamically rendered, PNG image.
+
+Please note that this request is done in the context of the currently logged
+in user. So the user that opens a page containing this snippet needs to be
+authenticated with the Check_MK GUI and able to see the image. Otherwise the
+user won't be able to see the image.
+
+The most common use case will be to add the image generated by this. The
+following snippets show how it can be embedded:
+
+F+:
+<img src="http://mycmkserver/mysite/check_mk/graph_image.py?request={%22specification…">
+F-:
+
+This will try to open the image from the Check_MK site <tt>mysite</tt> on
+the server <tt>mycmkserver</tt>. The graph is specified by the following
+request object in URL encoded form:
+
+F+:
+{
+ "specification": ["template", {
+ "service_description": "CPU load",
+ "site": "mysite",
+ "host_name": "myhost"
+ }]
+}
+F-:
+
+It is also possible to adapt the rendering attributes of the graph using the
+<tt>render_options</tt> data structure. This example hides the legend and the
+title of the graph and sets a custom image size:
+
+F+:
+<img src="http://mycmkserver/mysite/check_mk/graph_image.py?request={%22specification…">
+F-:
+
+Again, the human friendly formated request object:
+
+F+:
+{
+ "specification": ["template", {
+ "service_description": "CPU load",
+ "site": "mysite",
+ "host_name": "myhost"
+ }],
+ "render_options": {
+ "show_legend": false,
+ "show_title": false,
+ "size": [ 50, 15 ]
+ }
+}
+F-:
+
+In case you want to render custom graphs, you can use a specification like this
+in your request. Replace <tt>custom_graph_1</tt> with the ID of the custom graph
+you like to see:
+
+F+:
+["custom", "custom_graph_1"]
+F-:
diff --git a/tests/web/test_webapi.py b/tests/web/test_webapi.py
index 7d0d79b..d4bbf35 100644
--- a/tests/web/test_webapi.py
+++ b/tests/web/test_webapi.py
@@ -4,6 +4,10 @@
import pytest
import time
import os
+import json
+import base64
+from PIL import Image
+from StringIO import StringIO
from testlib import web, APIError
@@ -324,15 +328,62 @@ def test_get_graph(web, site):
assert site.file_exists("var/check_mk/rrd/test-host-get-graph/Check_MK.rrd"), \
"RRD %s is still missing" % "var/check_mk/rrd/test-host-get-graph/Check_MK.rrd"
- # Now we get a graph
- data = web.get_regular_graph("test-host-get-graph", "Check_MK", 0)
-
- assert len(data["curves"]) == 4
- assert data["curves"][0]["title"] == "CPU time in user space"
- assert data["curves"][1]["title"] == "CPU time in operating system"
- assert data["curves"][2]["title"] == "Time spent waiting for Check_MK agent"
- assert data["curves"][3]["title"] == "Total execution time"
+ _test_get_graph_api(web)
+ _test_get_graph_image(web)
+ _test_get_graph_notification_image(web)
finally:
web.delete_host("test-host-get-graph")
web.activate_changes()
+
+
+def _test_get_graph_api(web):
+ # Now we get a graph
+ data = web.get_regular_graph("test-host-get-graph", "Check_MK", 0)
+
+ assert len(data["curves"]) == 4
+ assert data["curves"][0]["title"] == "CPU time in user space"
+ assert data["curves"][1]["title"] == "CPU time in operating system"
+ assert data["curves"][2]["title"] == "Time spent waiting for Check_MK agent"
+ assert data["curves"][3]["title"] == "Total execution time"
+
+
+def _test_get_graph_image(web):
+ result = web.post("graph_image.py", data={
+ "request": json.dumps({
+ "specification": ["template", {
+ "service_description" : "Check_MK",
+ "site" : web.site.id,
+ "graph_index" : 0,
+ "host_name" : "test-host-get-graph",
+ }],
+ }),
+ })
+
+ content = result.content
+
+ assert content.startswith('\x89PNG')
+
+ try:
+ im = Image.open(StringIO(content))
+ except IOError:
+ raise Exception("Failed to open image: %r" % content)
+
+
+def _test_get_graph_notification_image(web):
+ result = web.get("ajax_graph_images.py?host=test-host-get-graph&service=Check_MK")
+
+ # Provides a json list containing base64 encoded PNG images of the current 24h graphs
+ encoded_graph_list = json.loads(result.text)
+ assert type(encoded_graph_list) == list
+ assert len(encoded_graph_list) > 0
+
+ for encoded_graph_image in encoded_graph_list:
+ graph_image = base64.b64decode(encoded_graph_image)
+
+ assert graph_image.startswith('\x89PNG')
+
+ try:
+ im = Image.open(StringIO(graph_image))
+ except IOError:
+ raise Exception("Failed to open image: %r" % graph_image)
Module: check_mk
Branch: master
Commit: c9abe5f058be2af20024a4fceaa2c2fc4772d686
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c9abe5f058be2a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 22 10:44:05 2017 +0200
4732 FIX systemd: Don't kill child processes of the agent
When running the Check_MK agent via systemd the asynchronous executed
agent plugins and real time checks were not working correctly since the
systemd was terminating all child processes after the agent finished.
The systemd configuration has now been changed to let the child processes
be alive after the agent exited.
Change-Id: Ieb4a3fda3b147f014d34033df15c3cd5c475b3d4
---
.werks/4732 | 16 ++++++++++++++++
agents/cfg_examples/systemd/check_mk@.service | 1 +
2 files changed, 17 insertions(+)
diff --git a/.werks/4732 b/.werks/4732
new file mode 100644
index 0000000..46e8cd7
--- /dev/null
+++ b/.werks/4732
@@ -0,0 +1,16 @@
+Title: systemd: Don't kill child processes of the agent
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1495442408
+
+When running the Check_MK agent via systemd the asynchronous executed
+agent plugins and real time checks were not working correctly since the
+systemd was terminating all child processes after the agent finished.
+
+The systemd configuration has now been changed to let the child processes
+be alive after the agent exited.
diff --git a/agents/cfg_examples/systemd/check_mk@.service b/agents/cfg_examples/systemd/check_mk@.service
index 43c5bb8..a721813 100644
--- a/agents/cfg_examples/systemd/check_mk@.service
+++ b/agents/cfg_examples/systemd/check_mk@.service
@@ -4,6 +4,7 @@ Description=Check_MK
[Service]
ExecStart=/usr/bin/check_mk_agent
+KillMode=process
User=root
Group=root
Module: check_mk
Branch: master
Commit: 99d50348c95ba5e2ff4ccdaad0655d180358e762
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=99d50348c95ba5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 22 10:33:27 2017 +0200
4731 FIX Fixed exception when receiving SNMPv3 INFORM messages: ignore them now
SNMPv3 INFORM messages sent to the Event Console were already dropped, but resulted
in exceptions written to the mkeventd.log. These exceptions have now been fixed.
Change-Id: Ie9a01fd9131d9579f90fbb827a7c1c76924a4ded
---
.werks/4731 | 11 +++++++++++
bin/mkeventd | 9 ++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/.werks/4731 b/.werks/4731
new file mode 100644
index 0000000..b86b9d2
--- /dev/null
+++ b/.werks/4731
@@ -0,0 +1,11 @@
+Title: Fixed exception when receiving SNMPv3 INFORM messages: ignore them now
+Level: 1
+Component: ec
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1495441913
+Class: fix
+
+SNMPv3 INFORM messages sent to the Event Console were already dropped, but resulted
+in exceptions written to the mkeventd.log. These exceptions have now been fixed.
diff --git a/bin/mkeventd b/bin/mkeventd
index 3051cea..a11ee13 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -481,9 +481,12 @@ def initialize_snmptrap_engine():
global g_snmp_engine, g_snmp_receiver
g_snmp_engine = snmp_engine.SnmpEngine()
+ # Disable receiving of SNMPv3 INFORM messages. We do not support them (yet)
+ class ECNotificationReceiver(snmp_ntfrcv.NotificationReceiver):
+ pduTypes = (snmp_v1.TrapPDU.tagSet, snmp_v2c.SNMPv2TrapPDU.tagSet)
+
initialize_snmp_credentials()
- g_snmp_receiver = snmp_ntfrcv.NotificationReceiver(g_snmp_engine,
- g_event_server.handle_snmptrap)
+ g_snmp_receiver = ECNotificationReceiver(g_snmp_engine, g_event_server.handle_snmptrap)
def initialize_snmp_credentials():
@@ -4780,7 +4783,7 @@ try:
from pysnmp.entity import engine as snmp_engine
from pysnmp.entity import config as snmp_config
from pysnmp.entity.rfc3413 import ntfrcv as snmp_ntfrcv
- from pysnmp.proto.api import v2c as snmp_v2c
+ from pysnmp.proto.api import v2c as snmp_v2c, v1 as snmp_v1
from pysnmp.proto import api as pysnmp_api
from pyasn1.codec.ber import decoder as pyasn_decoder
Module: check_mk
Branch: master
Commit: 8d5136b6e0c420f234b5bf96baae0256254480bd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8d5136b6e0c420…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 19 15:48:05 2017 +0200
4730 Name of backed packages can now be configured (Linux, UNIX)
The name of the packages created by the agent bakery can now be
configured using the ruleset "Name of agent packages". This is
currently only available for Linux and UNIX packages.
Change-Id: Ibe78f02100f8b71e0ba5acd067ed8dbd98f6e04e
---
.werks/4730 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/.werks/4730 b/.werks/4730
new file mode 100644
index 0000000..2f89a70
--- /dev/null
+++ b/.werks/4730
@@ -0,0 +1,12 @@
+Title: Name of backed packages can now be configured (Linux, UNIX)
+Level: 1
+Component: agents
+Compatible: compat
+Edition: cee
+Version: 1.5.0i1
+Date: 1495201612
+Class: feature
+
+The name of the packages created by the agent bakery can now be
+configured using the ruleset "Name of agent packages". This is
+currently only available for Linux and UNIX packages.
Module: check_mk
Branch: master
Commit: 661228b4cb81e32c4f385a79587d47a2c049e1b1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=661228b4cb81e3…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Fri May 19 16:00:08 2017 +0200
Bugreport for Password store
Change-Id: I8e6666f35265c0bc5e98ef1e1050aee02469e2d7
---
.bugs/2511 | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/.bugs/2511 b/.bugs/2511
new file mode 100644
index 0000000..87a5c98
--- /dev/null
+++ b/.bugs/2511
@@ -0,0 +1,9 @@
+Title: PasswordStore uses id as password instead of real password
+Component: wato
+State: open
+Date: 2017-05-19 15:54:27
+Targetversion: 1.4.0
+Class: bug
+
+The password store seems to use the unique id as password instead of the
+stored password. This is reproducible with "Check Email".