GUI CSS: Deployed view styles for layouts (CMK-1171)
[check_mk.git] / checks / msoffice_serviceplans
blob263fe1926110ee8da89f2812eb69eaa9d0b6e878
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2018 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:
28 #<<<msoffice_serviceplans>>>
29 #msonline:VISIOCLIENT ONEDRIVE_BASIC Success
30 #msonline:VISIOCLIENT VISIOONLINE Success
31 #msonline:VISIOCLIENT EXCHANGE_S_FOUNDATION Success
32 #msonline:VISIOCLIENT VISIO_CLIENT_SUBSCRIPTION Success
33 #msonline:POWER_BI_PRO EXCHANGE_S_FOUNDATION Success
34 #msonline:POWER_BI_PRO BI_AZURE_P2 Success
35 #msonline:WINDOWS_STORE EXCHANGE_S_FOUNDATION Success
36 #msonline:WINDOWS_STORE WINDOWS_STORE PendingActivation
39 def inventory_msoffice_serviceplans(info):
40 for bundle, _plan, _status in info:
41 yield bundle, {}
44 def check_msoffice_serviceplans(item, params, info):
45 success = 0
46 pending = 0
47 pending_list = []
48 warn, crit = params.get("levels", (None, None))
49 for bundle, plan, status in info:
50 if bundle == item:
51 if status == "Success":
52 success += 1
53 elif status == "PendingActivation":
54 pending += 1
55 pending_list.append(plan)
56 state = 0
57 infotext = "Success: %d, Pending: %d" % (success, pending)
58 if crit and pending >= crit:
59 state = 2
60 elif warn and pending >= warn:
61 state = 1
62 if state:
63 infotext += " (warn/crit at %d/%d)" % (warn, crit)
64 yield state, infotext
65 if pending_list:
66 yield 0, "Pending Services: %s" % ", ".join(pending_list)
69 check_info["msoffice_serviceplans"] = {
70 "inventory_function": inventory_msoffice_serviceplans,
71 "check_function": check_msoffice_serviceplans,
72 "service_description": "MS Office Serviceplans %s",
73 "group": "msoffice_serviceplans",