Notify a JID of Mumble channel activity
Files
README.md

The Mumbling Herald #

scratchanitch.dev badge

A grumpy old herald who watches your Mumble server and announces comings and goings through a command of your choice.

Examples #

Joining a channel:

  • ➡️ {USERNAME} stumbles into {CHANNEL}
  • ➡️ grumbles Oh, look who's decided to grace {CHANNEL} with their presence... {USERNAME}
  • ➡️ adjusts spectacles Hmph! {USERNAME} wanders into {CHANNEL} with purpose unknown
  • ➡️ sighs heavily Another soul wanders into {CHANNEL}... {USERNAME}, was it?

Leaving a channel:

  • ⬅️ Oh, what? ahem {USERNAME} fled... somewhere waves hand
  • ⬅️ {USERNAME} vanishes into the void...
  • ⬅️ grumbles Well, that was brief... {USERNAME} has wandered off to other adventures
  • ⬅️ mutters {USERNAME} has departed from us. Just when things were getting interesting...

Sending commands #

Set SEND_COMMAND near the top of the installed mumblingherald script. It's a Bash array and the program comes first, followed by its arguments. Define any variables used in the array before the array itself.

The herald sends each announcement to the program's standard input, with a final newline. Exit status 0 means success. Any other status leaves the announcement buffered for retry. It doesn't interpret shell syntax in arguments or message text. If a sender needs a pipeline or message conversion, put that logic in an executable wrapper script.

The default command sends to an XMPP group chat:

SEND_COMMAND=(go-sendxmpp -c -f "$XMPP_CONFIG_FILE" "$XMPP_RECIPIENTS")

Fluxer #

Install curl, then replace the default SEND_COMMAND with this configuration:

FLUXER_WEBHOOK_URL='paste your webhook URL here'
SEND_COMMAND=(
    curl --fail --silent --show-error --output /dev/null
    --form 'content=<-'
    "$FLUXER_WEBHOOK_URL"
)

Fluxer accepts a multipart content field. Curl's content=<- reads the message from standard input as that field. Quotes, newlines, and emoji don't JSON encoding. The webhook URL supplies authentication and selects the channel. Fluxer returns HTTP 204 on success and suppresses mentions by default. The --fail flag makes HTTP errors count as failed sends, without adding curl retries.

Full setup #

  • Install flock from your distribution's util-linux package. The herald uses $PID_FILE.lock to prevent simultaneous instances and keeps the PID file for Monit.
  • Install timeout from GNU coreutils. Each send has a 30-second deadline, followed by a two-second grace period before forced termination. Failed sends remain buffered for retry.
  • Copy script to a dedicated directory and set ownership
    sudo mkdir -p /var/lib/mumblingherald
    sudo cp mumblingherald /var/lib/mumblingherald/
    sudo chown -R mumble-server:mumble-server /var/lib/mumblingherald
    sudo chmod 755 /var/lib/mumblingherald
    sudo chmod 700 /var/lib/mumblingherald/mumblingherald
    
  • Create PID file directory for process monitoring
    sudo mkdir -p /var/lib/mumblingherald
    sudo chown mumble-server:mumble-server /var/lib/mumblingherald
    sudo chmod 755 /var/lib/mumblingherald
    
  • Edit the script to configure details
    • MUMBLE_LOG_FILE: path to your Mumble server log
    • SEND_COMMAND: program and arguments for sending announcements, as described above
    • XMPP_RECIPIENTS: recipient JID for the default XMPP command
    • MONITORED_CHANNELS: display name of channels to watch
    • MONITOR_DEFAULT_CHANNEL: defaults to false; set to true to monitor root channel joins (authentication events)
    • SEND_TIMEOUT_SECONDS: deadline for each send, in seconds; defaults to 30
  • For Fluxer, use the configuration above and skip the next three XMPP setup steps.
  • Install go-sendxmpp
    • Download the latest binary from the go-sendxmpp releases page
    • Extract and copy to system location
      sudo cp go-sendxmpp /usr/local/bin/
      sudo chmod 755 /usr/local/bin/go-sendxmpp
      
  • Create config directory
    sudo -u mumble-server mkdir -p /var/lib/mumblingherald/.config/go-sendxmpp
    
  • Create XMPP config in /var/lib/mumblingherald/.config/go-sendxmpp/config (edit values!)
    username: herald@your-xmpp-server.com
    password: your-password
    
    • Correct permissions
      sudo chown mumble-server:mumble-server /var/lib/mumblingherald/.config/go-sendxmpp/config
      sudo chmod 600 /var/lib/mumblingherald/.config/go-sendxmpp/config
      
  • For deployment, copy the security-hardened systemd service file from the contrib/ directory. Other examples, like a monit config that uses PID file monitoring, are also available there.
    sudo cp contrib/mumblingherald.service /etc/systemd/system/mumblingherald.service
    
  • Start the herald
    sudo systemctl daemon-reload
    sudo systemctl enable --now mumblingherald
    
  • Check status
    sudo systemctl status mumblingherald
    
  • Check logs
    sudo journalctl -feu mumblingherald