Module: check_mk
Branch: master
Commit: 9934dbcadcf6616f1240e5b6eca82464ae4e9992
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9934dbcadcf661…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Apr 10 15:47:26 2014 +0200
FIX windows agent: no longer reports negative SWAP values
SWAP values are calculated with the help of the pagefiles size.
The function to determine the systems maximum/available pagefile size was incorrect.
Additionally: Re-added 64 bit agent and agent-installer
---
.werks/830 | 9 +++++++++
ChangeLog | 1 +
agents/windows/Makefile | 6 +++---
agents/windows/check_mk_agent-64.exe | Bin 0 -> 205312 bytes
agents/windows/check_mk_agent.cc | 9 +++++++--
agents/windows/check_mk_agent.exe | Bin 175104 -> 180224 bytes
agents/windows/crash.exe | Bin 20024 -> 94971 bytes
agents/windows/install_agent-64.exe | Bin 0 -> 158266 bytes
agents/windows/install_agent.exe | Bin 151408 -> 149511 bytes
agents/windows/nowin.exe | Bin 22511 -> 102109 bytes
10 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/.werks/830 b/.werks/830
new file mode 100644
index 0000000..a250471
--- /dev/null
+++ b/.werks/830
@@ -0,0 +1,9 @@
+Title: windows agent: no longer reports negative SWAP values
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1397137476
+Class: fix
+
+SWAP values are calculated with the help of the pagefiles size.
+The function to determine the systems maximum/available pagefile size was incorrect.
diff --git a/ChangeLog b/ChangeLog
index b9b0279..fa1b298 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,7 @@
* 0605 FIX: enterasys_cpu_util enterasys_lsnat: syntax fixes
* 0889 FIX: logwatch: fix case where rule wouldn't be applied...
* 0882 FIX: check_bi_local.py: fix crash in case of non-ascii characters...
+ * 0830 FIX: windows agent: no longer reports negative SWAP values...
Multisite:
* 0779 Hostgroups (Summary): Empty hostgroups are no longer shown (can be re-enabled
by filter)
diff --git a/agents/windows/Makefile b/agents/windows/Makefile
index a88ec5a..0e55071 100755
--- a/agents/windows/Makefile
+++ b/agents/windows/Makefile
@@ -27,7 +27,7 @@ VERSION = 1.2.5i3
WINDRES = i586-mingw32msvc-windres
ifeq ($(shell uname),Linux)
- CXX = echo -e "\n\nWARNING: MinGW under Linux is broken! Use at your own
risk!\n\n" ; i586-mingw32msvc-g++
+ CXX = echo -e "\n\nWARNING: MinGW under Linux is broken! Use at your own
risk!\n\n" ; i686-w64-mingw32-g++
CXX_64 = x86_64-w64-mingw32-g++
WINDRES_64 = x86_64-w64-mingw32-windres
else
@@ -56,10 +56,10 @@ install_agent-64.exe: check_mk_agent-64.exe crash.exe nowin.exe
chmod +x install_agent-64.exe
check_mk_agent.exe: check_mk_agent.cc Makefile check_mk_agent.res
- $(CXX) -s -O2 -Wall -Werror -o $@ $< -static -lwsock32 check_mk_agent.res
+ $(CXX) -s -O2 -Wall -Werror -o $@ $< -static -lpsapi -lwsock32 check_mk_agent.res
check_mk_agent-64.exe: check_mk_agent.cc Makefile check_mk_agent-64.res
- $(CXX_64) -s -O2 -Wall -Werror -o $@ $< -static -lwsock32 check_mk_agent-64.res
+ $(CXX_64) -s -O2 -Wall -Werror -o $@ $< -static -lpsapi -lwsock32
check_mk_agent-64.res
check_mk_agent.res: check_mk_agent.rc
$(WINDRES) $< -O coff -o $@
diff --git a/agents/windows/check_mk_agent-64.exe b/agents/windows/check_mk_agent-64.exe
new file mode 100755
index 0000000..6eba2e0
Binary files /dev/null and b/agents/windows/check_mk_agent-64.exe differ
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index 204b993..4d8260d 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -51,6 +51,7 @@
#include <winsock2.h>
#include <windows.h>
#include <winbase.h>
+#include <psapi.h>
#include <winreg.h> // performance counters from registry
#include <tlhelp32.h> // list of processes
#include <stdarg.h>
@@ -2246,10 +2247,14 @@ void section_mem(SOCKET &out)
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);
+ PERFORMANCE_INFORMATION pi;
+ pi.cb = sizeof(pi);
+ GetPerformanceInfo(&pi, sizeof(pi));
+
output(out, "MemTotal: %11d kB\n", statex.ullTotalPhys / 1024);
output(out, "MemFree: %11d kB\n", statex.ullAvailPhys / 1024);
- output(out, "SwapTotal: %11d kB\n", (statex.ullTotalPageFile -
statex.ullTotalPhys) / 1024);
- output(out, "SwapFree: %11d kB\n", (statex.ullAvailPageFile -
statex.ullAvailPhys) / 1024);
+ output(out, "SwapTotal: %11d kB\n", ((pi.CommitLimit * pi.PageSize) -
statex.ullTotalPhys) / 1024);
+ output(out, "SwapFree: %11d kB\n", (((pi.CommitLimit - pi.CommitTotal)
* pi.PageSize)- statex.ullAvailPhys) / 1024);
output(out, "PageTotal: %11d kB\n", statex.ullTotalPageFile / 1024);
output(out, "PageFree: %11d kB\n", statex.ullAvailPageFile / 1024);
output(out, "VirtualTotal: %11d kB\n", statex.ullTotalVirtual / 1024);
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index b5cc3f8..714e2ce 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/crash.exe b/agents/windows/crash.exe
index 952e63a..38d3f0a 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
new file mode 100755
index 0000000..c9b6d19
Binary files /dev/null and b/agents/windows/install_agent-64.exe differ
diff --git a/agents/windows/install_agent.exe b/agents/windows/install_agent.exe
index 6dda9ec..ed4953c 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 492340b..26a3d55 100755
Binary files a/agents/windows/nowin.exe and b/agents/windows/nowin.exe differ