Module: check_mk
Branch: master
Commit: 82993b2847d9ade676f6de0b2b0c06b582e07122
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=82993b2847d9ad…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 25 13:32:47 2014 +0200
FIX Fix HTTP error handling in bulk inventory
If during a bulk inventory some HTTP error occurs (e.g. due to an Apache
restart) then now the failed hosts are exactly being displayed and the
number of failed hosts is correct.
---
.werks/990 | 11 +++++++++++
ChangeLog | 3 +++
web/htdocs/js/wato.js | 45 +++++++++++++++++++++++++++++++--------------
3 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/.werks/990 b/.werks/990
new file mode 100644
index 0000000..2be2da7
--- /dev/null
+++ b/.werks/990
@@ -0,0 +1,11 @@
+Title: Fix HTTP error handling in bulk inventory
+Level: 1
+Component: wato
+Class: fix
+State: unknown
+Version: 1.2.5i5
+Date: 1403695916
+
+If during a bulk inventory some HTTP error occurs (e.g. due to an Apache
+restart) then now the failed hosts are exactly being displayed and the
+number of failed hosts is correct.
diff --git a/ChangeLog b/ChangeLog
index 0aa1bfd..b99d457 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
+ WATO:
+ * 0990 FIX: Fix HTTP error handling in bulk inventory...
+
Livestatus:
* 0988 FIX: livedump: Fix exception in case no contact groups are defined for a service
diff --git a/web/htdocs/js/wato.js b/web/htdocs/js/wato.js
index 30da50b..37528fb 100644
--- a/web/htdocs/js/wato.js
+++ b/web/htdocs/js/wato.js
@@ -29,7 +29,7 @@
function getElementsByClass(cl) {
var items = new Array();
var elements = document.getElementsByTagName('*');
- for(var i = 0; i < elements.length; i++)
+ for (var i = 0; i < elements.length; i++)
if (elements[i].className == cl)
items.push(elements[i]);
return items;
@@ -260,36 +260,53 @@ function progress_handle_error(data, code) {
progress_handle_response(data, '', code);
}
-function progress_handle_response(data, code, http_code) {
+function progress_handle_response(data, code, http_code)
+{
var mode = data[0];
var item = data[1];
var header = null;
var body = null;
- if(http_code !== undefined) {
+ if (http_code !== undefined) {
// If the request failed report the item as failed
+ // Note: the item is either a plain item (single-item-mode), or
+ // a list of items which are separated with ;. Also it is possible
+ // that additional parameters are prefixed to the item separated
+ // by pipes. The bulk inventory uses that format for doing a couple
+ // of hosts at the same time. So here we detect both variants.
+
+ var parts = data[1].split("|");
+ var last_part = parts[parts.length-1];
+ var items = last_part.split(";");
+ var num_failed = items.length;
+
// - Report failed state
// - Update the total count (item 0 = 1)
// - Update the failed stats
- header = [ 'failed', 1 ];
- for(var i = 1; i <= Math.max.apply(Math, progress_fail_stats); i++) {
- if(progress_fail_stats.indexOf(i) !== -1) {
- header.push(1);
- } else {
+ header = [ 'failed', num_failed ];
+ for (var i = 1; i <= Math.max.apply(Math, progress_fail_stats); i++) {
+ if (progress_fail_stats.indexOf(i) !== -1) {
+ header.push(num_failed);
+ }
+ else {
header.push(0);
}
}
- body = 'Inventory of ' + item + ' failed\n'
- +'<div class=exc><h1>HTTP-Request failed</h1>'
- +'HTTP-Code: ' + http_code + '<br />'
- +'Parameters: ' + data + '</div>\n';
- } else {
+
+ body = '';
+ for (var i=0; i < items.length; i++)
+ {
+ body += items[i] + ' failed: HTTP-Request failed with code ' + http_code + '<br>';
+ }
+ }
+ else {
// Regular response processing
try {
var header = eval(code.split("\n", 1)[0]);
if (header === null)
alert('Header is null!');
- } catch(err) {
+ }
+ catch(err) {
alert('Invalid response: ' + code);
}
Module: check_mk
Branch: master
Commit: 7366490c3d58f3d9f2d64f62f60ffc896c01f045
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7366490c3d58f3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 25 09:53:20 2014 +0200
FIX logwatch.ec: Fix forwarding multiple messages via syslog/TCP
If you setup forwarding to the Event Console in the {logwatch.ec} check to
be done via TCP and more than one new message per check interval arrived,
then several messages could have be joined together into one single message.
The reason was a missing newline character. This has been fixed. Forwarding
via UDP was not affected by this bug.
---
.werks/989 | 13 +++++++++++++
ChangeLog | 1 +
checks/logwatch | 2 +-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/.werks/989 b/.werks/989
new file mode 100644
index 0000000..f79bba0
--- /dev/null
+++ b/.werks/989
@@ -0,0 +1,13 @@
+Title: logwatch.ec: Fix forwarding multiple messages via syslog/TCP
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i5
+Date: 1403682696
+
+If you setup forwarding to the Event Console in the {logwatch.ec} check to
+be done via TCP and more than one new message per check interval arrived,
+then several messages could have be joined together into one single message.
+The reason was a missing newline character. This has been fixed. Forwarding
+via UDP was not affected by this bug.
diff --git a/ChangeLog b/ChangeLog
index 5fb7d96..0aa1bfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.2.5i5:
Checks & Agents:
* 0994 FIX: agent plugin smart: fixed syntax error
+ * 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
Livestatus:
* 0988 FIX: livedump: Fix exception in case no contact groups are defined for a service
diff --git a/checks/logwatch b/checks/logwatch
index b238f32..99394e6 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -530,7 +530,7 @@ def check_logwatch_ec(item, params, info):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((method[1], method[2]))
for message in messages:
- sock.send(message)
+ sock.send(message + "\n")
sock.close()
elif not method.startswith('spool:'):
Module: check_mk
Branch: master
Commit: e9a71e9fcbab58bc5c0f1acc8a0713b655a7b0bb
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e9a71e9fcbab58…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 25 09:44:22 2014 +0200
EC forwarding WATO rule: change style to dropdown
the Alternative with radio buttons was confusing to the user
---
web/plugins/wato/check_parameters.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 43960f8..14cf83b 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -4783,6 +4783,7 @@ register_check_parameters(subgroup_applications,
help = _("Instead of using the regular logwatch check all lines received by logwatch can "
"be forwarded to a Check_MK event console daemon to be processed. The target event "
"console can be configured for each host in a separate rule."),
+ style = "dropdown",
elements = [
FixedValue(
"",
Module: check_mk
Branch: master
Commit: 9a7ead7764a0e0ff439cfc937e62351f1916b32a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9a7ead7764a0e0…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jun 24 15:58:43 2014 +0200
Added draft for possible tool cmk-register-host
---
doc/drafts/README.cmk-register-host | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/doc/drafts/README.cmk-register-host b/doc/drafts/README.cmk-register-host
new file mode 100644
index 0000000..c16068f
--- /dev/null
+++ b/doc/drafts/README.cmk-register-host
@@ -0,0 +1,32 @@
+Draft for a command line tool (Linux and Windows) for adding a host to the
+monitoring configuration by calling the tool right on the target machine.
+
+The idea is:
+
+1. Setup a new Linux/Windows box, install the Check_MK Agent on it
+2. Right on that box call a command line tool:
+
+Example 1: Add this host to the Check_MK Server cmkserver.my.net with the OMD
+site mysite.
+
+> cmk-register-host cmkserver.my.net/mysite
+
+Example 2: Specify host tags and a target folder, also activate the changes immediately
+
+> cmk-register-host --tags windows,prod,muc --folder foo/bar --activate cmkserver.my.net/mysite
+
+
+Commandline options:
+ --tags A,B,C Comma separated list of host tags to add to the host (default: inherit from folder)
+ --folder F Put the host into that WATO folder (default: main folder). You have to
+ specify the physical folder path, not the WATO display name
+ --no-inventory do *not* automatically inventorize the host after adding it
+ --activate automatically activate the changes after adding it
+ --user U WATO username to log in with (otherwise: prompted)
+ --password P Password for logging into WATO (otherwise: prompted)
+ --secret S Secret for logging into WATO (for automation users)
+
+ --hostname H Force hostname H (otherwise: read from system hostname)
+ --ipaddress I Force IP address I (otherwise: let Check_MK use DNS lookup)
+ --site S Make Check_MK monitor this by site S (otherwise: inherit from folder)
+