Module: check_mk
Branch: master
Commit: e6ee441da3433833970a290e69699a5d2d4d59e6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e6ee441da34338…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Fri May 13 14:09:53 2016 +0200
3134 FIX windows agent: fixed bug where the last message of an eventlog was always
re-read
---
.werks/3134 | 10 ++++++++++
ChangeLog | 2 ++
agents/windows/EventLog.cc | 10 ++++++++++
agents/windows/build_version | 2 +-
agents/windows/check_mk_agent-64.exe | Bin 1250304 -> 1250304 bytes
agents/windows/check_mk_agent-64.unversioned.exe | Bin 1250304 -> 1250304 bytes
agents/windows/check_mk_agent.cc | 5 +++--
agents/windows/check_mk_agent.exe | Bin 1222656 -> 1223168 bytes
agents/windows/check_mk_agent.msi | Bin 2740224 -> 2741760 bytes
agents/windows/check_mk_agent.unversioned.exe | Bin 1222656 -> 1223168 bytes
agents/windows/install_agent-64.exe | Bin 554242 -> 554590 bytes
agents/windows/install_agent.exe | Bin 550946 -> 551424 bytes
12 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/.werks/3134 b/.werks/3134
new file mode 100644
index 0000000..deb9f26
--- /dev/null
+++ b/.werks/3134
@@ -0,0 +1,10 @@
+Title: windows agent: fixed bug where the last message of an eventlog was always re-read
+Level: 2
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1463141164
+
+
diff --git a/ChangeLog b/ChangeLog
index 6c99ea3..fcdc6c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -214,8 +214,10 @@
* 3529 FIX: agent_netapp: fixed problem with older netapp versions (7Mode - Version
8.0)...
* 3573 FIX: ps: Fixed possible wrong matching of ps and ucb ps commands
* 3131 FIX: if64, if64adm: These checks now display the speed of interfaces slower
than 1Mbit correctly...
+ NOTE: Please refer to the migration notes!
* 3470 FIX: mounts: Fix exception when displaying check parameters in WATO services
list...
* 3530 FIX: agent_vsphere: improved performance, too much perfcounters were queried
+ * 3134 FIX: windows agent: fixed bug where the last message of an eventlog was always
re-read
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/windows/EventLog.cc b/agents/windows/EventLog.cc
index 7aca1e9..fe3f3cc 100644
--- a/agents/windows/EventLog.cc
+++ b/agents/windows/EventLog.cc
@@ -334,6 +334,16 @@ void EventLog::close() { CloseEventLog(_log); }
bool EventLog::fillBuffer() {
_buffer_offset = 0;
+ // test if we're at the end of the log, as we don't get
+ // a proper error message when reading beyond the last log record
+ DWORD oldest_record, record_count;
+ if (::GetOldestEventLogRecord(_log, &oldest_record) &&
+ ::GetNumberOfEventLogRecords(_log, &record_count)) {
+ if (_record_offset >= oldest_record + record_count) {
+ return false;
+ }
+ }
+
DWORD flags = EVENTLOG_FORWARDS_READ;
if ((_record_offset != 0) && (_seek_possible)) {
flags |= EVENTLOG_SEEK_READ;
diff --git a/agents/windows/build_version b/agents/windows/build_version
index c7410a5..9b53651 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-1675
+1677
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
index 78f7232..cf32296 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 39b29a0..8d1d7e8 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 4946650..c0bb076 100644
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -680,7 +680,8 @@ void output_eventlog(OutputProxy &out, LPCWSTR logname, uint64_t
&first_record,
out.output("[[[%ls]]]\n", logname);
int worst_state = 0;
- first_record = log->seek(first_record);
+ // record_number is the last event we read, so we want to seek past it
+ first_record = log->seek(first_record + 1);
uint64_t last_record = first_record;
@@ -700,7 +701,7 @@ void output_eventlog(OutputProxy &out, LPCWSTR logname, uint64_t
&first_record,
// second pass - if there were, print everything
if ((worst_state >= level) || !logwatch_suppress_info) {
log->reset();
- log->seek(first_record);
+ log->seek(first_record + 1);
std::shared_ptr<IEventLogRecord> record = log->read();
while (record.get() != nullptr) {
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 86481ac..2998712 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.msi b/agents/windows/check_mk_agent.msi
index 382b65d..3817ff6 100755
Binary files a/agents/windows/check_mk_agent.msi and b/agents/windows/check_mk_agent.msi
differ
diff --git a/agents/windows/check_mk_agent.unversioned.exe
b/agents/windows/check_mk_agent.unversioned.exe
index e20cf5a..895f03d 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/install_agent-64.exe b/agents/windows/install_agent-64.exe
index c13ad98..b2d593a 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 1ac8618..f63a624 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ