-
Notifications
You must be signed in to change notification settings - Fork 0
Notifications
app/Console/Commands/NotificationMonitor.php — a scheduled task (routes/console.php) that runs every minute, evaluating every active row in the notifications table against its type-specific check, and sending a Telegram message on every state change (idle ↔ alert).
| Type | Method | Evaluation logic |
|---|---|---|
| Ping | ping() |
≥50% of ICMP packets must succeed |
| Socket Polling | socketPolling() |
a TCP connection to the given IP:port must succeed |
| Sensor Value | checkSensorValue() |
arithmetic expression against an externally reported value |
| BigLan Command | biglanCommand() |
arithmetic expression against the result of a Command Center script previously run on a given workstation |
| SNMP |
snmp() / snmpQuery()
|
arithmetic expression against an SNMP OID value queried at the given IP |
| HTTP Status Code | httpStatusCode() |
arithmetic expression against the HTTP response code |
| Mass Heartbeat Loss | massHeartbeatLoss() |
number of workstations that became unreachable within the same 2-minute window |
Arithmetic expressions (e.g. > 90, == 1) are all evaluated by the shared evaluateExpression() helper — used by four of the types above (checkSensorValue, biglanCommand, snmp, httpStatusCode).
sendMessage() posts to the Telegram Bot API, using the telegram-bot-token/telegram-chat-id values from Global Settings. newNotificationLog() records the alert/recovery event (shown via the "View Notification Log" button).
For Ping or Socket Polling alarms, runNmap() automatically runs an nmap scan against the target and attaches the output to the log entry — helping diagnose the cause immediately, without manual investigation.
Originally, nothing prevented two NotificationMonitor runs from overlapping (e.g. if a run took longer than 60 seconds due to slow ping/nmap checks) — both runs would read the same "idle" state and both would send the alert/recovery message, duplicating it. Fixed by adding withoutOverlapping()->onOneServer() to the scheduled task definition in routes/console.php. See Known Limitations if this behavior ever returns (e.g. if these switches are ever removed in a future change).