Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
checkmk-formula
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
salt
checkmk-formula
Commits
7a85c992
Commit
7a85c992
authored
4 years ago
by
Jan Philipp Timme
Browse files
Options
Downloads
Patches
Plain Diff
Add plugin to check bbb via scalelite
parent
8f713cd8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
checkmk/custom-files/plugins/checkbbb.py
+114
-0
114 additions, 0 deletions
checkmk/custom-files/plugins/checkbbb.py
checkmk/debian/checkbbb.sls
+7
-0
7 additions, 0 deletions
checkmk/debian/checkbbb.sls
with
121 additions
and
0 deletions
checkmk/custom-files/plugins/checkbbb.py
0 → 100644
+
114
−
0
View file @
7a85c992
#!/usr/bin/python3
#
# checkbbb.py
# Frank Schiebel frank@linuxmuster.net
# GPL v3
#
import
os
import
sys
import
socket
import
re
import
hashlib
import
requests
from
collections
import
defaultdict
from
xml.dom.minidom
import
parse
,
parseString
def
getStatus
():
stream
=
os
.
popen
(
'
/usr/bin/docker exec scalelite-api ./bin/rake status
'
)
stream
=
stream
.
read
()
allservers
=
[]
for
line
in
stream
.
splitlines
():
fields
=
re
.
split
(
r
'
\s
'
,
line
)
fields
=
list
(
filter
(
None
,
fields
))
numfields
=
len
(
fields
)
if
numfields
==
7
:
hrfields
=
{}
fields
[
0
]
=
re
.
split
(
r
'
\.
'
,
fields
[
0
])[
0
]
hrfields
[
"
hostname
"
]
=
fields
[
0
]
hrfields
[
"
state
"
]
=
fields
[
1
]
hrfields
[
"
status
"
]
=
fields
[
2
]
hrfields
[
"
meetings
"
]
=
fields
[
3
]
hrfields
[
"
users
"
]
=
fields
[
4
]
hrfields
[
"
largestmeeting
"
]
=
fields
[
5
]
hrfields
[
"
videos
"
]
=
fields
[
6
]
allservers
.
append
(
hrfields
)
return
allservers
def
generateCheckLine
(
bbb
):
global
totalMeetings
global
totalAttendees
global
totalVideousers
global
avgVideoPerMeeting
checkstate
=
0
statusline
=
""
if
bbb
[
"
state
"
]
==
"
enabled
"
:
statusline
=
str
(
checkstate
)
+
"
"
+
"
BBB_
"
+
bbb
[
"
hostname
"
]
+
"
"
statusline
+=
"
numMeetings=
"
+
bbb
[
"
meetings
"
]
+
"
|
"
statusline
+=
"
numAttendees=
"
+
bbb
[
"
users
"
]
+
"
|
"
statusline
+=
"
numWithVideo=
"
+
bbb
[
"
videos
"
]
+
"
"
statusline
+=
"
[
"
+
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
"
]
+
"
|
"
statusline
+=
"
numAttendees=
"
+
bbb
[
"
users
"
]
+
"
|
"
statusline
+=
"
numWithVideo=
"
+
bbb
[
"
videos
"
]
+
"
"
statusline
+=
"
****DISABLED IN SCALELITE**** [
"
+
bbb
[
"
hostname
"
]
+
"
M:
"
+
bbb
[
"
meetings
"
]
+
"
"
statusline
+=
"
Att:
"
+
bbb
[
"
users
"
]
+
"
"
statusline
+=
"
Vid:
"
+
bbb
[
"
videos
"
]
+
"
]
"
if
bbb
[
"
state
"
]
==
"
enabled
"
and
bbb
[
"
status
"
]
==
"
offline
"
:
checkstate
=
2
statusline
=
str
(
checkstate
)
+
"
"
+
"
BBB_
"
+
bbb
[
"
hostname
"
]
+
"
"
statusline
+=
"
numMeetings=0|
"
statusline
+=
"
numAttendees=0|
"
statusline
+=
"
numWithVideo=0
"
statusline
+=
"
****ENABLED BUT 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****
"
totalMeetings
+=
int
(
bbb
[
"
meetings
"
])
totalAttendees
+=
int
(
bbb
[
"
users
"
])
totalVideousers
+=
int
(
bbb
[
"
videos
"
])
return
statusline
# Global metrics
totalMeetings
=
0
totalAttendees
=
0
totalVideousers
=
0
allservers
=
getStatus
()
for
bbb
in
allservers
:
print
(
generateCheckLine
(
bbb
))
statusline
=
"
0 BBBSCL_
"
+
socket
.
gethostname
()
+
"
"
statusline
+=
"
numMeetings=
"
+
str
(
totalMeetings
)
+
"
|
"
statusline
+=
"
numAttendees=
"
+
str
(
totalAttendees
)
+
"
|
"
statusline
+=
"
numWithVideo=
"
+
str
(
totalVideousers
)
+
"
"
statusline
+=
"
[scale001 totals
"
statusline
+=
"
M:
"
+
str
(
totalMeetings
)
+
"
"
statusline
+=
"
Att:
"
+
str
(
totalAttendees
)
+
"
"
statusline
+=
"
Vid:
"
+
str
(
totalVideousers
)
+
"
]
"
print
(
statusline
)
overalltext
=
"
0 BBB_Overall_Attendees count=
"
+
str
(
totalAttendees
)
+
"
;200;500
"
overalltext
+=
str
(
totalAttendees
)
print
(
overalltext
)
This diff is collapsed.
Click to expand it.
checkmk/debian/checkbbb.sls
0 → 100644
+
7
−
0
View file @
7a85c992
hsh_checkmk_install_checkbbb_plugin:
file.managed:
- name: /usr/lib/check_mk_agent/plugins/checkbbb.py
- source: salt://checkmk/custom-files/plugins/checkbbb.py
- user: root
- group: root
- mode: 755
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment