Cleanup config.nodes_of
[check_mk.git] / checks / winperf_mem
blob857d858c007d5b27370331bdd3c4bf33e75c5188
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 # Example output from agent:
28 # <<<winperf_mem>>>
29 # 1440580801.44 4 3579545
30 # 24 5203433 counter
31 # 20 643575808 large_rawcount
32 # 22 291414016 large_rawcount
33 # 26 6212497408 large_rawcount
34 # 28 17614 counter
35 # 30 1012830 counter
36 # 32 3988745 counter
37 # 34 456907 counter
38 # 36 2011463 counter -----> Pages Counter
39 # 818 2007095 counter
40 # 38 141612 counter
41 # 44 4368 counter
42 # 52 35241984 large_rawcount
43 # 54 6586368 large_rawcount
44 # 46 273 counter
45 # 56 41033 rawcount
46 # 60 33522 rawcount
47 # 674 3545 rawcount
48 # 814 114274304 large_rawcount
49 # 816 155688960 large_rawcount
50 # 62 35016704 large_rawcount
51 # 64 1003520 large_rawcount
52 # 66 131072 large_rawcount
53 # 68 2777088 large_rawcount
54 # 70 1777664 large_rawcount
55 # 72 77348864 large_rawcount
56 # 1402 71146 raw_fraction
57 # 1402 1516723 raw_base
58 # 1376 628492 large_rawcount
59 # 1378 613 large_rawcount
62 def inventory_winperf_mem(info):
63 if len(info) > 1:
64 return [(None, {})]
67 def check_winperf_mem(_unused, params, info):
68 init_line = info[0]
69 this_time = float(init_line[0])
71 lines = iter(info)
72 try:
73 while True:
74 line = lines.next()
75 if line[0] == "36":
76 page_counter = int(line[1])
77 break
78 except StopIteration:
79 pass
81 pages_per_sec = get_rate(None, this_time, page_counter)
82 state = 0
83 if "pages_per_second" in params:
84 warn, crit = params["pages_per_second"]
85 if pages_per_sec >= crit:
86 state = 2
87 elif pages_per_sec >= warn:
88 state = 1
90 yield state, "Pages/s: %d" % pages_per_sec, [("mem_pages_rate", pages_per_sec)]
93 check_info["winperf_mem"] = {
94 'check_function': check_winperf_mem,
95 'inventory_function': inventory_winperf_mem,
96 'service_description': 'Memory Pages',
97 'group': 'mem_pages',
98 'has_perfdata': True