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%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-07 22:09:15 +02:00
maintenancebanner Changed author and url in manifest 2026-10-07 22:09:15 +02:00
README.md Commit 1.4 2026-10-07 15:28:19 +02:00

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 maintenance in 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

  1. 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.
  2. maintenance.get is 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.
  3. Maintenance tags (problem tags) are ignored.
  4. Expired maintenances (active_till in the past) are skipped; for the rest the next occurrence of every timeperiod (one-time / daily / weekly / monthly) is calculated in includes/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.