Banner widget that finds the next due (or currently running) maintenance for a filtered
set of hosts and shows a live countdown with colour thresholds.
- PHP 64%
- JavaScript 36%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| maintenancebanner | ||
| README.md | ||
Maintenance banner - Zabbix 7.4 custom widget module
Banner widget that finds the next due (or currently running) maintenance for a filtered set of hosts and shows a live countdown with colour thresholds.
What it shows
Maintenance for: rmsdns01 - 1d 12h 45m 23s
Starts 2026-10-08 02:00
- Upcoming: countdown to the start, second line
Starts <time>; background colour comes from the thresholds (time remaining until start -> colour). - Active: countdown to the end, second line
Ends <time>; one fixed "active" colour. - None:
No upcoming maintenancein a fixed neutral colour. - Times are formatted on the server as
YYYY-MM-DD HH:MM(24 h) in the Zabbix user's timezone. The countdown ticks in the browser every second; the normal refresh cycle (60 s) re-syncs the data. - Host label: one host -> its name, two -> both, more ->
first +N(tooltip lists up to 20). - Text colour switches between white and dark depending on the background, and the font scales to the widget size.
- Optional click-through URL wraps the whole banner (static URL only).
- Option "Also show end time (upcoming maintenance)" appends
. Ends <time>to the second line of an upcoming maintenance (default off).
How hosts and maintenances are matched
- Hosts = Host groups AND Hosts AND Tags (host tags) from the widget config; at least one filter is required. A parent host group also matches hosts in its subgroups.
maintenance.getis queried for those hosts directly and for all of their host groups including parent groups ("A/B" is covered by a maintenance on "A"), results merged.- Maintenance tags (problem tags) are ignored.
- Expired maintenances (
active_tillin the past) are skipped; for the rest the next occurrence of every timeperiod (one-time / daily / weekly / monthly) is calculated inincludes/MaintenanceCalculator.php. An active window beats an upcoming one, otherwise the soonest start wins.
Thresholds
Rows of colour + threshold; the threshold is a time (3600, 1h, 30m, 2d; suffixes
s/m/h/d/w). The first row (ascending by time) whose threshold is >= the remaining time decides
the colour. If the remaining time is above every row, the "no upcoming maintenance" colour is
used - so add a row with a large threshold (e.g. 365d) if far-away maintenances should have
a colour of their own.
Files
manifest.json widget registration, refresh rate, JS asset
Widget.php widget class, state constants
includes/WidgetForm.php config form fields
includes/MaintenanceCalculator.php next-occurrence maths
actions/WidgetView.php data provider (hosts, maintenances, winner, host names)
views/widget.view.php body container + setVar() hand-over to the JS
views/widget.edit.php config form rendering
assets/js/class.widget.js rendering, countdown, text fitting
Install
Copy the maintenancebanner/ directory to ui/modules/ on the Zabbix frontend, then
Administration -> General -> Modules -> Scan directory and enable it.