added debug options

This commit is contained in:
Ralf Mellis 2025-04-12 15:22:11 +02:00
parent cc2aaee908
commit 567f4d8602
12 changed files with 18 additions and 1 deletions

View File

@ -3,6 +3,10 @@
"""Mailcow check for domains""" """Mailcow check for domains"""
from pprint import pprint
from cmk.utils import debug
# import necessary elements from API version 2 # import necessary elements from API version 2
from cmk.agent_based.v2 import ( from cmk.agent_based.v2 import (
AgentSection, AgentSection,
@ -92,6 +96,8 @@ def discover_mailcow_domains(section):
def check_mailcow_domains(item, params, section): def check_mailcow_domains(item, params, section):
"""the check function""" """the check function"""
if debug.enabled():
pprint(section)
domain = section.get(item) domain = section.get(item)
if not domain: if not domain:
# if a previously found domain does not exist anymore, create a meaningful result # if a previously found domain does not exist anymore, create a meaningful result

View File

@ -1,5 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# pylint: disable=line-too-long, simplifiable-if-statement, missing-module-docstring, too-many-locals # pylint: disable=line-too-long, simplifiable-if-statement, missing-module-docstring, too-many-locals, unused-argument
from pprint import pprint
from cmk.utils import debug
# import necessary elements from API version 2 # import necessary elements from API version 2
from cmk.agent_based.v2 import ( from cmk.agent_based.v2 import (
@ -61,6 +65,8 @@ def discover_mailcow_info(section):
def check_mailcow_info(params, section): def check_mailcow_info(params, section):
"""the check function""" """the check function"""
if debug.enabled():
pprint(section)
# get thresholds # get thresholds
_type, levels_num_domains = params["levels_num_domains"] _type, levels_num_domains = params["levels_num_domains"]
_type, levels_num_mailboxes = params["levels_num_mailboxes"] _type, levels_num_mailboxes = params["levels_num_mailboxes"]

View File

@ -3,6 +3,9 @@
"""Mailcow check for mailboxes""" """Mailcow check for mailboxes"""
import time import time
from pprint import pprint
from cmk.utils import debug
# import necessary elements from API version 2 # import necessary elements from API version 2
from cmk.agent_based.v2 import ( from cmk.agent_based.v2 import (
@ -112,6 +115,8 @@ def parse_mailcow_mailboxes(string_table):
def discover_mailcow_mailboxes(section): def discover_mailcow_mailboxes(section):
"""the discover function""" """the discover function"""
# since we have a service with item here we must create one service per item # since we have a service with item here we must create one service per item
if debug.enabled():
pprint(section)
for key in section: for key in section:
yield Service(item=key) yield Service(item=key)