Module: check_mk
Branch: master
Commit: 217f78507f871ddbc8715668dd305cf174bfad80
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=217f78507f871d…
Author: Sven Rueß <sr(a)mathias-kettner.de>
Date: Tue Oct 27 09:37:22 2015 +0100
Resolved bug 2295
---
.bugs/2295 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/.bugs/2295 b/.bugs/2295
index 3f8fd04..6c92991 100644
--- a/.bugs/2295
+++ b/.bugs/2295
@@ -1,9 +1,9 @@
Title: mk_inventory.ps1 workaround für BOM führt bei manchen Kunden zu Problemen
Component: inv
-State: open
+Class: bug
+State: done
Date: 2015-03-17 11:25:20
Targetversion: 1.2.6
-Class: bug
die zweite Zeile in mk_inventory.ps1
verursacht bei uns das Problem:
@@ -41,3 +41,6 @@ verursacht bei uns das Problem:
MK 2015-08-19: Think we can drop the work-around now because the agent
removes the BOM itself. Needs to be done and tested, though.
+
+2015-10-27 09:36:51: changed state open -> done
+It was fixed with werk #2315. Now all should work as expected.
Module: check_mk
Branch: master
Commit: 4ef50e58ec8dc2911430daf9aacd455a64d5e78d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4ef50e58ec8dc2…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Oct 26 16:06:10 2015 +0100
#2705 winperf_if: added option to warn if an interface is using dhcp
if the new plugin mk_dhcp_enabled.bat is installed, the interface will
go into warn state if it received its ip via dhcp.
---
.werks/2705 | 10 +++
ChangeLog | 1 +
agents/windows/plugins/mk_dhcp_enabled.bat | 3 +
checkman/winperf_if | 3 +
checks/winperf_if | 99 ++++++++++++++++++++--------
5 files changed, 90 insertions(+), 26 deletions(-)
diff --git a/.werks/2705 b/.werks/2705
new file mode 100644
index 0000000..b882dfa
--- /dev/null
+++ b/.werks/2705
@@ -0,0 +1,10 @@
+Title: winperf_if: added option to warn if an interface is using dhcp
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1445871802
+Class: feature
+
+if the new plugin mk_dhcp_enabled.bat is installed, the interface will
+go into warn state if it received its ip via dhcp.
diff --git a/ChangeLog b/ChangeLog
index bdb8d92..b3038b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
NOTE: Please refer to the migration notes!
* 2688 mssql agent plugin can now handle clustered MSSQL instances
* 2703 logwatch.ec: now transfers the service level to the event console...
+ * 2705 winperf_if: added option to warn if an interface is using dhcp...
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/agents/windows/plugins/mk_dhcp_enabled.bat b/agents/windows/plugins/mk_dhcp_enabled.bat
new file mode 100644
index 0000000..4b4d2e3
--- /dev/null
+++ b/agents/windows/plugins/mk_dhcp_enabled.bat
@@ -0,0 +1,3 @@
+@echo off
+echo ^<^<^<dhcp:sep^(44^)^>^>^>
+wmic path Win32_NetworkAdapterConfiguration get Description, dhcpenabled /format:csv
diff --git a/checkman/winperf_if b/checkman/winperf_if
index 3e0ed86..f52b5e0 100644
--- a/checkman/winperf_if
+++ b/checkman/winperf_if
@@ -16,6 +16,9 @@ description:
We propose to not installing the plugin in that case and save a few
CPU ressources.
+ The plugin "mk_dhcp_enabled.bat" can be used to get a WARN if the ip
+ address of the interface was assigned by dhcp.
+
The interface index (in SNMP known as {ifIndex}) is simulated by
creating an artificial running index after sorting the names of
the interfaces alphabetically.
diff --git a/checks/winperf_if b/checks/winperf_if
index dfd076d..5777404 100644
--- a/checks/winperf_if
+++ b/checks/winperf_if
@@ -59,14 +59,41 @@
# WINDOWSXP,00:E5:20:52:41:53,Paketplaner-Miniport,,
# WINDOWSXP,08:00:27:35:20:4D,Ethernetadapter der AMD-PCNET-Familie,LAN-Verbindung 2,2
# WINDOWSXP,08:00:27:35:20:4D,Paketplaner-Miniport,,
+#
+# Example output for the optional dhcp section. If this plugin is active, any interface for which
+# dhcp is enabled will warn
+# <<<dhcp:sep(44)>>>
+# Node,Description,DHCPEnabled
+# WINDOWS,Intel(R) PRO/1000 MT-Desktopadapter,TRUE
+# WINDOWS,WAN Miniport (IP),FALSE
+# WINDOWS,Microsoft-ISATAP-Adapter,FALSE
+# WINDOWS,RAS Async Adapter,FALSE
+# WINDOWS,Intel(R) PRO/1000 MT-Desktopadapter #2,TRUE
+
+
+def winperf_if_canonize_nic_name(name):
+ return name.replace("_", " ").replace(" ", " ").rstrip()
+
+def winperf_if_normalize_nic_name(name, nic_names):
+ # Intel[R] PRO 1000 MT-Desktopadapter__3 (perf counter)
+ # Intel(R) PRO/1000 MT-Desktopadapter 3 (wmic name)
+ # Intel(R) PRO/1000 MT-Desktopadapter #3 (wmic InterfaceDescription)
+ mod_nic_name = name
+ for from_token, to_token in [ ("/", " "), ("(", "["), (")", "]"), ("#", " ") ]:
+ for n in nic_names:
+ if from_token in n:
+ # we do not modify it if this character is in any of the counter names
+ break
+ else:
+ mod_nic_name = mod_nic_name.replace(from_token, to_token).replace(" ", " ")
+ return mod_nic_name
-def convert_winperf_if(info):
- def canonize_nic_name(n):
- return n.replace("_", " ").replace(" ", " ").rstrip()
+
+def convert_winperf_if(info, nic_names, nic_index):
lines = iter(info)
lines.next() # skip line with timestamp and counter number
- nic_names = map(canonize_nic_name, lines.next()[2:])
+ lines.next() # skip interface line (already evaluated)
nics = dict([(n, {}) for n in nic_names])
# Scan lines with counters
@@ -117,27 +144,13 @@ def convert_winperf_if(info):
if guid in teaming_info:
guid_to_name = dict(zip(teaming_info[guid]["GUID"].split(";"),
teaming_info[guid]["MemberDescriptions"].split(";")))
- nic_name = canonize_nic_name(guid_to_name[guid])
+ nic_name = winperf_if_canonize_nic_name(guid_to_name[guid])
elif "Name" in as_dict:
- nic_name = canonize_nic_name(as_dict["Name"])
+ nic_name = winperf_if_canonize_nic_name(as_dict["Name"])
else:
- # There seams a bug with some windows configurations
+ # There seems a bug with some windows configurations
continue
- def transform_name(name):
- # Intel[R] PRO 1000 MT-Desktopadapter__3 (perf counter)
- # Intel(R) PRO/1000 MT-Desktopadapter 3 (wmic name)
- # Intel(R) PRO/1000 MT-Desktopadapter #3 (wmic InterfaceDescription)
- mod_nic_name = name
- for from_token, to_token in [ ("/", " "), ("(", "["), (")", "]"), ("#", " ") ]:
- for n in nic_names:
- if from_token in n:
- # we do not modify it if this character is in any of the counter names
- break
- else:
- mod_nic_name = mod_nic_name.replace(from_token, to_token).replace(" ", " ")
- return mod_nic_name
-
found_match = False
# we need to ignore data on interfaces in the optional
@@ -156,7 +169,7 @@ def convert_winperf_if(info):
# Ethernetadapter der AMD-PCNET-Familie 2 - Paketplaner-Miniport, while
# in wmic it's only named "Ethernetadapter der AMD-PCNET-Familie 2".
if not found_match:
- mod_nic_name = transform_name(nic_name)
+ mod_nic_name = winperf_if_normalize_nic_name(nic_name, nic_names)
if mod_nic_name not in nic_names:
for n in nic_names:
@@ -182,8 +195,7 @@ def convert_winperf_if(info):
# Now convert the dicts into the format that is needed by if.include
converted = []
- # Sort NIC names and create artifical index
- nic_index = dict(map(lambda x: (x[1], x[0] + 1), enumerate(nic_names)))
+ # Sort NIC names
nic_names.sort(reverse=True)
for nic_name in nic_names:
@@ -263,11 +275,45 @@ def convert_winperf_if(info):
return converted
+
+def winperf_if_get_nic_index_map(nic_names):
+ return dict(map(lambda x: (x[1], x[0] + 1), enumerate(nic_names)))
+
+
+def check_if_dhcp(item, params, info, nic_names, nic_index):
+ lines = iter(info)
+ header = lines.next()
+
+ for line in lines:
+ as_dict = dict(zip(header, map(lambda x: x.rstrip(), line)))
+ name = winperf_if_normalize_nic_name(as_dict["Description"], nic_names)
+ idx = nic_index.get(name)
+ if idx == int(item):
+ if as_dict["DHCPEnabled"]:
+ return 1, "dhcp enabled"
+ else:
+ return 0, "dhcp %s" % as_dict["DHCPEnabled"]
+ return 0, ""
+
+
def inventory_winperf_if(info):
- return inventory_if_common(convert_winperf_if(info))
+ perf, dhcp = info
+ nic_names = map(winperf_if_canonize_nic_name, perf[1][2:])
+ nic_index = winperf_if_get_nic_index_map(nic_names)
+
+ return inventory_if_common(convert_winperf_if(perf, nic_names, nic_index))
+ # dhcp info irrelevant to inventory
+
def check_winperf_if(item, params, info):
- return check_if_common(item, params, convert_winperf_if(info), group_name = "Teaming")
+ perf, dhcp = info
+ nic_names = map(winperf_if_canonize_nic_name, perf[1][2:])
+ nic_index = winperf_if_get_nic_index_map(nic_names)
+
+ yield check_if_common(item, params, convert_winperf_if(perf, nic_names, nic_index),
+ group_name = "Teaming")
+ if dhcp is not None:
+ yield check_if_dhcp(item, params, dhcp, nic_names, nic_index)
check_info["winperf_if"] = {
@@ -278,4 +324,5 @@ check_info["winperf_if"] = {
'includes': [ 'if.include' ],
'group': 'if',
'default_levels_variable': 'if_default_levels',
+ "extra_sections" : [ 'dhcp' ],
}
Module: check_mk
Branch: master
Commit: 79f594d40bda334a3a272f11287a9faa39fddf54
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=79f594d40bda33…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Oct 26 13:08:07 2015 +0100
Warning police: Added a few TODOs for now.
---
livestatus/src/TableStateHistory.cc | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/livestatus/src/TableStateHistory.cc b/livestatus/src/TableStateHistory.cc
index 1c92df1..b2580d6 100644
--- a/livestatus/src/TableStateHistory.cc
+++ b/livestatus/src/TableStateHistory.cc
@@ -368,6 +368,14 @@ void TableStateHistory::answerQuery(Query *query)
key = 0;
bool is_service = false;
switch (entry->_type) {
+ case NONE:
+ case CORE_STARTING:
+ case CORE_STOPPING:
+ case LOG_VERSION:
+ case ACKNOWLEDGE_ALERT_HOST:
+ case ACKNOWLEDGE_ALERT_SERVICE:
+ // TODO: Check if a no-op is really the right thing to do here.
+ break;
case ALERT_SERVICE:
case STATE_SERVICE:
case STATE_SERVICE_INITIAL:
@@ -375,6 +383,7 @@ void TableStateHistory::answerQuery(Query *query)
case FLAPPING_SERVICE:
key = entry->_service;
is_service = true;
+ // TODO: Do we really want to fall through? If yes, add a comment, otherwise fix it.
case ALERT_HOST:
case STATE_HOST:
case STATE_HOST_INITIAL:
@@ -689,6 +698,15 @@ int TableStateHistory::updateHostServiceState(Query *query, const LogEntry *entr
switch (entry->_type)
{
+ case NONE:
+ case CORE_STARTING:
+ case CORE_STOPPING:
+ case LOG_VERSION:
+ case LOG_INITIAL_STATES:
+ case ACKNOWLEDGE_ALERT_HOST:
+ case ACKNOWLEDGE_ALERT_SERVICE:
+ // TODO: Check if a no-op is really the right thing to do here.
+ break;
case STATE_HOST:
case STATE_HOST_INITIAL:
case ALERT_HOST:
Module: check_mk
Branch: master
Commit: d80b38f02484c139f867ed0b01dcc80896aa357b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d80b38f02484c1…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Oct 26 13:02:17 2015 +0100
added gitbugs
---
.bugs/2363 | 12 ++++++++++++
.bugs/2364 | 18 ++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/.bugs/2363 b/.bugs/2363
new file mode 100644
index 0000000..36ec3bc
--- /dev/null
+++ b/.bugs/2363
@@ -0,0 +1,12 @@
+Title: Improve robustness of agent output parsing
+Component: core
+State: open
+Date: 2015-10-26 11:53:44
+Targetversion: future
+Class: nastiness
+
+Currently, agent output is turned into a table by splitting by line and then splitting by a field separator. This makes it impossible to have the field separator or a linebreak inside a field since no escaping is supported.
+Plugins can circumvent this problem to a degree by choosing a field separator that is unlikely to appear inside fields, or by preprocessing the output.
+The former will, in many cases, not be robust since field values may be user-modifiable. Also, different fields may have different "rare" symbols.
+The latter (processing the output) is something the agent is not supposed to do and may cause information loss. (Worst case scenario: After processing the output, the item identifier of different items may become the same)
+We should provide a way for agents to format data in such a way that it can be parsed to reliably restore the original data, i.e. by apply real csv parsing with support for quoted fields and escaping.
diff --git a/.bugs/2364 b/.bugs/2364
new file mode 100644
index 0000000..fd5c528
--- /dev/null
+++ b/.bugs/2364
@@ -0,0 +1,18 @@
+Title: Provide an easy way for agents and agent plugins to report errors or diagnostic messages
+Component: checks
+State: open
+Date: 2015-10-26 13:00:45
+Targetversion: future
+Class: feature
+
+Agents and agent plugins currently have a hard time reporting problems (or things that may be a problem) in such a way that the user becomes aware of them.
+There are various aspects to consider here:
+* Where to report things. Proposals: inside the agent section, in a separate field of each check
+* reporting things that may not be a problem may confuse the user and prompt support requests for non-issues...
+* ... not reporting them may cause increased effort trying to find real problems
+* traffic shouldn't increase (significantly) if no problems occur
+
+Proposed solution: at any point in the agent output a line formatted as "<<<<< text >>>>>" may be printed to report an error. Those lines do not end a section and are associated with the current section. Inside check_mk those lines are extracted, decorated with the section name and added to the long output of the agent
+section and that section is put into warning state if there is at least one line.
+Diagnostics messages may be written to a local file (similar to the crash log on windows). Error messages are automatically also written to that file.
+If the agent has reported error messages, that error report would reference that diagnostics log for extended information (i.e. "see /var/log/check_mk_agent.log for details").