| 
 | 1 | +#!/usr/bin/env python3  | 
 | 2 | +# -*- coding: utf-8; py-indent-offset: 4; max-line-length: 100 -*-  | 
 | 3 | + | 
 | 4 | +# Copyright (C) 2025  Christopher Pommer <[email protected]>  | 
 | 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 Entra special agent (ms_entra)  | 
 | 23 | + | 
 | 24 | +from cmk.graphing.v1 import Title  | 
 | 25 | +from cmk.graphing.v1.metrics import (  | 
 | 26 | +    Color,  | 
 | 27 | +    Unit,  | 
 | 28 | +    Metric,  | 
 | 29 | +    TimeNotation,  | 
 | 30 | +)  | 
 | 31 | +from cmk.graphing.v1.perfometers import Closed, FocusRange, Open, Perfometer  | 
 | 32 | + | 
 | 33 | +UNIT_TIME = Unit(TimeNotation())  | 
 | 34 | + | 
 | 35 | +# Microsoft Entra App Credentials  | 
 | 36 | + | 
 | 37 | +metric_ms_entra_app_creds_remaining_validity = Metric(  | 
 | 38 | +    name="ms_entra_app_creds_remaining_validity",  | 
 | 39 | +    title=Title("Remaining credential validity time"),  | 
 | 40 | +    unit=UNIT_TIME,  | 
 | 41 | +    color=Color.YELLOW,  | 
 | 42 | +)  | 
 | 43 | + | 
 | 44 | +perfometer_ms_entra_app_creds_remaining_validity = Perfometer(  | 
 | 45 | +    name="ms_entra_app_creds_remaining_validity",  | 
 | 46 | +    focus_range=FocusRange(Closed(0), Open(15552000)),  | 
 | 47 | +    segments=["ms_entra_app_creds_remaining_validity"],  | 
 | 48 | +)  | 
 | 49 | + | 
 | 50 | + | 
 | 51 | +# Microsoft Entra CA VPN Certificate  | 
 | 52 | + | 
 | 53 | +metric_ms_entra_ca_vpn_cert_remaining_validity = Metric(  | 
 | 54 | +    name="ms_entra_ca_vpn_cert_remaining_validity",  | 
 | 55 | +    title=Title("Remaining certificate validity time"),  | 
 | 56 | +    unit=UNIT_TIME,  | 
 | 57 | +    color=Color.YELLOW,  | 
 | 58 | +)  | 
 | 59 | + | 
 | 60 | +perfometer_ms_entra_ca_vpn_cert_remaining_validity = Perfometer(  | 
 | 61 | +    name="ms_entra_ca_vpn_cert_remaining_validity",  | 
 | 62 | +    focus_range=FocusRange(Closed(0), Open(15552000)),  | 
 | 63 | +    segments=["ms_entra_ca_vpn_cert_remaining_validity"],  | 
 | 64 | +)  | 
 | 65 | + | 
 | 66 | + | 
 | 67 | +# Microsoft Entra SAML Certificate  | 
 | 68 | + | 
 | 69 | +metric_ms_entra_saml_certs_remaining_validity = Metric(  | 
 | 70 | +    name="ms_entra_saml_certs_remaining_validity",  | 
 | 71 | +    title=Title("Remaining certificate validity time"),  | 
 | 72 | +    unit=UNIT_TIME,  | 
 | 73 | +    color=Color.YELLOW,  | 
 | 74 | +)  | 
 | 75 | + | 
 | 76 | +perfometer_ms_entra_saml_certs_remaining_validity = Perfometer(  | 
 | 77 | +    name="ms_entra_saml_certs_remaining_validity",  | 
 | 78 | +    focus_range=FocusRange(Closed(0), Open(15552000)),  | 
 | 79 | +    segments=["ms_entra_saml_certs_remaining_validity"],  | 
 | 80 | +)  | 
 | 81 | + | 
 | 82 | + | 
 | 83 | +# Microsoft Entra Sync  | 
 | 84 | + | 
 | 85 | +metric_ms_entra_sync_elapsed_time = Metric(  | 
 | 86 | +    name="ms_entra_sync_elapsed_time",  | 
 | 87 | +    title=Title("Elapsed time since last sync"),  | 
 | 88 | +    unit=UNIT_TIME,  | 
 | 89 | +    color=Color.DARK_YELLOW,  | 
 | 90 | +)  | 
 | 91 | + | 
 | 92 | +perfometer_ms_entra_sync_elapsed_time = Perfometer(  | 
 | 93 | +    name="ms_entra_sync_elapsed_time",  | 
 | 94 | +    focus_range=FocusRange(Closed(0), Open(3600)),  | 
 | 95 | +    segments=["ms_entra_sync_elapsed_time"],  | 
 | 96 | +)  | 
0 commit comments