Your Server, Your Phone: Mastering Infrastructure with the Telegram Monitoring Suite
In the world of system administration, the difference between a minor hiccup and a major catastrophe is often response time. Traditional monitoring tools can be bulky, expensive, or hidden behind complex dashboards. However, by leveraging the versatility and responsiveness of Telegram bots, you can transform your server into a proactive communicator that keeps you informed wherever you are.
Telegram offers unparalleled accessibility; whether you are on a mobile device, a desktop app, or a web interface, your server’s health is always one notification away. Below is an introduction to a suite of four powerful scripts that turn Telegram into the ultimate infrastructure dashboard.
1. The "Safe" Web Watchdog: Domain Uptime Monitoring
The first line of defense is the Safe Web Watchdog. Automated via system cron to run at regular intervals, this script performs non-destructive health checks on your primary domains.
What makes this script efficient is its state management. It records the status of each domain in a local file, ensuring that it only sends a Telegram alert when a site’s status changes (e.g., from UP to DOWN). This eliminates "alert fatigue," so you only hear from your bot when action is actually required.
2. The Stateful System Watchdog: Self-Healing Connectivity
While monitoring is great, automated recovery is better. The WireGuard and NFS Stateful Watchdog (pi_watchdog_auto.sh) is designed to monitor critical backend infrastructure like VPN tunnels and network mounts.
This script is highly responsive: if it detects that a WireGuard tunnel is down, it doesn't just alert you—it attempts to restart the service automatically. It then waits for a short period to verify if the fix worked before sending a final status report to your Telegram chat. This self-healing capability ensures that minor connectivity blips are resolved before you even have a chance to unlock your phone.
3. Apache Security & Traffic Monitor: The Daily Deep-Dive
Understanding your traffic patterns is essential for security. The Apache Security and Traffic Monitor provides a comprehensive 24-hour summary of your web server's activity.
This script goes beyond simple counts; it uses advanced log filtering to separate likely humans from known bots based on browser patterns and crawler signatures. Every night, it sends a beautifully formatted Markdown report to Telegram, highlighting unique visitors, 403 forbidden errors, and suspicious "scan attempts" targeting sensitive paths like .env or wp-admin. It even provides a color-coded Security Status—Green for all clear, and Red when attention is needed.
4. The Drupal Event Tracker: Real-Time Application Insights
Finally, for those who need to know exactly who is hitting their site the moment it happens, there is the Drupal Telegram Tracker Module. Unlike the other scripts that run on a schedule, this is an Event Subscriber that lives inside the Drupal CMS.
Whenever a visitor—or a bot like ClaudeBot—accesses a page, the module intercepts the request and instantly captures the Path, Method, IP, and User Agent. This provides an immediate, granular look at application-level traffic that system-level logs might miss.
Conclusion: Why Telegram?
The adaptability of this suite highlights why Telegram is the premier choice for modern monitoring:
- Unified Interface: System health, network connectivity, security audits, and real-time traffic all arrive in a single, searchable chat history.
- Native Push Notifications: You don't need to poll a dashboard; the information finds you.
- Lightweight Efficiency: These scripts use standard system tools like
curl,awk, andgrep, requiring almost zero overhead on your server.
By implementing these four scripts, you move from reactive troubleshooting to proactive infrastructure management, all through the convenience of a Telegram bot.
