From a9a97701e0d2e0940e5a4192aa66359e9db68b7c Mon Sep 17 00:00:00 2001 From: cmk-bonobo Date: Fri, 22 Sep 2023 15:57:46 +0200 Subject: [PATCH] MKP 1.1.3 bugfix for handling usagae calculation if quota not set (mailboxes) --- .../plugins/agent_based/mailcow_mailboxes.py | 12 ++++++++---- mkp/Mailcow-1.1.3.mkp | Bin 0 -> 11228 bytes 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100755 mkp/Mailcow-1.1.3.mkp diff --git a/local/lib/python3/cmk/base/plugins/agent_based/mailcow_mailboxes.py b/local/lib/python3/cmk/base/plugins/agent_based/mailcow_mailboxes.py index 8eebb78..18f9f0c 100644 --- a/local/lib/python3/cmk/base/plugins/agent_based/mailcow_mailboxes.py +++ b/local/lib/python3/cmk/base/plugins/agent_based/mailcow_mailboxes.py @@ -93,12 +93,16 @@ def parse_mailcow_mailboxes_section(string_table): display_name = line[4] # number of messages within mailbox number_of_messages = int(line[5]) - # percent in use, rounded to full percent - percent_in_use = int(line[6]) # calculate storage used for all messages in mailbox quota = int(line[7]) - total_number_of_bytes_used = int(line[8]) - percent_storage_used_for_messages = total_number_of_bytes_used * 100 / quota + if quota == 0: + # quota is not set, if this is the case, line[6] contains no numeric value, but the char "-" + percent_in_use = 0 + else: + total_number_of_bytes_used = int(line[8]) + percent_storage_used_for_messages = total_number_of_bytes_used * 100 / quota + # percent in use, rounded to full percent + percent_in_use = int(line[6]) # get time of last login for IMAP/POP3/SMTP (seconds since epoch) last_imap_login = int(line[9]) last_pop3_login = int(line[10]) diff --git a/mkp/Mailcow-1.1.3.mkp b/mkp/Mailcow-1.1.3.mkp new file mode 100755 index 0000000000000000000000000000000000000000..0ee707e1fe59265b519a5e07c0ebb0ed32fa0287 GIT binary patch literal 11228 zcma)?Q*b2=@a1FMPA0Z7aVEBHYhwE*xv?jSbM$0lV`gLKV7CA51a{^B<+;(?Xbe~}3R*ZJmg{Pi_ur7+ z`dDagn{Kta&wSk4!u&X$!!UmcBX^gX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