Skip to content

Task 9 — Telegram Notification System

Overview

A Telegram bot is used to send real-time notifications to the project team.

The bot receives messages from different parts of the system, allowing users to quickly respond to security events and monitor the health of the Raspberry Pi cluster.


Architecture

graph TD

A[Sensor Node<br/>Threat Detection]
--> B[Flask Backend]

B --> C[Telegram Bot]

D[Cluster Monitoring]
--> C

E[Prometheus<br/>Alertmanager]
--> C

C --> F[Team Telegram Group]

Notification Sources

The Telegram bot receives notifications from three different system components.

Source Trigger Notification
Flask Backend Threat detected Evidence image with threat information
Cluster Monitoring Node status changes Worker online/offline message
Alertmanager Infrastructure alert CPU, memory, storage, or service alerts

Threat Detection Notifications

When the AI system detects a threat:

  • The backend stores the event.
  • The evidence image is saved.
  • A Telegram notification is sent to the team.

The notification includes:

  • Evidence image
  • Sensor ID
  • Threat level
  • Detected objects
  • Detection time

Example:

Threat Detected

Sensor: Camera 1
Threat: Fire
Confidence: 96%
Time: 14:30

Cluster Status Notifications

The monitoring service continuously checks the status of every Raspberry Pi node.

If a node:

  • disconnects
  • reconnects

a notification is sent to Telegram.

Example:

Cluster Update

Worker 3 is Offline

Time: 14:35

Infrastructure Alerts

Prometheus and Alertmanager monitor the overall system health.

Alerts can be generated for:

  • High CPU usage
  • High memory usage
  • High temperature
  • Disk usage
  • Unreachable services

Example:

System Alert

High CPU Usage

Worker 5

CPU: 95%

Notification Workflow

Threat Detection
        |
        |
Flask Backend
        |
        |
Telegram Bot
        |
        |
Team Group

Monitoring follows the same flow:

Node Exporter
        |
Prometheus
        |
Alertmanager
        |
Telegram Bot
        |
Team Group

Summary

The Telegram notification system provides:

  • Real-time threat alerts
  • Evidence image sharing
  • Cluster status updates
  • Infrastructure monitoring alerts

This enables the team to quickly monitor system activity and respond to important events.