2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2013 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 # <<<hyperv_checkpoints>>>
29 # f5689086-243b-4dfe-9775-571ef6be8a1b 2063
30 # c85ae17b-1a6c-4a34-949a-a1b9385ef67a 2040
33 def inventory_hyperv_checkpoints(info
):
37 def check_hyperv_checkpoints(item
, params
, info
):
42 snapshots
.append((line
[0], int(line
[1])))
45 yield 0, "%s checkpoints" % len(snapshots
)
47 # We assume that the last snapshot is the last line
49 for title
, key
, snapshot
in [
50 ("Oldest", "age_oldest", max(snapshots
, key
=lambda x
: x
[1])),
51 ("Last", "age", snapshots
[-1]),
54 infotext
= "%s: %s (%s)" % (title
, get_age_human_readable(age
), name
)
55 warn
, crit
= params
.get(key
, (None, None))
56 if crit
is not None and age
>= crit
:
58 elif warn
is not None and age
>= warn
:
63 infotext
+= " (warn/crit at %s/%s)" % (get_age_human_readable(warn
),
64 get_age_human_readable(crit
))
65 yield state
, infotext
, [(key
, age
, warn
, crit
)]
67 yield 0, "No Checkpoints found"
70 check_info
["hyperv_checkpoints"] = {
71 "check_function": check_hyperv_checkpoints
,
72 "inventory_function": inventory_hyperv_checkpoints
,
73 "service_description": "HyperV Checkpoints",
74 "group": "vm_snapshots",