Repository navigation
Zabbix Integration Developer Guide
How the Zabbix integration works, where it lives, and the traps. The user page is Zabbix.
Contributed by Carl Steynvaard (Open Resilience), October 2026, as part of a package of integrations and modules he built and ran in production on FreeITSM 3.8.1. The design β what happens on a problem, a repeat and a recovery, and the event log β is his. The code was rebuilt to FreeITSM's conventions; what changed and why is worth reading before contributing an integration of your own.
Zabbix ββwebhook media typeβββΆ api/external/zabbix/alert.php βββΆ zabbixHandleEvent() includes/integrations/zabbix.php
(POST JSON, token) β
ββ problem β TicketsService::createTicket + ticket_cmdb_objects
ββ repeat β a message on the ticket's thread
ββ recovery β a message + TicketsService::updateTicket(status)
ββ always β a row in zabbix_events
System β Integrations β Zabbix (system/integrations/zabbix.php) βββΆ api/system/zabbix_settings.php (administrators)
Nothing calls Zabbix. It is a monitoring-kind provider in the registry (includes/integrations/integrations.php): one endpoint and one token, so the Integrations index shows it as Configured / Not set up, like Tika, rather than counting connections.
| File | What it is |
|---|---|
includes/integrations/zabbix.php |
Everything: settings and defaults, the token, CMDB matching, zabbixHandleEvent()
|
api/external/zabbix/alert.php |
The endpoint Zabbix calls. POST JSON only; checks the token; 64 KB limit |
api/system/zabbix_settings.php |
The settings page's API: get, save, rotate, test, export (the import file). Administrators only |
system/integrations/zabbix.php |
The settings page |
system/integrations/help_zabbix.php |
The in-app setup guide, included by help.php
|
zabbix_events (table) |
Every event received: problem_id, event_value, host, trigger, severity, the ticket, the action taken, a detail
|
tests/zabbix-integration.php |
34 checks through the real endpoint and the settings API with events shaped as the media type sends them |
tests/zabbix/run.php + docker-compose.yml
|
12 checks against a real Zabbix 7.0 in Docker, through the imported media type |
Settings are system_settings rows: zabbix_token (encrypted β it is in ENCRYPTED_SETTING_KEYS), zabbix_requester_email, zabbix_requester_name, zabbix_tenant_id, zabbix_priority_map (JSON, severity β priority id), zabbix_resolve_status_id (0 = leave the status alone), zabbix_team_id, zabbix_origin_id, zabbix_link_cmdb.
The media type's parameters are endpoint and token (this install's), then Zabbix macros: event_id = {EVENT.ID}, event_value = {EVENT.VALUE} (1 problem, 0 recovery), severity = {EVENT.NSEVERITY}, host = {HOST.NAME}, trigger = {EVENT.NAME}, message = {ALERT.MESSAGE} and url = {$ZABBIX.URL}/tr_events.php?β¦ β the link back, which is empty (and dropped) unless the {$ZABBIX.URL} macro is set in Zabbix. The last, http_proxy, is empty unless Zabbix must reach FreeITSM through a proxy; the script calls req.setProxy() only when it is filled in. The script posts the event to endpoint as JSON, renaming event_id to problem_id, and throws on any answer but 200, so a failure shows in Zabbix's action log with FreeITSM's own words.
-
zabbixOpenTicketFor($problemId)β the latest logged event for this problem that has a ticket, if that ticket still exists, is not merged and is not closed. -
Recovery β a message on the thread, then
TicketsService::updateTicket(['status_id' => β¦]). A closure rule may refuse; the ticket stays open and the refusal goes in the log'sdetail. - Repeat or update (value 1, open ticket) β a message on the thread.
-
New problem β CMDB match, company, then
TicketsService::createTicket()with the mapped priority, the configured team and origin, then the CMDB link.
Every outcome is logged. A GET_LOCK on the problem id serialises a problem and its first repeat arriving together, which would otherwise open two tickets.
Zabbix sends a recovery with the problem's {EVENT.ID}, not a new one β that is the only reason a recovery can find its ticket. It is documented, but it is exactly the kind of thing worth proving rather than trusting, so tests/zabbix/run.php asserts it against a real Zabbix: the recovery's problem_id equals the problem's, and it resolves the ticket the problem opened.
zabbixMediaTypeScript(), zabbixMediaTypeParameters() and zabbixMediaTypeTemplates() in includes/integrations/zabbix.php are the only copy. The settings page shows them for setting up by hand, zabbixMediaTypeYaml() turns them into the import file (export action, Download for Zabbix import), and tests/zabbix/run.php downloads that file from the real API and imports it into a real Zabbix β so what is tested is exactly what an administrator imports.
The file's shape is Zabbix 7.0's own configuration.export output, taken from a real server rather than the documentation: type: WEBHOOK; a parameter with an empty value is written with no value: line; timeout (30s) and status (enabled) are omitted because they are the defaults; message templates are event_source: TRIGGERS with operation_mode PROBLEM / RECOVERY / UPDATE. Values are single-quoted with '' for a quote; the script and messages are literal blocks.
export action is administrators-only and sends Cache-Control: no-store.
Send a test alert and Send the recovery on the settings page: action: 'test' sends a problem (step: 'problem', a fresh id freeitsm-test-<8 hex>, host freeitsm-test) and then its recovery (step: 'recovery') through zabbixHandleEvent() itself β the same path a real alert takes, so it proves the settings and the incident they produce rather than a pretend route. The recovery step accepts only an id of that shape, so the button can never recover a real problem. It deliberately does not go through the HTTP endpoint: a server often cannot reach its own public address (hairpin NAT), and a failure there would say nothing about Zabbix. The network half belongs to Zabbix's own Test button, and the page says so.
-
TRAP: never guess between companies when matching a host. Two companies may each have a
web01. Several matches β the one in the configured company if exactly one is, otherwise none. Linking either would put one company's alert on the other's server. - The company comes from the server, not a setting. An alert about a client's server belongs in that client's queue. The setting is only the fallback for a host the CMDB does not know.
-
No priority names. The default map reads this install's priorities by
display_order(higher = more urgent, as Watchtower reads it): Disaster β the most urgent, High β the next, Average β the default, the rest β the least. The contributed version looked forP1 - Critical, which no stock install has. -
Repeats and recoveries are thread messages, not notes.
ticket_notes.analyst_idisNOT NULL, and there is no analyst β the actor isActorContext::system('Zabbix'). A message from the monitoring requester is also simply what a monitoring system that emails the desk looks like, which is where an analyst reads. The text is stored escaped (nl2br(htmlspecialchars())) β it came from outside. -
The default requester cannot receive mail (
zabbix@monitoring.invalidβ.invalidis reserved and never routes), so an auto-acknowledge workflow onticket.createdemails nobody. - A link that is not http(s) is dropped, not shown β the URL parameter is Zabbix-supplied text.
-
The endpoint is on
CSRF_EXEMPT_PATHS(api/external/): Zabbix is cross-origin by design and never carries a login cookie. The token is the credential, compared withhash_equals, and an install with no token yet refuses everything rather than comparing against an empty string.
The contributed code worked in the production it was written for. It could not work in FreeITSM as shipped, and the reasons are the ones any integration has to get right:
| The contribution | Here | Why |
|---|---|---|
Settings and the event log in a separate SQLite file at /var/www/data
|
system_settings and a zabbix_events table |
A Linux-only path, outside backups and Database Verification; the token stored readable |
Tickets in "the first company" (ORDER BY id LIMIT 1) |
The server's company, else the configured one | On a multi-company install every alert landed in one company |
Priorities by name (P1 - Critical) |
By display_order, chosen on the page |
Stock installs have Lowβ¦Urgent |
| Acted as the lowest-numbered analyst | ActorContext::system('Zabbix') |
That is usually the administrator β every note looked as if the admin wrote it |
Requester monitoring@example.com
|
A configurable address, defaulting to .invalid
|
example.com is somebody's real domain to a mail server |
| Repeats as internal notes | Thread messages | No analyst to own a note (see above) |
| Its own admin check and CSRF token; hard-coded English |
admin_api_guard.php, the app's CSRF, t()
|
One implementation of each |
Installed by patching core files (register-patch.php) |
A registry entry | A patch that edits upstream files breaks on every upgrade |
Without Zabbix: php tests/zabbix-integration.php β token required (and a GET refused), problem β incident with the mapped priority and the CMDB link, repeat β same ticket, recovery β resolved, unknown host, severity by name, markup stored as text, a bad link dropped, the log. Pauses ticket.created workflows so nobody is emailed, and removes everything it makes.
Against a real Zabbix:
docker compose -f tests/zabbix/docker-compose.yml up -d # Zabbix 7.0 LTS: server, web (http://localhost:8086, Admin / zabbix), MySQL
php tests/zabbix/run.php
docker compose -f tests/zabbix/docker-compose.yml down -v # when finishedrun.php downloads the import file from the real settings API and imports it into Zabbix (renamed for the run, so it never touches a media type somebody made), then builds a host, a trapper item, a Disaster trigger, an alert user and an action β then pushes 97 into the item (problem), acknowledges it (update), pushes 40 (recovery), and checks FreeITSM at each step. When nothing arrives it prints Zabbix's own view β the item, the problem and the alert's error β which is how both setup traps below were found:
-
A media type created through the API starts disabled in Zabbix 7 (Media type disabled in the action log). An imported one is enabled - the import file leaves
statusat its default. - Zabbix never notifies the user who made an update. Acknowledging as the same user the alerts go to produces no update at all, so the run sends alerts to a user of its own. The help page tells administrators the same.
Zabbix reaches FreeITSM on the host through host.docker.internal, so the web server must listen beyond 127.0.0.1. Override with ZABBIX_TO_FREEITSM, ZABBIX_API and ZABBIX_SERVER_CONTAINER.
Related: Zabbix Β· External issue trackers β Developer Guide Β· CSRF protection β Developer Guide Β· Developer Tests
FreeITSM β an open-source IT Service Management platform Β· github.com/edmozley/freeitsm Β· MIT licence
- Installation
- β° Scheduled tasks (cron jobs)
-
Architecture
- β³ π§Ή Root folder tidy (URL routing)
- β³ π Database Integrity (FKs & constraints)
- β³ π οΈ Database Verification β Developer Guide
- β³ π§© Service Layer (UI + API share code)
- β³ πͺ€ Code traps (the TRAP: comments)
- β³ π Commenting for the Engineering wiki
- β³ π οΈ Engineering wiki scanner - Developer Guide
- β³ π Service-Layer progress
- π€ Contributing (read before a pull request)
- π§ͺ Developer tests
- AI Providers
- Internationalisation (i18n)
- Timezones & Time Handling
- π Date & Time Formats
- π± Currencies
- π§ The sidebar (optional module rail)
- π§© Preference templates
- π Display order (modules, Watchtower cards) β Developer Guide
- Theming & Dark Mode
- ποΈ Recent β getting back to what you were doing
- β¨οΈ Command palette (βK)
- π Searching inside tickets
- π Attached documents
-
MobileβFriendly
- β³ π« Mobile: Tickets
- β³ π» Mobile: Assets
- β³ π Mobile: Calendar
- β³ π Mobile: Knowledge
- β³ π¦ Mobile: Service Status
- β³ πΌ Mobile: Watchtower
- β³ π§© Mobile: Problem Management
- β³ π Mobile: Change Management
- β³ πΏ Mobile: Software
- β³ β Mobile: Tasks
- β³ π Mobile: Forms
- β³ π Mobile: Contracts
- β³ π Mobile: Domains
- β³ π Mobile: People
- β³ π Mobile: Projects
- β³ ποΈ Mobile: Files
- β³ π Mobile: LMS
- β³ πΊοΈ Mobile: CMDB
- β³ πΊοΈ Mobile: Network Mapper
- β³ π§ Mobile: Process Mapper
- β³ βοΈ Mobile: Workflow
- β³ π₯οΈ Mobile: System
- β³ π Mobile: Reporting
- β³ π Mobile: System Wiki
- β³ π Mobile: Self-Service Portal
- β³ π§° Mobile: Techniques & Tricks
-
Security
- Layer 1 β which modules you can enter
- β³ π§© Module Access Control
- β³ π οΈ Module Access β Developer Guide
- Layer 2 β what you can administer
- β³ π Roles & Permissions
- β³ π οΈ Roles β Developer Guide
- β³ π€ Why capabilities are constants
- Layer 3 β the System module
- β³ π Admin Access Control
- Hardening
- β³ π Security review response 2026-08
- β³ π‘οΈ Security hardening 2026-08
- β³ π οΈ Security hardening 2026-08 β Developer Guide
- β³ π‘οΈ Round three β plain English
- β³ π οΈ Round three β Developer Guide
- β³ π‘οΈ CSRF protection (S4) β Developer Guide
- Single Sign-On (SSO)
- ποΈ LDAP & Active Directory
- π CardDAV contact sync
- Browser Extension
- API Reference
-
π REST API β how it works
- β³ π Proposal: custom fields, inventory import and change evidence (#194)
- β³ π οΈ Custom fields, evidence + inventory - review (#195-#197)
- β³ π οΈ Long forms in a task's Work view - review (#198)
- β³ π« REST API: Tickets
- β³ π» REST API: Assets
- β³ π΄ REST API: Problems
- β³ π REST API: Changes
- β³ π REST API: Knowledge
- β³ β REST API: Tasks
- β³ ποΈ REST API: CMDB
- β³ π REST API: Contracts
- β³ ποΈ REST API: Calendar
- β³ πΏ REST API: Software
- β³ π REST API: Domains
- β³ π¦ REST API: Service Status
- β³ βοΈ REST API: Morning Checks
- β³ π REST API: Forms
- β³ βοΈ REST API: Workflow
- β³ π·οΈ REST API: Cost centres
- β³ π§βπΌ REST API: Analysts
- β³ πΊοΈ REST API: Network Mapper
- β³ π§ Using the API docs page
- β³ π OpenAPI specification
- β³ β OpenAPI: kept correct
- β³ π οΈ Maintaining the catalogue
- Watchtower
-
Tickets
- β³ π Rota copy and paste β Developer Deep Dive
- β³ β Checklists & SOPs
- β³ βοΈ Mandatory fields
- β³ π§Ύ Custom ticket fields
- β³ π·οΈ Ticket categories
- β³ π₯ Assigning tickets to a team, and escalation
- β³ π’ One board across every company
- β³ Mailbox Authentication
- β³ π€ Email send log
- β³ π Attachment size limits and large emails
- β³ Basic IMAP mailboxes
- β³ Email rendering & images
- β³ SLA Management
- β³ WhatsApp channel
-
β³
βοΈ Telegram channel - β³ β CSAT company scope and filters β Developer Guide
- β³ π₯ Microsoft Teams channel
- β³ π¨οΈ Mattermost channel
- β³ π¬ Web chat channel
- β³ π£ Slack channel
- β³ π Linking tickets
- β³ β Record previews
- β³ π Ticket notes: internal or shared
- β³ ποΈ Canned responses
- β³ βοΈ Limiting replies to particular senders
- β³ π¨ Telling the analyst a ticket is theirs
- β³ βοΈ Email signatures
- β³ π The public web address
- β³ π’ Ticket numbering
- β³ π Raising a ticket for someone else
- β³ π Merging tickets
- β³ π Confidential tickets
- β³ π₯ Portal managers
- β³ π Who has seen a ticket
- β³ π Reading long tickets
- β³ β Splitting tickets
- β³ β Selecting several tickets
- β³ ποΈ The folder pane
- β³ π½ Just my tickets, or no closed ones
- β³ π οΈ Snoozing tickets β Developer Guide
- β³ π₯ Collision detection
- β³ β±οΈ Time tracking
- β³ π Case reports - a ticket and its work as one PDF
- β³ π Scheduled work in your own calendar
- Problem Management
- Tasks
- π Projects
-
Assets
- β³ π’ Moving an asset between companies
- β³ π Shared asset locations
- β³ π§βπΌ Assigning assets to analysts
- β³ π Warranty and lease alerts
- β³ π Leases
- β³ π Saved table views
- β³ π¨οΈ Recording anything, and importing it
- β³ π§© Asset type layouts
- β³ π Inventory freshness
- β³ π Connected assets
- β³ π Asset review
- β³ π·οΈ QR asset labels
- β³ π Who holds what, and handover documents
- β³ π₯οΈ The inventory agent (PowerShell)
- β³ ποΈ Proxmox VE servers
- β³ βοΈ VMware Cloud Director servers
- β³ π Linking equipment to tickets
- β³ βοΈ Follow-up tasks on a ticket
- Knowledge
- Change Management
- Calendar
- Morning Checks
- Reporting
- Software
-
Forms
- β³ π¨ The form designer β Developer Guide
- β³ π Layout & the grid β Developer Guide
- β³ ποΈ Collections β grouping submissions
- β³ π Submissions as PDFs
- β³ β‘ What happens next β a form's own actions
- β³ π οΈ Sections & conditional logic β Developer Guide
- β³ π οΈ Lookup fields β Developer Guide
- β³ π‘οΈ Catalogue request approvals
- People
- Domains
- ποΈ Files
- Contracts
- Service Status
- π Notifications
- π¨ War Room
- Self-Service Portal
- LMS
- Process Mapper
- CMDB
- Network Mapper
- Workflows
- Issue trackers (Jira, Azure DevOps)
- π‘ Zabbix (monitoring)
- π¬ Microsoft Teams alerts
- π 3CX (phone system)
- System
-
Overview
- β³ π Progress tracker
- β³ Concepts & vocabulary
- β³ Email routing & mailboxes
- β³ Settings: global vs per-company
- β³ Users & self-service
- β³ Staff cross-company access
- β³ π’ One board across every company
- β³ Worked examples
- β³ Pitfalls & gotchas
- β³ Scope: what it's for
- β³ π οΈ Developer Guide (make a module multi-company)
- β³ ποΈ Case study: CMDB (a linked graph)
- β³ π§ͺ Test harness (prove it's isolated)
- What this is
-
π Bugs resolved
- β³ π³ The Docker image was missing PHP extensions
- β³ π A failed DNS lookup read as a missing record
- β³ π A link could change data
- β³ π Access outlived its removal
- β³ π Knowledge articles could run scripts
- β³ π Knowledge writes ignored permissions
- β³ π Company boundaries (Oct 2026)
- β³ π Smaller gaps (Oct 2026)
- β³ π Escaped text could leave its attribute
- β³ π Task descriptions were not cleaned
- β³ π Task documents ignored company scope
- β³ π Repeating tasks ignored company scope
- β³ π¬ #183 Mailbox checks overlapped
- β³ π #188 Transfer lock shown off when unknown
- β³ β #184 Subtask names and Overdue
- β³ π§© #186 Teams: the buttons did nothing
- β³ π Text in a change could run script
- β³ π AI settings changed without the AI permission
- β³ πͺ #178 Deleting an analyst failed
- β³ π« A team with no departments showed 0 tickets
- β³ π Projects: adding a phase did nothing on Save
- β³ π Leavers could still sign in
- β³ πΌοΈ Logo and courses broke on Apache with PHP-FPM
- β³ π’ Chat tickets ignored your ticket numbering
- β³ π Dates shown as a dash, or in server time
- β³ π Assets β Users showed people from other companies
- β³ π Restricted analysts could read other modules' data
- β³ πΌοΈ Replies with a picture in the thread failed to send
- β³ π Reply attachments never reached the customer
- β³ π οΈ Outbound email attachments β Developer Guide
- β³ π A global SSO provider was missing from the portal
- β³ π Behind a proxy, the SSO redirect said http
- β³ βοΈ The portal tagline moved when you saved it
- β³ π¨ The portal settings screen forgot what you saved
- β³ π‘οΈ The approvals inbox said "Error" and nothing else
- β³ π A table's answers were missing from the PDF
- β³ β A single-select column let you tick every option
- β³ π The portal ignored a form's field widths
- β³ π The tasks board stopped taking clicks
- β³ ποΈ #121 The index list is out of date after upgrading
- β³ π #133 The calendar subscription was empty
- β³ π #131 Tasks always reopened on the board
- β³ π₯ #129 Every page returned HTTP 500 after upgrading
- β³ π³ #127 A PHP warning above the System page
- β³ π #126 Notes stamped with the server's clock
- β³ π Storing every date in UTC
- β³ πͺ The portal was down for everyone signed in
- β³ βοΈ #120 Workflow notes could never be written
- β³ βοΈ #123 Three errors when running Database Verification
- β³ π #122 The description box was a stub in the corner
- β³ π£ Demo data deleted real accounts
- β³ π #117 Sign-in redirected to the wrong address
- β³ π¨ #108 The priority dot was invisible
- β³ β±οΈ #116 Time logged from the right-click menu
- β³ π #114 API keys refused by our own guard
- β³ ποΈ #110 Assigning a task told nobody
- β³ πͺ #107 Signed out while still working
- β³ π #103 "Share with Requester" reached nobody
- β³ π #102 Search found nothing for hyphens
- β³ πͺ #101 Source code editor opened behind
- β³ βοΈ #88 Subtasks could not be ticked off
- β³ π» #84 Asset deep link selected nothing
- β³ π« #79 A new ticket arrived with no status
- β³ π§ #79 A ticket from email did not say so
- β³ π #78 Bell opened to nothing
- β³ π¬ #77 Mail only collected from Inbox
- β³ π #74 The default password could not be changed
- β³ π¦ #70 Renaming an impact level
- β³ π€ #67 App-only mailboxes could not send
- β³ π #45 Verify only ever worked for Microsoft
- β³ π #45 IMAP reported as not authenticated
- β³ βοΈ An email template stopped escaping itself
- β³ π The portal dashboard showed the wrong time
- β³ π’ The folder said 99 and the list showed 96