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:
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:
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:
Notification Workflow¶
Monitoring follows the same flow:
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.