Module: check_mk
Branch: master
Commit: 43ebe3108210f7d9f2c124eae94ee39206dcce81
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43ebe3108210f7…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Apr 14 15:48:01 2011 +0200
Windows agent: use relative counter ids
---
agents/windows/check_mk.ini | 3 ++-
agents/windows/check_mk_agent.cc | 17 +++++++----------
agents/windows/check_mk_agent.exe | Bin 96768 -> 96768 bytes
checkman/winperf_msx_queues | 2 ++
checks/winperf_msx_queues | 10 +++++-----
checks/winperf_phydisk | 4 ++--
checks/winperf_processor | 7 +++++--
7 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/agents/windows/check_mk.ini b/agents/windows/check_mk.ini
index e17edab..4ea6924 100644
--- a/agents/windows/check_mk.ini
+++ b/agents/windows/check_mk.ini
@@ -5,4 +5,5 @@
[winperf]
# Select counters to extract. The following counters
# are needed by checks shipped with check_mk.
- counters = 238:processor 234:phydisk 11838:msx_owa 12042:msx_async 10332:msx_queues
+ # 11838:msx_owa 12042:msx_async 10332:msx_queues
+ counters = 238:processor 234:phydisk
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index 507613a..a635168 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -387,14 +387,14 @@ PERF_INSTANCE_DEFINITION *NextInstance (PERF_INSTANCE_DEFINITION
*pInstance) {
}
-void dump_performance_counters(SOCKET &out, unsigned counter, const char
*countername)
+void dump_performance_counters(SOCKET &out, unsigned counter_base_number, const char
*countername)
{
output(out, "<<<winperf_%s>>>\n", countername);
- output(out, "%.2f\n", current_time());
+ output(out, "%.2f %u\n", current_time(), counter_base_number);
// registry entry is ascii representation of counter index
char counter_index_name[8];
- snprintf(counter_index_name, sizeof(counter_index_name), "%u", counter);
+ snprintf(counter_index_name, sizeof(counter_index_name), "%u",
counter_base_number);
// allocate block to store counter data block
DWORD size = DEFAULT_BUFFER_SIZE;
@@ -436,7 +436,7 @@ void dump_performance_counters(SOCKET &out, unsigned counter,
const char *counte
for (unsigned int a=0 ; a < dataBlockPtr->NumObjectTypes ; a++)
{
// Have we found the object we seek?
- if (objectPtr->ObjectNameTitleIndex == counter)
+ if (objectPtr->ObjectNameTitleIndex == counter_base_number)
{
// Yes. Great. Now: each object consist of a lot of counters.
// We walk through the list of counters in this object:
@@ -477,7 +477,7 @@ void dump_performance_counters(SOCKET &out, unsigned counter,
const char *counte
// Now walk through the counter list a second time and output all counters
for (unsigned int b=0 ; b < objectPtr->NumCounters ; b++)
{
- outputCounter(out, datablock, counter, objectPtr, counterPtr);
+ outputCounter(out, datablock, counter_base_number, objectPtr, counterPtr);
counterPtr = NextCounter(counterPtr);
}
}
@@ -488,7 +488,7 @@ void dump_performance_counters(SOCKET &out, unsigned counter,
const char *counte
}
-void outputCounter(SOCKET &out, BYTE *datablock, int counter,
+void outputCounter(SOCKET &out, BYTE *datablock, int counter_base_number,
PERF_OBJECT_TYPE *objectPtr, PERF_COUNTER_DEFINITION *counterPtr)
{
@@ -525,7 +525,7 @@ void outputCounter(SOCKET &out, BYTE *datablock, int counter,
}
// Output index of counter object and counter, and timestamp
- output(out, "%d", counterPtr->CounterNameTitleIndex);
+ output(out, "%d", counterPtr->CounterNameTitleIndex -
counter_base_number);
// If this is a multi-instance-counter, loop over the instances
int num_instances = objectPtr->NumInstances;
@@ -921,9 +921,6 @@ void section_winperf(SOCKET &out)
if (g_num_winperf_counters == 0) {
dump_performance_counters(out, 234, "phydisk");
dump_performance_counters(out, 238, "processor");
- dump_performance_counters(out, 11838, "msx_owa");
- dump_performance_counters(out, 12042, "msx_async");
- dump_performance_counters(out, 10332, "msx_queues");
}
// output configured counters
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index e32d339..ec7c0f7 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/checkman/winperf_msx_queues b/checkman/winperf_msx_queues
index 37ec28b..58a0413 100644
--- a/checkman/winperf_msx_queues
+++ b/checkman/winperf_msx_queues
@@ -12,6 +12,8 @@ description:
If the counter number is different in your installation or
you are using a {check_mk.ini} with custom counter definitions,
add the counter to the section {[winperf]} with {counters = 10332:msx_queues} ... .
+ Look in the output of {lodctr /s:counters.ini} for the object with
+ the name {MSExchangeTransport Queues}.
You can set levels for warning and critical. Per default
the queues {Active Remote Delivery}, {Active Mailbox Delivery},
diff --git a/checks/winperf_msx_queues b/checks/winperf_msx_queues
index d20ed9e..1fda3e7 100644
--- a/checks/winperf_msx_queues
+++ b/checks/winperf_msx_queues
@@ -48,12 +48,12 @@
# Default warn/crit levels for length of queues
msx_queues_default_levels = (500, 2000)
-# Queues to be inventorized
+# Queues to be inventorized (number are relative to counter base)
winperf_msx_queues = {
- "Active Remote Delivery" : "10334",
- "Retry Remote Delivery" : "10336",
- "Active Mailbox Delivery" : "10338",
- "Poison Queue Length" : "10376",
+ "Active Remote Delivery" : "2",
+ "Retry Remote Delivery" : "4",
+ "Active Mailbox Delivery" : "6",
+ "Poison Queue Length" : "44",
}
def inventory_winperf_msx_queues(checktype, info):
diff --git a/checks/winperf_phydisk b/checks/winperf_phydisk
index f871eb1..2a4de3e 100644
--- a/checks/winperf_phydisk
+++ b/checks/winperf_phydisk
@@ -56,9 +56,9 @@ check_includes['winperf_phydisk'] = [
"diskstat.include" ]
def winperf_phydisk_convert(info):
disks = [ d.split('_')[-1] for d in info[1][2:-1] ]
for line in info[2:]:
- if line[0] == '220':
+ if line[0] == '-14':
disk_reads = [ int(x) / 512 for x in line[1:-2] ]
- elif line[0] == '222':
+ elif line[0] == '-12':
disk_writes = [ int(x) / 512 for x in line[1:-2] ]
return zip(disks, disk_reads, disk_writes)
diff --git a/checks/winperf_processor b/checks/winperf_processor
index ee0bf61..50d5630 100644
--- a/checks/winperf_processor
+++ b/checks/winperf_processor
@@ -28,9 +28,12 @@
winperf_cpu_default_levels = ( 101, 101 )
def inventory_winperf_util(checkname, info):
+ if len(info) <= 1:
+ return None
+
for line in info[1:]:
try:
- if line[0] == '6':
+ if line[0] == '-232':
return [(None, "winperf_cpu_default_levels")]
except:
pass
@@ -41,7 +44,7 @@ def check_winperf_util(item, params, info):
this_time = int(float(info[0][0]))
for line in info[1:]:
- if line[0] == '6':
+ if line[0] == '-232':
# Windows sends one counter for each CPU plus one counter that
# sums up to total (called _Total). We only need that last value.
ticks = int(line[-2])