Skip to content

Telegram Bot

Yousef Ghadiri edited this page May 28, 2026 · 2 revisions

Telegram Bot

Knightwatch includes a Telegram bot for remote monitoring and alerting without opening the web dashboard.

Setup

Store your bot token in persistent config:

knightwatch config set telegram-token <YOUR_BOT_TOKEN>

Clear it if needed:

knightwatch config set telegram-token --clear

Verify it was saved:

knightwatch config get telegram-token

Enabling

Pass the --telegram flag at runtime:

knightwatch --pid <PID> --telegram

Notifications

The bot sends push notifications for all process events when tracking at least one process:

  • 🟒 Initial snapshot β€” root and children when tracking begins
  • πŸ†• Children appeared β€” new child processes detected
  • πŸ”΄ Children exited β€” specific child PIDs exited
  • βœ… All children gone β€” all child processes have exited
  • πŸ’€ Root process exited β€” the root process itself has stopped

When --system-resources is also enabled:

  • ⚠️ CPU threshold exceeded β€” aggregate CPU usage above 90%
  • ⚠️ Memory threshold exceeded β€” memory usage above 90%
  • ⚠️ Disk threshold exceeded β€” a mount point usage above 90%
  • πŸ”‹ Battery low β€” charge below 15% while discharging
  • πŸ”Œ Battery state changed β€” plugged in, unplugged, or full

When --systemd is also enabled:

  • πŸ”΄ Unit failed β€” a unit transitioned to failed
  • 🟒 Unit recovered β€” a previously failed unit is active again
  • πŸ†• Unit appeared β€” a new unit became visible to systemd
  • πŸ’¨ Unit disappeared β€” a tracked unit is no longer present

Clone this wiki locally