From 76702b1f24b831d544b6de20b15c5591f144b0b2 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme <jan.philipp@timme.it> Date: Fri, 18 Jun 2021 14:28:42 +0200 Subject: [PATCH] Add support for cordoned status in checkbbb.py plugin --- checkmk/custom-files/plugins/checkbbb.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/checkmk/custom-files/plugins/checkbbb.py b/checkmk/custom-files/plugins/checkbbb.py index dd57859..95985f8 100644 --- a/checkmk/custom-files/plugins/checkbbb.py +++ b/checkmk/custom-files/plugins/checkbbb.py @@ -1,10 +1,11 @@ #!/usr/bin/python3 -# +# This plugin is based on: # checkbbb.py # Frank Schiebel frank@linuxmuster.net # GPL v3 # +# Adapted by the folks at Hochschule Hannover :-) import os import sys @@ -46,7 +47,7 @@ def generateCheckLine(bbb): checkstate = 0 statusline = "" - if bbb["state"] == "enabled": + if bbb["state"] == "enabled" and bbb["status"] == "online": statusline = str(checkstate) + " " + "BBB_" + bbb["hostname"] + " " statusline += "numMeetings=" + bbb["meetings"] + "|" statusline += "numAttendees=" + bbb["users"] + "|" @@ -55,6 +56,15 @@ def generateCheckLine(bbb): statusline += "Att:" + bbb["users"] + " " statusline += "Vid:" + bbb["videos"] + "]" + if bbb["state"] == "cordoned" and bbb["status"] == "online": + statusline = str(checkstate) + " " + "BBB_" + bbb["hostname"] + " " + statusline += "numMeetings=" + bbb["meetings"] + "|" + statusline += "numAttendees=" + bbb["users"] + "|" + statusline += "numWithVideo=" + bbb["videos"] + " " + statusline += "****CORDONED IN SCALELITE**** [" + bbb["hostname"] + " M:" + bbb["meetings"] + " " + statusline += "Att:" + bbb["users"] + " " + statusline += "Vid:" + bbb["videos"] + "]" + if bbb["state"] == "disabled" and bbb["status"] == "online": statusline = str(checkstate) + " " + "BBB_" + bbb["hostname"] + " " statusline += "numMeetings=" + bbb["meetings"] + "|" @@ -72,13 +82,21 @@ def generateCheckLine(bbb): statusline += "numWithVideo=0 " statusline += "****ENABLED BUT OFFLINE****" + if bbb["state"] == "cordoned" and bbb["status"] == "offline": + checkstate = 2 + statusline = str(checkstate) + " " + "BBB_" + bbb["hostname"] + " " + statusline += "numMeetings=0|" + statusline += "numAttendees=0|" + statusline += "numWithVideo=0 " + statusline += "****CORDONED IN SCALELITE AND OFFLINE****" + if bbb["state"] == "disabled" and bbb["status"] == "offline": checkstate = 1 statusline = str(checkstate) + " " + "BBB_" + bbb["hostname"] + " " statusline += "numMeetings=0|" statusline += "numAttendees=0|" statusline += "numWithVideo=0 " - statusline += "****DISABLED IN SCALELITE AND OFFLINE****" + statusline += "****DISABLED IN SCALELITE AND OFFLINE****" totalMeetings += int(bbb["meetings"]) totalAttendees += int(bbb["users"]) -- GitLab