This is a Gitlab for NZOSS Members

Unverified Commit da5026fd authored by Tim McNamara's avatar Tim McNamara
Browse files

Add setup process and meeting polling to version control

parents
meetings-monitoring/Raw
meetings-monitoring/Clean
\ No newline at end of file
user := env_var_or_default("BBB_USER", "ubuntu")
host := env_var_or_default("BBB_HOST", "bbb.nzoss.nz")
remote_path := env_var_or_default("REMOTE_PATH", "/home/" + user + "/meetings-monitoring")
exe := "ssh " + user + "@" + host
# lists the files at REMOTE_PATH (for testing)
ls:
{{exe}} ls {{remote_path}}
sync:
rsync -av {{user}}@{{host}}:{{remote_path}} .
\ No newline at end of file
# meeting-monitoring
This repository contains scripts and other resources for
monitoring NZOSS's BigBlueButton instance at https://bbb.nzoss.nz/.
In particular, it builds a dashboard that monitors usage.
Yes we could use grafana and Prometheus, but this is more fun.
# Setup
You need an Ubuntu system running. The fastest way to get one
is by installing [multipass][].
Install all necessary dependencies via `setup.sh`
$ chmod +x
$ setup.sh
Note: if something goes wrong, please set the DEBUG variable and run the script again. See the **Contact** section for where to send this output to for help:
$ DEBUG=yes ./setup.sh
# Project Structure
## Justfile
We use [`just`][] as a task runner.
## Makefile
The Makefile is used exclusively for building things.
We use GNU `make`, although we don't make heavy use of extensions,
so any POSIX-compatible makefile should work.
# Admin
## Licence
All rights reserved.
(This will change shortly)
## Contact
The preferred method is the [#technical][] channel within https://chat.nzoss.nz/.
## Maintainers
- Tim McNamara <code@timmcnamara.co.nz>
[just]: https://github.com/casey/just
[multipass]: https://multipass.run/
\ No newline at end of file
#!/bin/bash
# contact Tim (@tim.m in https://chat.nzoss.nz)
set -e
set -x
save_to=Raw/bbb-active-meetings-$(date -I).xml
shared_secret=$(bbb-conf --secret | grep Secret: | cut -d':' -f2 | sed s/[[:space:]]//g)
# calculate checksum as a SHA1 of endpoint, params (none for this call) and the shared secret
checksum=$(python3 -c "import hashlib; print(hashlib.sha1(b'getMeetings$shared_secret').digest().hex())")
# download and clean
response=$(curl "https://bbb.nzoss.nz/bigbluebutton/api/getMeetings?checksum=$checksum" | tr '\n' ' ')
# sidenote: let's hope no usernames or room names contain newline characters
# add a timestamp
content="<poll><time>$(date -Is)</time>$response</poll>"
echo $content >> "$save_to"
# debugging aid
echo content
#!/bin/bash
set -e # abort early if there's an error with the script
if [ -n "$DEBUG" ]; then
set -x # trace execution output
lsb_release -d
uname -a
fi
# TODO: factor the command checking into its own function
install-curl() {
local cmd=$( command -v curl )
if [ -n "$cmd" ]; then
return 0
fi
sudo apt install -y curl
}
install-make() {
local cmd=$( command -v make )
if [ -n "$cmd" ]; then
return 0
fi
sudo apt install -yq make
}
install-ssh() {
local cmd=$( command -v ssh )
if [ -n "$cmd" ]; then
return 0
fi
sudo apt install -y ssh
}
install-rsync() {
local cmd=$( command -v rsync )
if [ -n "$cmd" ]; then
return 0
fi
sudo apt install -y rsync
}
install-gnuplot() {
# TODO: check minimum required version
local cmd=$( command -v gnuplot )
if [ -n "$cmd" ]; then
return 0
fi
sudo apt install -y gnuplot
}
install-rust() {
local cmd=$( command -v rustc )
if [ -n "$cmd" ]; then
return 0
fi
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh
sudo chmod +x /tmp/rustup.sh
/tmp/rustup.sh --profile minimal -y
rm /tmp/rustup.sh
}
install-just() {
cargo install -q just
}
install-curl
install-rust
install-just
install-make
install-ssh
install-rsync
install-gnuplot
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment