|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# -*- coding: utf-8; py-indent-offset: 4; max-line-length: 100 -*- |
| 3 | + |
| 4 | +# Copyright (C) 2024, 2025 Christopher Pommer <cp.software@outlook.de> |
| 5 | + |
| 6 | +# This program is free software; you can redistribute it and/or |
| 7 | +# modify it under the terms of the GNU General Public License |
| 8 | +# as published by the Free Software Foundation; either version 2 |
| 9 | +# of the License, or (at your option) any later version. |
| 10 | + |
| 11 | +# This program is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU General Public License for more details. |
| 15 | + |
| 16 | +# You should have received a copy of the GNU General Public License |
| 17 | +# along with this program; if not, write to the Free Software |
| 18 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | + |
| 20 | + |
| 21 | +#################################################################################################### |
| 22 | +# The graph parameters are part of the Microsoft Intune special agent (ms_intune). |
| 23 | + |
| 24 | + |
| 25 | +from cmk.graphing.v1 import Title |
| 26 | +from cmk.graphing.v1.graphs import Graph, MinimalRange |
| 27 | +from cmk.graphing.v1.metrics import ( |
| 28 | + Color, |
| 29 | + CriticalOf, |
| 30 | + DecimalNotation, |
| 31 | + Metric, |
| 32 | + StrictPrecision, |
| 33 | + TimeNotation, |
| 34 | + Unit, |
| 35 | + WarningOf, |
| 36 | +) |
| 37 | +from cmk.graphing.v1.perfometers import Closed, FocusRange, Open, Perfometer |
| 38 | + |
| 39 | +UNIT_COUNTER = Unit(DecimalNotation(""), StrictPrecision(0)) |
| 40 | +UNIT_PERCENTAGE = Unit(DecimalNotation("%")) |
| 41 | +UNIT_TIME = Unit(TimeNotation()) |
| 42 | + |
| 43 | + |
| 44 | +# Microsoft Intune App Licenses |
| 45 | + |
| 46 | +metric_ms_intune_app_licenses_consumed = Metric( |
| 47 | + name="ms_intune_app_licenses_consumed", |
| 48 | + title=Title("Consumed"), |
| 49 | + unit=UNIT_COUNTER, |
| 50 | + color=Color.CYAN, |
| 51 | +) |
| 52 | + |
| 53 | +metric_ms_intune_app_licenses_consumed_pct = Metric( |
| 54 | + name="ms_intune_app_licenses_consumed_pct", |
| 55 | + title=Title("Usage"), |
| 56 | + unit=UNIT_PERCENTAGE, |
| 57 | + color=Color.BLUE, |
| 58 | +) |
| 59 | + |
| 60 | +metric_ms_intune_app_licenses_total = Metric( |
| 61 | + name="ms_intune_app_licenses_total", |
| 62 | + title=Title("Total"), |
| 63 | + unit=UNIT_COUNTER, |
| 64 | + color=Color.DARK_CYAN, |
| 65 | +) |
| 66 | + |
| 67 | +metric_ms_intune_app_licenses_available = Metric( |
| 68 | + name="ms_intune_app_licenses_available", |
| 69 | + title=Title("Available"), |
| 70 | + unit=UNIT_COUNTER, |
| 71 | + color=Color.LIGHT_GRAY, |
| 72 | +) |
| 73 | + |
| 74 | + |
| 75 | +graph_ms_intune_app_licenses_count = Graph( |
| 76 | + name="ms_intune_app_licenses_count", |
| 77 | + title=Title("License count"), |
| 78 | + compound_lines=[ |
| 79 | + "ms_intune_app_licenses_consumed", |
| 80 | + "ms_intune_app_licenses_available", |
| 81 | + ], |
| 82 | + simple_lines=[ |
| 83 | + "ms_intune_app_licenses_total", |
| 84 | + WarningOf("ms_intune_app_licenses_consumed"), |
| 85 | + CriticalOf("ms_intune_app_licenses_consumed"), |
| 86 | + ], |
| 87 | +) |
| 88 | + |
| 89 | +graph_ms_intune_app_licenses_usage = Graph( |
| 90 | + name="ms_intune_app_licenses_usage", |
| 91 | + title=Title("License usage"), |
| 92 | + minimal_range=MinimalRange(0, 100), |
| 93 | + simple_lines=[ |
| 94 | + "ms_intune_app_licenses_consumed_pct", |
| 95 | + WarningOf("ms_intune_app_licenses_consumed_pct"), |
| 96 | + CriticalOf("ms_intune_app_licenses_consumed_pct"), |
| 97 | + ], |
| 98 | +) |
| 99 | + |
| 100 | +perfometer_ms_intune_app_licenses_consumed_pct = Perfometer( |
| 101 | + name="ms_intune_app_licenses_consumed_pct", |
| 102 | + focus_range=FocusRange(Closed(0), Closed(100)), |
| 103 | + segments=["ms_intune_app_licenses_consumed_pct"], |
| 104 | +) |
| 105 | + |
| 106 | + |
| 107 | +# Microsoft Intune Apple ADE tokens |
| 108 | + |
| 109 | +metric_ms_intune_apple_ade_tokens_remaining_validity = Metric( |
| 110 | + name="ms_intune_apple_ade_tokens_remaining_validity", |
| 111 | + title=Title("Remaining token validity time"), |
| 112 | + unit=UNIT_TIME, |
| 113 | + color=Color.YELLOW, |
| 114 | +) |
| 115 | + |
| 116 | +perfometer_ms_intune_apple_ade_tokens_remaining_validity = Perfometer( |
| 117 | + name="ms_intune_apple_ade_tokens_remaining_validity", |
| 118 | + focus_range=FocusRange(Closed(0), Open(15552000)), |
| 119 | + segments=["ms_intune_apple_ade_tokens_remaining_validity"], |
| 120 | +) |
| 121 | + |
| 122 | + |
| 123 | +# Microsoft Intune Apple MDM Push Certificate |
| 124 | + |
| 125 | +metric_ms_intune_apple_mdm_push_cert_remaining_validity = Metric( |
| 126 | + name="ms_intune_apple_mdm_push_cert_remaining_validity", |
| 127 | + title=Title("Remaining certificate validity time"), |
| 128 | + unit=UNIT_TIME, |
| 129 | + color=Color.YELLOW, |
| 130 | +) |
| 131 | + |
| 132 | +perfometer_ms_intune_apple_mdm_push_cert_remaining_validity = Perfometer( |
| 133 | + name="ms_intune_apple_mdm_push_cert_remaining_validity", |
| 134 | + focus_range=FocusRange(Closed(0), Open(15552000)), |
| 135 | + segments=["ms_intune_apple_mdm_push_cert_remaining_validity"], |
| 136 | +) |
| 137 | + |
| 138 | + |
| 139 | +# Microsoft Intune Apple VPP Tokens |
| 140 | + |
| 141 | +metric_ms_intune_apple_vpp_tokens_remaining_validity = Metric( |
| 142 | + name="ms_intune_apple_vpp_tokens_remaining_validity", |
| 143 | + title=Title("Remaining token validity time"), |
| 144 | + unit=UNIT_TIME, |
| 145 | + color=Color.YELLOW, |
| 146 | +) |
| 147 | + |
| 148 | +perfometer_ms_intune_apple_vpp_tokens_remaining_validityy = Perfometer( |
| 149 | + name="ms_intune_apple_vpp_tokens_remaining_validity", |
| 150 | + focus_range=FocusRange(Closed(0), Open(15552000)), |
| 151 | + segments=["ms_intune_apple_vpp_tokens_remaining_validity"], |
| 152 | +) |
0 commit comments