Module: check_mk
Branch: master
Commit: 46c9ed05caec2ac31ff0d26b946ce5ba118750be
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=46c9ed05caec2a…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Tue Jan 22 08:44:57 2019 +0100
agent_vsphere: counter ids are a global constant now
CMK-1346
Change-Id: Id16dd64bbcd4baa0b05f8199c6aac677daa2f83f
---
agents/special/agent_vsphere | 178 ++++++++++++++++++-------------------------
1 file changed, 73 insertions(+), 105 deletions(-)
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index 27d1318..6087e4c 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -691,6 +691,77 @@ telegram_list = {
</ns1:RetrievePropertiesEx>"""
}
+COUNTER_IDS = (
+ # mem.*
+ # 65635, 65537, 65577, 65625, 65545, 65611, 65573, 65615, 65582,
+ # 65549, 65630, 65622, 65618, 65621, 65561, 65623, 65632, 65557,
+ # 65628, 65633, 65541, 65643, 65586, 65553, 65569, 65589, 65639,
+ # 65620, 65599, 65580, 65619, 65603,
+ # disk.read/write/deviceLatency/numberRead/numberWrite
+ # 131073, disk.usage'
+ 131076, # disk.numberRead
+ 131077, # disk.numberWrite
+ 131078, # disk.read
+ 131079,
+ # 131083, # disk.deviceReadLatency
+ # 131084, # disk.kernelReadLatency
+ # 131085, # disk.totalReadLatency
+ # 131086, # disk.queueReadLatency
+ # 131087, # disk.deviceWriteLatency
+ # 131088, # disk.kernelWriteLatency
+ # 131089, # disk.totalWriteLatency
+ # 131090, # disk.queueWriteLatency
+ 131091, # disk.deviceLatency
+ # 131092, # disk.kernelLatency
+ # 131093, # disk.totalLatency
+ # 131094, # disk.queueLatency
+ # 131095, # disk.maxTotalLatency
+ # 131096, # disk.maxQueueDepth
+ # 131097, # disk.numberReadAveraged
+ # 131098, # disk.numberWriteAveraged
+ 196609, # net.* (ESX > 4.1)
+ 196612,
+ 196613,
+ 196614,
+ 196615,
+ 196616,
+ 196617,
+ 196618,
+ 196619,
+ 196620,
+ 196621,
+ 196622,
+ 196623,
+ 196624,
+ 196625,
+ 196626,
+ 262144, # sys.uptime
+ # 262151,
+ #-262168, sys.resourceMem*
+ 262171, # sys.resourceMemConsumed (seems as this is not available in ESX 5.0
+ # but we saw it on 5.1)
+ # 655360, # datastore.numberReadAveraged
+ # 655361, # datastore.numberWriteAveraged
+ 655362, # datastore.read
+ 655363, # datastore.write
+ # 655364, # datastore.totalReadLatency
+ # 655365, # datastore.totalWriteLatency
+ 655366, # datastore.sizeNormalizedDatastoreLatency
+ # 655367, # datastore.datastoreIops
+ # 655368, # datastore.datastoreReadBytes
+ # 655369, # datastore.datastoreWriteBytes
+ 655370, # datastore.datastoreReadIops
+ 655371, # datastore.datastoreWriteIops
+ # 655372 , # datastore.datastoreNormalReadLatency
+ # 655373 , # datastore.datastoreNormalWriteLatency
+ # 655374 , # datastore.datastoreReadOIO
+ # 655375 , # datastore.datastoreWriteOIO
+ # 655376 , # datastore.datastoreMaxQueueDepth
+ # 655377 , # datastore.datastoreReadLoadMetric
+ # 655378 , # datastore.datastoreWriteLoadMetric
+ # 655379 , # datastore.maxTotalLatency
+)
+
def put_in_envelope(payload):
return '<SOAP-ENV:Envelope
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" '\
@@ -706,108 +777,6 @@ def convert_hostname(h):
return h.replace(" ", "_")
-def get_counters(esx_version_num):
- # FIXME: (CMK-1346) The argument 'esx_version_num' is is a string now
- # => the comparison below is broken, as
- # >>> "6.7" > 7.1
- # True
- # Not a Problem though -- invalid IDs seem to be ignored.
- # So make this a simple global constant.
- needed_ids = [
- # disk.read/write/deviceLatency/numberRead/numberWrite
- # 'disk.usage': 131073,
- # 'disk.numberRead': 131076,
- 131076,
- # 'disk.numberWrite': 131077,
- 131077,
- # 'disk.read': 131078,
- 131078,
- 131079,
- # 'disk.deviceReadLatency': 131083,
- # 'disk.kernelReadLatency': 131084,
- # 'disk.totalReadLatency': 131085,
- # 'disk.queueReadLatency': 131086,
- # 'disk.deviceWriteLatency': 131087,
- # 'disk.kernelWriteLatency': 131088,
- # 'disk.totalWriteLatency': 131089,
- # 'disk.queueWriteLatency': 131090,
- # 'disk.deviceLatency': 131091,
- 131091,
- # 'disk.kernelLatency': 131092,
- # 'disk.totalLatency': 131093,
- # 'disk.queueLatency': 131094,
- # 'disk.maxTotalLatency': 131095,
- # 'disk.maxQueueDepth': 131096,
- # 'disk.numberReadAveraged': 131097,
- # 'disk.numberWriteAveraged': 131098,
- # sys.uptime
- 262144,
- # sys.resourceMem*
- # 262151, 262155, 262169, 262152, 262154, 262153, 262157, 262156, 262168,
- # mem.*
- # 65635, 65537, 65577, 65625, 65545, 65611, 65573, 65615, 65582,
- # 65549, 65630, 65622, 65618, 65621, 65561, 65623, 65632, 65557,
- # 65628, 65633, 65541, 65643, 65586, 65553, 65569, 65589, 65639,
- # 65620, 65599, 65580, 65619, 65603,
- # datastore counters
- # 'datastore.numberReadAveraged': 655360,
- # 'datastore.numberWriteAveraged': 655361,
- # 'datastore.read': 655362,
- 655362,
- # 'datastore.write': 655363,
- 655363,
- # 'datastore.totalReadLatency': 655364,
- # 'datastore.totalWriteLatency': 655365,
- # 'datastore.sizeNormalizedDatastoreLatency': 655366,
- 655366,
- # 'datastore.datastoreIops': 655367,
- # 'datastore.datastoreReadBytes': 655368,
- # 'datastore.datastoreWriteBytes': 655369,
- # 'datastore.datastoreReadIops': 655370,
- 655370,
- # 'datastore.datastoreWriteIops': 655371,
- 655371,
- # 'datastore.datastoreNormalReadLatency': 655372,
- # 'datastore.datastoreNormalWriteLatency': 655373,
- # 'datastore.datastoreReadOIO': 655374,
- # 'datastore.datastoreWriteOIO': 655375,
- # 'datastore.datastoreMaxQueueDepth': 655376,
- # 'datastore.datastoreReadLoadMetric': 655377,
- # 'datastore.datastoreWriteLoadMetric': 655378,
- # 'datastore.maxTotalLatency': 655379,
- ]
-
- # Seems as this is not available in ESX 5.0 but we saw it on 5.1
- if esx_version_num > 5.0:
- # sys.resourceMemConsumed
- needed_ids += [
- 262171,
- ]
-
- if esx_version_num > 4.1:
- needed_ids += [
- # net.*
- 196616,
- 196621,
- 196617,
- 196625,
- 196619,
- 196623,
- 196609,
- 196614,
- 196620,
- 196624,
- 196615,
- 196622,
- 196618,
- 196612,
- 196613,
- 196626,
- ]
-
- return needed_ids
-
-
def usage():
sys.stderr.write("""Check_MK vSphere Agent
@@ -1397,9 +1366,8 @@ if not error:
# Get counter syntax
counter_syntax_payload = telegram_list["perfcountersyntax"]
- needed_ids = get_counters(systeminfo["apiVersion"])
counter_data = []
- for entry in needed_ids:
+ for entry in COUNTER_IDS:
counter_data.append("<ns1:counterId>%s</ns1:counterId>" % entry)
reply_code, reply_msg, reply_headers, counters_syntax_response = \
@@ -1442,7 +1410,7 @@ if not error:
counters_avail.setdefault(counter, []).append(instance)
counter_data = []
- for entry in needed_ids:
+ for entry in COUNTER_IDS:
for instance in counters_avail.get(entry, []):
counter_data.append(
"<ns1:metricId><ns1:counterId>%d</ns1:counterId><ns1:instance>%s</ns1:instance></ns1:metricId>"