From f1591c19d972fd8d3c696fb1a0c064198d31e5f4 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Thu, 19 Nov 2026 13:48:25 -0500 Subject: [PATCH] Remove the cron health heartbeat from the top bar: the Cron Watch emails, the health address for an uptime monitor and the warnings on the Cron, Mail Queue and Backup pages stay --- CHANGELOG.md | 3 +-- admin/cron.php | 5 ++--- css/itflow_custom.css | 8 -------- functions/cron_health.php | 3 +-- includes/top_nav.php | 28 ---------------------------- 5 files changed, 4 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14bd5ba62..4a5166ef9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -91,7 +91,6 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Tickets: a note with time worked keeps when the work was done. Under Time worked, When it was worked has the date, start and end - filled in from the timer, ending now, until you type them, and typed times set the time worked, for a visit or a call written up later. The conversation shows it beside the time ("25m (Tue Nov 17, 2:05 - 2:30 PM)"), and Edit changes it: new times set the time worked, and a new time worked alone moves the start. An end before the start runs past midnight. A note with time worked needs a date, start and end to send. From Mountaineer IT's build of ITFlow. - Recurring tickets: on Schedule, Book the work for takes a time and Remote or Onsite - each ticket raised is booked for its run day at that time, with the emails, calendar invite and note booking it on the ticket gives. Make it ahead raises each ticket so many days before its run day, which stays the day the work is for - or so many days before the 1st of its month, so every run in a month is raised on one day (monthly and longer repeats). The window says when the next one will be made, and the list shows the time and days ahead. Raise now books the ticket for its run too. From Mountaineer IT's build of ITFlow. - Recurring invoices: Make it ahead makes each invoice so many days before its date, dated the day it's made, and Due, when made ahead sets it due on its date plus the client's terms, or on its date. With 0 days nothing changes. From Mountaineer IT's build of ITFlow. -- Maintenance > Cron: admins see a heartbeat in the top bar, beside the bell, when cron needs looking at - cron isn't running, it's switched off, or a job failed, is still running two hours after it started, or has fallen behind. Opening it lists what's wrong, with a job's error, and links to Maintenance > Cron. Nobody else sees it, and it's gone once all is well. From Mountaineer IT's build of ITFlow. - Maintenance > Cron: the new Cron Watch job, every 5 minutes, emails your admins when a job fails, gets stuck or falls behind - once when it starts, again once a day while it lasts, and once more when it's fixed. The Alerts card turns the emails off, sends them to other addresses instead, and sends a test. From Mountaineer IT's build of ITFlow. - Maintenance > Cron: an email can't say cron has stopped, since cron sends it. The Alerts card has a private health address for an uptime monitor such as Uptime Kuma or UptimeRobot: it answers OK while all is well and an error when cron isn't running or a job is in trouble. Check it every 5 minutes. Make a new address if the old one gets out. From Mountaineer IT's build of ITFlow. - Development mode, for a test copy of your ITFlow: turn it on in Admin > Backup before you restore production's backup onto a test server, and nothing reaches your clients, your team or the systems production talks to. Every email goes to a test inbox you give, with who it was for at the front of its subject. Texts wait in the queue, the ticket mailbox isn't read, AI Triage doesn't run, Stripe charges nothing (autopay included), nothing is done to RMM devices, log entries aren't sent to your syslog server, a managed ITFlow doesn't check in with its manager, and telemetry isn't sent. A red DEVELOPMENT badge shows in the top bar for everyone. It's kept in config.php rather than the database, so a restore can't turn it off. Never turn it on in production. From Mountaineer IT's build of ITFlow. @@ -270,7 +269,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Database 3.7.6: `config_quick_ticket_on`, `_assign` ('me', 'nobody' or a user id), `_status`, `_priority`, `_category`, `_billable` (-1 is `config_ticket_default_billable`), `_timer` (make, open or off), `_primary`, `_open_tickets` and `_email_client` in `settings`, read by `quickTicketSettings()` (`functions/quick_ticket.php`). `includes/top_nav.php` has the + (an `ajax-modal` of `agent/modals/ticket/ticket_quick.php`, with `agent/js/ticket_quick.js`) and the timers menu (`js/ticket_timers.js`, loaded from `includes/footer.php`). The window posts `add_ticket` with `quick_ticket`, plain-text `details` (made HTML by `quickTicketDetailsHtml()`), `status`, `category_id`, `billable` and `quick_ticket_timer`, the browser's clock in ms; `add_ticket` skips `ticketMailCreated()` when `_email_client` is off and calls `quickTicketAfterCreate()`, which logs the history line and keeps the start in the session for `quickTicketTimerScript()`, printed on the ticket page before `agent/js/ticket_time_tracking.js`. `agent/ajax.php`: `ticket_also_open` takes `work` (who has each, when it last moved, a Work on this one button with `data-ticket-work`, up to 10, and a line when there are none), `get_client_contacts` also returns `contact_phone` and `contact_mobile`, and `ticket_timer_tickets` returns the reference, subject, client and state of the tickets behind the timers the agent can open. The timers read and write the same `-startTime`, `-pausedTime` and `ticket-timer-running-` keys, and on the ticket's own page press its `#startStopTimer`. From Mountaineer IT's build of ITFlow. - Database 3.7.7: `recurring_tickets.recurring_ticket_schedule_time` (NULL books nothing), `_schedule_onsite`, `_lead_days` and `_lead_mode` (days or month), and `recurring_invoices.recurring_invoice_lead_days` and `_due_mode` (terms or next) - `recurringAheadReady()`. The nightly job takes recurring tickets by `recurringTicketDueSql()` and recurring invoices up to `recurring_invoice_lead_days` ahead, made with `recurringInvoiceGenerate()`'s `$early` when the date is still to come. `recurringTicketRunNow()` calls `recurringTicketBook()`, which books through `ticketSetSchedule()` for the run day at the time (today for a missed run), as "Recurring ticket" from the cron; `recurringInvoiceGenerate()` dates an invoice made ahead with lead days due by `recurringInvoiceAheadDue()`. Days ahead are kept short of one step by `recurringTicketLeadDays()` and `recurringInvoiceLeadDays()` (a month is 28 days, 90 at most; 27 before the 1st of the month, month-based repeats only). The fields are `schedule_time`, `schedule_onsite`, `lead_days` and `lead_mode` on the recurring ticket windows (`agent/includes/inc_recurring_ticket_ahead.php`), and `lead_days` and `due_mode` on the recurring invoice form; a post without `lead_days` keeps what is saved. From Mountaineer IT's build of ITFlow. - Database 3.7.8: `ticket_replies.ticket_reply_work_start` and `ticket_reply_work_end`, in company time - `ticketWorkTimesReady()`. `add_ticket_reply` takes `work_date`, `work_start` and `work_end` (`ticketWorkRange()`; an end before the start is the next day, under 24 hours) for a note with time worked, and `ticketWorkTimeWorked()` makes the time worked their length unless it agrees to the minute; without them, or from the bulk reply, the API or email, they stay NULL - it ended when it was posted. `edit_ticket_reply` takes the same fields: changed times set the time worked, the same times with a new time worked move the start, times left as `ticketWorkTimesShown()` filled them on a note without any keep it without, and no time worked clears them. The reply box's time row is Time worked and When it was worked, above Status and Send; `agent/js/ticket_work_times.js` follows `#hours` / `#minutes` / `#seconds` from `ticket_time_tracking.js` (at least a minute), in company time from `#workTimes` `data-now`, and refuses the form in the capture phase, before the timer resets, when a note with time worked has no valid times. From Mountaineer IT's build of ITFlow. -- Database 3.7.9: `config_cron_alert_email` (default 1), `config_cron_alert_to`, `config_cron_health_key` and `config_cron_alert_state` (JSON: `sent`, each problem's key and when it was last emailed; `waiting`, each job that is on and has never run and since when) - `cronHealthReady()`. `functions/cron_health.php`: `cronHealthProblems()` reads the heartbeat, `config_enable_cron` and each enabled registry job's row (not those a manager has paused) into problems with a key, kind (`not_running`, `off`, `failed`, `stuck` after `CRON_HEALTH_STUCK_MINUTES`, `overdue` - past two intervals and at least ten minutes over, or two hours past a daily time; a job never run is late once `waiting` is older than that), text and error. `includes/top_nav.php` shows them to admins as `#itflowCronHealth`. `cron/cron_watch.php` is the `cron_watch` job, every 5 minutes: `cronHealthWatch()` records `waiting`, then emails the problems that are new, a day old or gone with `cronHealthAlert()` through `cronHealthMail()` (`emailQueue()`, to `config_cron_alert_to`, else active admins - `cronHealthRecipients()`), leaving out `not_running` and its own; Admin > Mail previews it as `cron_alert`. `health.php` answers 200 `OK` or 503 with a line per problem, given `config_cron_health_key` as `?key=` or an `X-Health-Key` header, and 403 otherwise. `admin/post/cron.php` has `edit_cron_alerts`, `test_cron_alert` (to the addresses typed) and `renew_cron_health_key`, locked in the demo. From Mountaineer IT's build of ITFlow. +- Database 3.7.9: `config_cron_alert_email` (default 1), `config_cron_alert_to`, `config_cron_health_key` and `config_cron_alert_state` (JSON: `sent`, each problem's key and when it was last emailed; `waiting`, each job that is on and has never run and since when) - `cronHealthReady()`. `functions/cron_health.php`: `cronHealthProblems()` reads the heartbeat, `config_enable_cron` and each enabled registry job's row (not those a manager has paused) into problems with a key, kind (`not_running`, `off`, `failed`, `stuck` after `CRON_HEALTH_STUCK_MINUTES`, `overdue` - past two intervals and at least ten minutes over, or two hours past a daily time; a job never run is late once `waiting` is older than that), text and error. `cron/cron_watch.php` is the `cron_watch` job, every 5 minutes: `cronHealthWatch()` records `waiting`, then emails the problems that are new, a day old or gone with `cronHealthAlert()` through `cronHealthMail()` (`emailQueue()`, to `config_cron_alert_to`, else active admins - `cronHealthRecipients()`), leaving out `not_running` and its own; Admin > Mail previews it as `cron_alert`. `health.php` answers 200 `OK` or 503 with a line per problem, given `config_cron_health_key` as `?key=` or an `X-Health-Key` header, and 403 otherwise. `admin/post/cron.php` has `edit_cron_alerts`, `test_cron_alert` (to the addresses typed) and `renew_cron_health_key`, locked in the demo. From Mountaineer IT's build of ITFlow. - Development mode (`functions/dev_mode.php`): `$config_dev_mode` and `$config_dev_mail_to` in config.php - `devModeOn()`, `devModeMailTo()`. `edit_dev_mode` (`admin/post/backup.php`, locked in the demo) writes both with `devModeConfigSet()`, which replaces each line or adds them at the end and invalidates opcache; when config.php can't be written, Admin > Backup shows the lines to add. `sendQueueEmail()` (`cron/mail_queue.php`) sends to `devModeMailTo()` with `[DEV to ]` in front of the subject, and with no test inbox the queue is cancelled as in the demo. `includes/stripe_init.php` calls `devModeBlockStripe()`, a `\Stripe\ApiRequestor::setHttpClient()` client that throws `ApiConnectionException`. `smsSendQueued()` leaves a text queued, `rmmDeviceAct()` refuses, `managedHttpJson()` answers not ok, and `logForwardQueue()` and `logForwardSend()` send nothing. `cron/ticket_email_parser.php`, `ai_triage.php`, `sms_queue.php`, `payment_provider_fees.php`, `manager_checkin.php` and `managed_instances.php` stop with `cronJobStop("Development mode - ...")`; `cron/nightly_tasks.php` skips autopay and telemetry. `includes/top_nav.php` shows `[data-dev-mode]`, a link to `admin/backup.php#dev-mode` for admins. From Mountaineer IT's build of ITFlow. - Restoring from Maintenance > Backup (`functions/backup_restore.php`): `restore_backup` (`admin/post/backup.php`) checks the password and RESTORE, then `backupRestoreQueue()` checks the archive with `backupRestoreCheck()` (`backupInspectArchive()`, refused when its database version is newer) and the disk (three times its size), writes `restore_queued.json` beside the backups - another install's key sealed with this one's (`backupRestoreSealKey()`, AES-256-GCM) - and `restore_status.json`, and sets the Backup job's `cron_job_run_now`. `cron/backup.php` calls `backupRestoreRunQueued()` after the queued backups: it deletes the request first, refuses one older than `BACKUP_RESTORE_WAIT_MINUTES`, makes a Full Backup with source `Before restore`, runs `backupRestoreArchive()`, puts that row and the restored one back in the restored `backups` (others found again by retention), marks `Running` and `Pending` rows `Failed`, runs `scripts/update_cli.php --update_db`, records the outcome and sets `$cron_dispatch_stop_cycle`. `cron/cron.php` exits before its heartbeat while `backupRestoreInProgress()`. `cancel_restore` removes a request. Uploads: `backup_upload` in one request, or `backup_upload_start`, `backup_upload_chunk` and `backup_upload_finish` from `js/backup_restore.js` (JSON, the upload in the session, pieces of `backupRestoreChunkBytes()` appended to `upload_.part`, retried smaller when a proxy refuses), then `backupRestoreAdopt()` lists it with source `Uploaded`. The Restore window is `admin/modals/backup/backup_restore.php`, opened from a row's menu or by `?restore=`; `backupMadeBy()` words a row's source. All locked in the demo. From Mountaineer IT's build of ITFlow. - Database 3.8.0: `user_cost_rates` (`user_cost_rate_user_id`, `_from`, `_hourly`, `_created_by`, `_created_at`, one a day per agent) and `config_labor_cost_default` (NULL leaves time uncosted) - `laborCostReady()`. `functions/labor_cost.php`: `laborCostRates()`, `laborCostRateOn()` (the newest rate on or before the day, the first also before it, else the default), `laborCostRateSave()`, `laborCostRateDelete()`, `laborCostParse()`. `admin/labor_costs.php`, `admin/modals/labor_cost/labor_cost_rates.php` and `labor_cost_default.php`, handlers `add_labor_cost_rate`, `delete_labor_cost_rate` and `edit_labor_cost_default` (`admin/post/labor_cost.php`). `agent/reports/client_profitability.php` calls `laborProfitAdd()` before net - `?basis=invoiced` replaces income with `item_subtotal` less `invoice_discount_amount` on Sent, Viewed, Partial and Paid invoices by `invoice_date`, plus revenue; labor by `ticket_reply_by` and day; parts as `product_cost * item_quantity` - and `laborProfitFinish()` after it for profit, margin, `hours_month` and `break_even`; the columns, totals, basis switch (`laborProfitBasis()`, paid by default) and second stats row are there only with 3.8.0. From Mountaineer IT's build of ITFlow. diff --git a/admin/cron.php b/admin/cron.php index 68fab59b2..841b1b881 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -515,15 +515,14 @@ $status_looks = [ $alert_admins = $alert_to === '' ? cronHealthRecipients('') : []; $health_url = cronHealthUrl(); $watch_on = !empty($jobs['cron_watch']['enabled']); ?> - +

Alerts

- When cron stops, or a job fails, gets stuck or falls behind, admins see in the top bar. - The Cron Watch job also emails about it - when it starts, once a day while it lasts, and when it's fixed. + When a job fails, gets stuck or falls behind, the Cron Watch job emails about it - when it starts, once a day while it lasts, and when it's fixed.

Cron Watch is off, so no alerts are emailed - turn it on in Jobs.

diff --git a/css/itflow_custom.css b/css/itflow_custom.css index fcd9767ec..5c1a3c398 100644 --- a/css/itflow_custom.css +++ b/css/itflow_custom.css @@ -2488,14 +2488,6 @@ body { font-variant-numeric: tabular-nums; font-weight: 600; } -/* Cron health in the top bar (functions/cron_health.php) - a problem a row */ -.itflow-cron-row { - padding: .6rem 1rem; - border-bottom: 1px solid var(--bs-border-color); -} -.itflow-cron-row:last-child { - border-bottom: 0; -} /* Quick ticket's list of the contact's open tickets - a long one scrolls in place */ .itflow-also-open-list { max-height: 15rem; diff --git a/functions/cron_health.php b/functions/cron_health.php index be6751dd5..c5eff2e44 100644 --- a/functions/cron_health.php +++ b/functions/cron_health.php @@ -5,8 +5,7 @@ * * Is cron running, and is every job that's on keeping up? Maintenance > Cron * already records each job's last run, how it went and its error (cron_jobs); - * this reads them and says so where people look: - * - a warning in the top bar for admins (includes/top_nav.php), + * this reads them and says so: * - an email when a job fails, gets stuck or falls behind, again once a day * while it lasts, and when it's fixed (the Cron Watch job, cron/cron_watch.php), * - a health address for an uptime monitor (/health.php) - the only thing diff --git a/includes/top_nav.php b/includes/top_nav.php index cc794fe19..c00520f72 100644 --- a/includes/top_nav.php +++ b/includes/top_nav.php @@ -117,34 +117,6 @@ - - - - - -