Jetson Discord Notifier
This system sends Discord webhook notifications when your NVIDIA Jetson Orin Nano comes online and when someone connects or disconnects via SSH or VNC (noVNC + x11vnc).
It now runs via cron @reboot, tails your local VNC log files, and includes the Jetson's 172.17.x.x IP at boot.
File locations on the Jetson
-
Main script
/opt/jetson-notify/jetson_discord_notify.py
Handles event monitoring and posts JSON payloads to the Discord webhook. -
Cron wrapper (loads env, then runs the script)
/opt/jetson-notify/run-notifier.sh -
Environment file (secrets & paths)
/etc/jetson-discord.env
ContainsDISCORD_WEBHOOK,NOVNC_LOG,X11VNC_LOG,AUTH_LOG,HOST_MAP_PATH. -
VNC logs produced by your startup script
/home/arc/.local/state/vnc/novnc.log/home/arc/.local/state/vnc/x11vnc.log/home/arc/.local/state/vnc/boot.log
-
Notifier logs (from cron)
/home/arc/.local/state/vnc/notifier.log
If you previously used the systemd unit at
/etc/systemd/system/jetson-discord.service, disable it to avoid duplicate notifications:sudo systemctl disable --now jetson-discord.service
How it works
Boot notification
On startup (via cron), the script posts:
β
arc-mobile is online β’ IP: 172.17.xx.yySSH detection (login + disconnect)
- Follows
/var/log/auth.log(userarcmust be in groupadm). - On login, extracts client IP, resolves a label (name or IP), and posts:
π SSH login: DESKTOP-XYZ (172.17.xx.yy) - On disconnect, matches by
sshd[PID]and posts:π SSH disconnected: DESKTOP-XYZ (172.17.xx.yy)
Name resolution order:
- NetBIOS workstation name via
nmblookup -A <ip> getent hosts <ip>avahi-resolve-address <ip>- fallback to IP
VNC detection (noVNC + x11vnc)
- Connect events: parse
/home/arc/.local/state/vnc/novnc.loglines like:
172.17.xx.xx - - [...] Plain non-SSL (ws://) WebSocket connection
β resolve name/IP and post:π₯οΈ VNC connected: DESKTOP-XYZ (172.17.xx.yy) - Disconnect events: watch
/home/arc/.local/state/vnc/x11vnc.logfor βgone/closed/disconnectβ and post: (x11vnc sees localhost due to the proxy, so itβs used only for disconnect signals.)π VNC disconnected
Setup (one-time)
Install tools and permissions:
sudo apt-get update
sudo apt-get install -y samba-common-bin avahi-utils
sudo usermod -aG adm arc # allow reading /var/log/auth.logCreate an env file with your webhook and paths (example):
sudo tee /etc/jetson-discord.env >/dev/null <<'EOF'
DISCORD_WEBHOOK=https://discord.com/api/webhooks/REPLACE_ME
NOVNC_LOG=/home/arc/.local/state/vnc/novnc.log
X11VNC_LOG=/home/arc/.local/state/vnc/x11vnc.log
AUTH_LOG=/var/log/auth.log
HOST_MAP_PATH=/opt/jetson-notify/hosts.json
EOF
sudo chmod 600 /etc/jetson-discord.envCron wrapper:
sudo tee /opt/jetson-notify/run-notifier.sh >/dev/null <<'EOF'
#!/bin/bash
set -euo pipefail
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
if [[ -f /etc/jetson-discord.env ]]; then
set -o allexport
. /etc/jetson-discord.env
set +o allexport
fi
exec /usr/bin/python3 /opt/jetson-notify/jetson_discord_notify.py
EOF
sudo chmod +x /opt/jetson-notify/run-notifier.shUser crontab (shown as bash for Shiki compatibility):
crontab -e
# Add the following lines:
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
@reboot /home/arc/bin/wait_net_start_vnc.sh >>/home/arc/.local/state/vnc/boot.log 2>&1 &
@reboot /opt/jetson-notify/run-notifier.sh >>/home/arc/.local/state/vnc/notifier.log 2>&1 &Maintenance
-
Tail notifier output
tail -f /home/arc/.local/state/vnc/notifier.log -
Tail VNC stack logs
tail -f /home/arc/.local/state/vnc/novnc.log tail -f /home/arc/.local/state/vnc/x11vnc.log -
Pin stubborn device names (manual map)
sudo mkdir -p /opt/jetson-notify sudo nano /opt/jetson-notify/hosts.json # {"172.17.xx.yy":"DESKTOP-XYZ"}
Example notifications
Boot
β
arc-mobile is online β’ IP: 172.17.xx.yySSH
π SSH login: DESKTOP-XYZ (172.17.xx.yy)
π SSH disconnected: DESKTOP-XYZ (172.17.xx.yy)VNC
π₯οΈ VNC connected: DESKTOP-XYZ (172.17.xx.yy)
π VNC disconnectedNotes
- Using cron keeps the notifier in the same lifecycle as your VNC starter script and log files.
- If you ever switch back to systemd, remove the cron entry and re-enable the
jetson-discord.serviceunit, then manage it withjournalctl.