Setting up Failure Alerts for 1C-Bitrix
Your Bitrix site crashes, and you learn about it from a customer who couldn't place an order. Typical situation: error 500 hangs for three hours until a manager accidentally visits the site. Built-in Bitrix monitoring via monitoring module is only available in «Business» and higher editions, and even then it doesn't cover all scenarios. Let's explore how to build a notification system that reacts to failures in seconds, not hours.
What Exactly to Monitor
Minimum control points:
-
HTTP-status of main and critical pages — catalog, cart, checkout. If
/catalog/returns 200 but/personal/order/make/— 500, general healthcheck on homepage shows nothing. -
Cron health — Bitrix agents (
/bitrix/modules/main/tools/cron_events.php) should execute regularly. Checked by last successful run date inb_agenttable. - MySQL/MariaDB availability — check not just connection, but execute test SELECT. Bitrix on DB loss shows white screen without logging.
-
Free disk space — when
/tmpor/upload/partition fills, site starts throwing write errors for sessions and cache. -
error.log size — sudden growth of
/var/log/php-fpm/error.logor/bitrix/modules/main/tools/log.txtsignals problem before it becomes visible to users.
Built-in Bitrix Tools
Module monitoring (if available) configured in Settings → Monitoring. Can check site availability by HTTP, track agents, send email notifications. Limitations: works only with live PHP, doesn't check external dependencies, doesn't integrate with messengers without customization.
More useful is Event Log (b_event_log). Via API CEventLog::Add() you can log custom events, and via filters in admin — set notifications for certain severity.
External Monitoring — Main Channel
Reliable setup built on external service that polls site from outside. Working options:
| Tool | What checks | Notification channels |
|---|---|---|
| UptimeRobot (free) | HTTP-status, keyword check | Email, Telegram, Slack, webhook |
| Healthchecks.io | Cron tasks (dead man's switch) | Email, Telegram, PagerDuty |
| Zabbix / Prometheus + Alertmanager | Everything: HTTP, disk, CPU, logs | Any via integrations |
For small projects UptimeRobot with checks every 5 minutes + Healthchecks.io for cron is enough. For medium and large — Prometheus with blackbox_exporter for HTTP probes and node_exporter for server metrics.
Implement Healthcheck Endpoint
Create /healthcheck.php file in site root, which checks key subsystems:
- DB connection via
$DB->Query("SELECT 1") - memcached/redis availability via
CBitrixCache - write to temp directory
- license key presence (check
CModule::IncludeModule('main'))
If all checks pass — return HTTP 200 with body OK. Any failure — HTTP 503. External monitoring hits this endpoint and reacts to non-200 status.
Telegram Notifications
For Bitrix24 there's built-in webhook integration. For 1C-Bitrix sites easiest to send alerts via Telegram Bot API directly from error handler. In init.php register custom handler via set_exception_handler(), which on critical errors sends POST request to api.telegram.org/bot{TOKEN}/sendMessage.
Don't send every error — use throttling: not more than one message per 5 minutes per error type. Otherwise on mass failure Telegram will block bot for spam.







