What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How do I monitor BigBlueButton usage?

Votes:

0

Your Vote:

Up

Down

I'm going to share our BBB status sensor Powershell script as an answer.

bbb bigbluebutton exexml powershell

Created on Apr 29, 2020 9:06:22 AM by  uka (70) 2 1



9 Replies

Accepted Answer

Votes:

1

Your Vote:

Up

Down

<#
.SYNOPSIS
PRTG Sensor for BBB server

.PARAMETER serverurl
Full URL to BBB API, e.g. https://your-server/bigbluebutton/api
(no trainling slash please!)

.PARAMETER secret
BBB-Secret (get it by running "bbb-conf --secret")
#>
Param(
	[Parameter( Mandatory=$true)]
    [string]$serverurl,
	[Parameter( Mandatory=$true)]
    [string]$secret
    )
 
# Strange hack to get proper output encoding
# see https://kb.paessler.com/en/topic/64817-how-can-i-show-special-characters-with-exe-script-sensors#reply-210863
ping localhost -n 1 | Out-Null
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

# Powershell is stupid and tries TLS1.0 by default, then dies at Invoke-WebRequest :-(
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
 
$api = "getMeetings"

$hasher = [System.Security.Cryptography.SHA1]::Create()
# calculate checksum - see https://docs.bigbluebutton.org/dev/api.html
$bytes = [byte[]][char[]]("$api$secret")
$hash = $hasher.ComputeHash($bytes)
# and convert to hex format
$secret = (($hash | foreach { $_.ToString("X2") }) -join "").toLower()

# build API call url including checksum
$fullurl = "$serverurl/$($api)?&checksum=$secret"
#echo $fullurl
$response = Invoke-WebRequest -URI $fullurl

function send-error
{
	Param([string]$message)
# neccessary for correct output encoding
[Console]::WriteLine(@"
<?xml version=`"1.0`" encoding=`"UTF-8`" ?>
<prtg>
    <error>1</error>
	<text>
	$message
	</text>
</prtg>
"@ )
}

if ($response.StatusCode -ne 200) {
	send-error "Invalid HTTP response code: $($response.StatusCode) - $($response.Content)"
	exit
}

#for debugging:
#echo $response.Content

# convert response to XML object
$xml = [xml]$response.Content
if ($xml.response.returncode -ne "SUCCESS") {
	send-error "API call failed: $($xml.response.message)"
	exit
}

# XML structure:
# response
#   meetings
#     meeting
#       meetingName
#       running (true)
#       participantCount (int)
#		listenerCount (int)
#		voiceParticipantCount (int)
#		videoCount (int)
#		isBreakout -> I'm not sure whether to count them, probably yes

$meetingcount = 0
$runningcount = 0
$participantCount = 0
$listenerCount = 0
$voiceParticipantCount = 0
$videoCount = 0
$resultmessage = "OK"

if ($xml.response.meetings) {
	if ($xml.response.meetings.meeting) {
		$meetingcount = 1
	}
	if ($xml.response.meetings.meeting.Count -gt 0) {
		$meetingcount = $xml.response.meetings.meeting.Count
	}
	$running = $xml.response.meetings | ? { $_.meeting.running -eq "true" }
	foreach ($m in $running.meeting) {
		$runningcount++;
		$participantCount += $m.participantCount
		$listenerCount += $m.listenerCount
		$voiceParticipantCount += $m.voiceParticipantCount
		$videoCount += $m.videoCount
	}
} else {
	$resultmessage = "no active meetings"
}

$result += @"
		<result>
			<value>$meetingcount</value>
			<unit>count</unit>
			<channel>Total meetings</channel>
		</result>
		<result>
			<value>$runningcount</value>
			<unit>count</unit>
			<channel>Total meetings running</channel>
		</result>
		<result>
			<value>$participantCount</value>
			<unit>count</unit>
			<channel>Total participants</channel>
		</result>
		<result>
			<value>$listenerCount</value>
			<unit>count</unit>
			<channel>Total listeners</channel>
		</result>
		<result>
			<value>$voiceParticipantCount</value>
			<unit>count</unit>
			<channel>Total voice participants</channel>
		</result>
		<result>
			<value>$videoCount</value>
			<unit>count</unit>
			<channel>Total video streams</channel>
		</result>
		<text>
		$resultmessage
		</text>
"@

# neccessary for correct output encoding
[Console]::WriteLine(@"
<?xml version=`"1.0`" encoding=`"UTF-8`" ?>
<prtg>
$result
</prtg>
"@ )

Created on Apr 30, 2020 8:54:15 AM by  uka (70) 2 1



Votes:

0

Your Vote:

Up

Down

Hi there,

Thanks a lot for sharing your script with us.

We appreciate that.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Apr 30, 2020 6:05:57 PM by  Birk Guttmann [Paessler Support]



Votes:

1

Your Vote:

Up

Down

Hi,

"$response = Invoke-WebRequest -URI $fullurl" should include the "-UseBasicParsing" parameter to avoid error message related to the command not being implemented.

"$response = Invoke-WebRequest -URI $fullurl -UseBasicParsing"

Regards, MPIDR

Created on Jun 2, 2020 11:13:41 AM by  MPIDR (10)

Last change on Jun 2, 2020 2:38:20 PM by  Birk Guttmann [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi,

thank you very much for sharing this script!

I saved it under "custom sensors\EXE\bbb.ps1" and added a new sensor "Program/Script sensor".

Could please give me an advice how to enter the parameters (what is the exact syntax)?

Many thanks!

Frank

Created on Sep 11, 2021 10:46:32 AM by  FrankBBB (0)



Votes:

0

Your Vote:

Up

Down

Hello Frank,

To enter the parameters use quotation marks to correctly escape the parameters, for example, if the values contain spaces. In tab Settings in option Parameters of your sensor you will need to enter it like following:

-parameter "Example" 

Kind regards

Felix Wiesneth - Team Tech Support

Created on Sep 13, 2021 8:26:14 AM by  Felix Wiesneth [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thank you very much!

Created on Sep 13, 2021 10:10:42 AM by  FrankBBB (0)



Votes:

0

Your Vote:

Up

Down

Sorry, one more question: I have to enter 2 parameters (serverurl and secret). What should I enter in the option "Parameter" of the sensor? Many thanks!

Frank

Created on Sep 13, 2021 10:59:51 AM by  FrankBBB (0)



Votes:

0

Your Vote:

Up

Down

Hi Frank,

you can enter several parameter in the option field.

-parameter1 "Example1" -parameter2 "Example2"

Kind regards

Felix Wiesneth - Team Tech Support

Created on Sep 13, 2021 11:44:40 AM by  Felix Wiesneth [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Perfect - Script works for me now!

Hints:

  1. Modify the script as MDIPR mentioned.
  2. Save the script as PS1-File (eg. bbb.ps1) into the folder "custom sensors\EXEXML\"
  3. Install the sensor "Program/Script (advanced)"
  4. In the section "parameter" enter the following: -serverurl "https:YOURSERVER/bigbluebutton/api" -secret "BBBSECRET"

Best, Frank

Created on Sep 13, 2021 12:43:50 PM by  FrankBBB (0)

Last change on Sep 13, 2021 2:44:09 PM by  Felix Wiesneth [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.