Module: check_mk
Branch: master
Commit: e13bc78760ad070d967303a92ded8efb609e304d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e13bc78760ad07…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Aug 28 13:22:09 2014 +0200
#1103 windows agent: now able to omit context text of logfiles
---
.werks/1103 | 9 ++++++
ChangeLog | 3 +-
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 208896 -> 208896 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 208896 -> 208896 bytes
agents/windows/check_mk_agent.cc | 33 +++++++++++++++-------
agents/windows/check_mk_agent.exe | Bin 177664 -> 177664 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 177664 -> 177664 bytes
agents/windows/crash.exe | Bin 20024 -> 20024 bytes
agents/windows/install_agent-64.exe | Bin 159952 -> 160048 bytes
agents/windows/install_agent.exe | Bin 156803 -> 156931 bytes
agents/windows/nowin.exe | Bin 22511 -> 22511 bytes
12 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/.werks/1103 b/.werks/1103
new file mode 100644
index 0000000..b1a1e7b
--- /dev/null
+++ b/.werks/1103
@@ -0,0 +1,9 @@
+Title: windows agent: now able to omit context text of logfiles
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1409224883
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 86d761b..e587903 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,7 @@
* 1376 dmraid: moved plugin code into normal Linux agent...
* 1377 Renamed agent plugin resolve_hostname into dnsclient, make portable to all
Unices...
* 1146 nfsmounts: supported by AIX agent now...
+ * 1103 windows agent: now able to omit context text of logfiles
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
@@ -62,7 +63,7 @@
* 1099 FIX: tsm_scratch: now returns the variable name instead the values during
inventory...
* 0650 FIX: f5_bigip_pool: limits to the number of active nodes are now correctly
applied...
NOTE: Please refer to the migration notes!
- * 1102 FIX: esx_vsphere_counters: now raise a MKCounterWrapped exception if counter
data is missing...
+ * 1102 FIX: esx_vsphere_counters: no longer raise false alarms because of invalid
data from ESX Host...
Multisite:
* 1066 Implemented Dashboard Designer...
diff --git a/agents/windows/build_version b/agents/windows/build_version
index dd47563..d88e313 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-76
+81
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 5b050b7..21d038a 100755
Binary files a/agents/windows/check_mk_agent-64.exe and
b/agents/windows/check_mk_agent-64.exe differ
diff --git a/agents/windows/check_mk_agent-64.unversioned.exe
b/agents/windows/check_mk_agent-64.unversioned.exe
index 5e9778e..4dd0178 100755
Binary files a/agents/windows/check_mk_agent-64.unversioned.exe and
b/agents/windows/check_mk_agent-64.unversioned.exe differ
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index b3ff311..2bbfe69 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -1710,6 +1710,7 @@ typedef vector<condition_pattern*> condition_patterns_t;
// C:/tmp/Testfile*.log
struct glob_token {
char *pattern;
+ bool nocontext;
bool found_match;
};
typedef vector<glob_token*> glob_tokens_t;
@@ -1736,6 +1737,7 @@ struct logwatch_textfile {
unsigned long long file_size; // size of the file
unsigned long long offset; // current fseek offset in the file
bool missing; // file no longer exists
+ bool nocontext; // do not report ignored lines
file_encoding encoding;
condition_patterns_t *patterns; // glob patterns applying for this file
};
@@ -1873,7 +1875,7 @@ logwatch_textfile* get_logwatch_textfile(const char *filename)
// Add a new textfile and to the global textfile list
// and determine some initial values
-bool add_new_logwatch_textfile(const char *full_filename, condition_patterns_t
*patterns)
+bool add_new_logwatch_textfile(const char *full_filename, glob_token* token,
condition_patterns_t *patterns)
{
logwatch_textfile *new_textfile = new logwatch_textfile();
@@ -1889,9 +1891,10 @@ bool add_new_logwatch_textfile(const char *full_filename,
condition_patterns_t *
GetFileInformationByHandle(hFile, &fileinfo);
CloseHandle(hFile);
- new_textfile->path = strdup(full_filename);
- new_textfile->missing = false;
- new_textfile->patterns = patterns;
+ new_textfile->path = strdup(full_filename);
+ new_textfile->missing = false;
+ new_textfile->patterns = patterns;
+ new_textfile->nocontext = token->nocontext;
// Hier aus den gespeicherten Hints was holen....
bool found_hint = false;
@@ -1922,7 +1925,7 @@ bool add_new_logwatch_textfile(const char *full_filename,
condition_patterns_t *
// Check if the given full_filename already exists. If so, do some basic file integrity
checks
// Otherwise create a new textfile instance
-void update_or_create_logwatch_textfile(const char *full_filename, condition_patterns_t
*patterns)
+void update_or_create_logwatch_textfile(const char *full_filename, glob_token* token,
condition_patterns_t *patterns)
{
logwatch_textfile *textfile;
if ((textfile = get_logwatch_textfile(full_filename)) != NULL)
@@ -1966,7 +1969,7 @@ void update_or_create_logwatch_textfile(const char *full_filename,
condition_pat
}
}
else
- add_new_logwatch_textfile(full_filename, patterns); // Add new file
+ add_new_logwatch_textfile(full_filename, token, patterns); // Add new file
}
// Process a single expression (token) of a globline and try to find matching files
@@ -1985,11 +1988,11 @@ void process_glob_expression(glob_token *glob_token,
condition_patterns_t *patte
basename = glob_token->pattern;
}
snprintf(full_filename,sizeof(full_filename), "%s\\%s", basename,
data.cFileName);
- update_or_create_logwatch_textfile(full_filename, patterns);
+ update_or_create_logwatch_textfile(full_filename, glob_token, patterns);
while (FindNextFile(h, &data)){
snprintf(full_filename,sizeof(full_filename), "%s\\%s", basename,
data.cFileName);
- update_or_create_logwatch_textfile(full_filename, patterns);
+ update_or_create_logwatch_textfile(full_filename, glob_token, patterns);
}
if (end)
@@ -1999,7 +2002,7 @@ void process_glob_expression(glob_token *glob_token,
condition_patterns_t *patte
}
// Add a new globline from the config file:
-// C:/Testfile D:/var/log/data.log D:/tmp/art*.log
+// C:/Testfile | D:/var/log/data.log D:/tmp/art*.log
// This globline is split into tokens which are processed by process_glob_expression
void add_globline(char *value)
{
@@ -2020,6 +2023,16 @@ void add_globline(char *value)
while (token) {
token = lstrip(token);
glob_token *new_token = new glob_token();
+
+ if (!strncmp(token, "nocontext", 9))
+ {
+ new_token->nocontext = true;
+ token += 9;
+ token = lstrip(token);
+ }
+ else
+ new_token->nocontext = false;
+
new_token->pattern = strdup(token);
new_globline->tokens->push_back(new_token);
process_glob_expression(new_token, new_globline->patterns);
@@ -2221,7 +2234,7 @@ bool process_textfile(FILE *file, logwatch_textfile* textfile,
SOCKET &out, bool
}
}
- if (write_output && strlen(line) > 0)
+ if (write_output && strlen(line) > 0 &&
!(textfile->nocontext && (state == 'I' || state == '.')))
output(out, "%c %s\n", state, line);
}
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 4ac96e9..60e02f3 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/check_mk_agent.unversioned.exe
b/agents/windows/check_mk_agent.unversioned.exe
index f2dd030..bb8b51a 100755
Binary files a/agents/windows/check_mk_agent.unversioned.exe and
b/agents/windows/check_mk_agent.unversioned.exe differ
diff --git a/agents/windows/crash.exe b/agents/windows/crash.exe
index 2581c99..812ff07 100755
Binary files a/agents/windows/crash.exe and b/agents/windows/crash.exe differ
diff --git a/agents/windows/install_agent-64.exe b/agents/windows/install_agent-64.exe
index 1e95b33..e564cd0 100755
Binary files a/agents/windows/install_agent-64.exe and
b/agents/windows/install_agent-64.exe differ
diff --git a/agents/windows/install_agent.exe b/agents/windows/install_agent.exe
index 778fd5a..e97de73 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ
diff --git a/agents/windows/nowin.exe b/agents/windows/nowin.exe
index bc04e04..86c3c0c 100755
Binary files a/agents/windows/nowin.exe and b/agents/windows/nowin.exe differ