Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Serverstats/Cacti script for BigBlueButton usage
#!/usr/bin/python3
# Output is nbmeetings nbattendees nbvideosin nbvideoout
# hostname and secret should be configured (bbb-conf --secret)
import requests
import hashlib
from lxml import etree
hostname = "<YourHostname>"
secret = b"<YourSecret>"
hash = hashlib.sha1(b"getMeetings" + secret).hexdigest()
r = requests.get('http://'+hostname+'/bigbluebutton/api/getMeetings?checksum='+hash)
nbmeetings = 0
nbvideoin = 0
nbvideoout = 0
nbattendees = 0
tree = etree.fromstring(r.text)
for meeting in tree.xpath("/response/meetings/meeting"):
nbmeetings+=1
nbparticipants = meeting.find("participantCount").text
#nblisteners = meeting.find("listenerCount").text
nbvideos = meeting.find("videoCount").text
#nbaudios = meeting.find("voiceParticipantCount").text
nbattendees += int(nbparticipants)
nbvideoin += int(nbvideos)
nbvideoout += int(nbvideos) * (int(nbparticipants)-1)
#print("number is " + str(nbparticipants))
#print(user.text)
print("nbmeetings:"+str(nbmeetings) + '.0 ' + "nbattendees:" + str(nbattendees) + '.0 ' + "nbvideoin:" + str(nbvideoin) + '.0 ' + "nbvideoout:" + str(nbvideoout) + ".0")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment