Introducing a new way to review your PRs.

Read the announcement

combodo / itop

A simple, web based CMDB & IT Service Management tool

View on GitHub

17 documents · Updated Nov 20, 2026

docs / cmdb-and-data-model

CMDB and data model

iTop's configuration management database (CMDB) gives managed data one shared model. It connects typed objects with their values, relationships, business meaning, persistence, search, and user-facing views so that the back office, imports, queries, and domain modules use the same data contract.

Object model

The object model represents managed data as persistent classes. Each class describes a kind of object, its values, its links, its place in an inheritance tree, and the rules that give the object meaning.

Class hierarchy

The class hierarchy separates shared rules from concrete records. A parent class can define common behavior while a child class supplies a concrete object type. The model keeps the concrete type of each record so a search for a parent class can still return the correct object.

The main layers are:

  • DBObject: the base persistent object contract.
  • CMDBObject: persistent objects with CMDB change history.
  • cmdbAbstractObject: common managed-object behavior and metadata-based presentation.
  • Domain classes: organizations, configuration items, services, tickets, and other managed records.

References: home/…/dbobject.class.php• L63-70 home/…/cmdbobject.class.inc.php• L81-86 home/…/cmdbabstract.class.inc.php• L80-84

Attributes and relationships

Attributes hold values or describe links between objects. An external key points to one object. An external field shows a value from that object. A linked set shows related objects. A link class represents a relationship that needs its own record. A hierarchical key represents a tree such as an organization structure.

These relationships give records business context. For example, a location belongs to an organization and can be linked to people, while a person can belong to teams and have a manager. The model can also enforce relationship rules such as required targets, delete behavior, and no duplicate links.

References: home/…/datamodel.itop-structure.xml• L75-83 home/…/datamodel.itop-structure.xml• L253-289 home/…/datamodel.itop-structure.xml• L682-723 home/…/datamodel.itop-structure.xml• L1268-1335

Object identity

Each class defines how the platform stores, names, and matches its records. The database key identifies the stored record. Reconciliation keys provide stable business values for matching incoming data to an existing record. These identity rules can include the concrete class, organization, or other fields that distinguish similar records.

References: home/…/metamodel.class.php• L1134-1139 home/…/metamodel.class.php• L1228-1357 home/…/datamodel.core.xml• L4-37

Persistence abstractions

iTop separates the object model from direct database access. Persistent objects represent records. Search definitions describe which records to fetch. Object sets expose results. The database source provides the connection and transaction boundary. This separation lets platform services work with managed objects instead of database rows.

Persistent objects

DBObject represents a record that can be loaded, created, changed, or deleted. It tracks current and original values, supports partially loaded records, and defers database writes until the persistence operation runs. CMDBObject adds the CMDB meaning of a write by recording changes and their origin. The CMDB object lifecycle explains the ordered behavior of these actions.

References: home/…/dbobject.class.php• L98-166 home/…/dbobject.class.php• L217-264 home/…/dbobject.class.php• L401-438 home/…/dbobject.class.php• L581-689 home/…/metamodel.class.php• L1228-1357

Search definitions

A DBSearch describes a model query before it becomes SQL. A class search can add conditions and follow relationships. A union search combines compatible class searches into one result view. These objects keep class scope, aliases, relationships, visibility, and archive rules together while a query is built.

The query and OQL page explains how query text and search objects move through this layer.

References: home/…/dbsearch.class.php• L14-46 home/…/dbsearch.class.php• L1515-1541 home/…/dbobjectsearch.class.php• L846-966 home/…/dbunionsearch.class.php• L97-139 home/…/sqlobjectquerybuilder.class.inc.php• L117-156

Database mapping

Class metadata maps the object model to database tables without making the table layout the public model. It records the table, key field, and concrete-class field for each hierarchy. CMDBSource owns the database connection and shared database operations.

The mapping also supports compound objects. An inherited attribute can remain stored in the table of the class that defined it. A class search can still present the complete object through the model rather than through one physical table.

References: home/…/metamodel.class.php• L1228-1357 home/…/metamodel.class.php• L1438-1479 home/…/dbobject.class.php• L488-559 home/…/cmdbsource.class.inc.php• L38-111

Object sets

DBObjectSet is the result abstraction for a model search. It loads and orders typed objects. It can also combine stored results with objects held in memory. Because it receives a search definition, its results follow that search's class scope, relationships, visibility, and archive mode.

The query and OQL page covers how searches become object sets.

References: home/…/dbobjectset.class.php• L20-26 home/…/dbobjectset.class.php• L87-118 home/…/dbobjectset.class.php• L938-1002 home/…/dbsearch.class.php• L1001-1018

Metadata

Metadata makes the object model useful to persistence services and user-facing tools. It defines class names, labels, icons, states, allowed values, relationships, forms, lists, search fields, and access categories. The same metadata supports the back office, imports, reconciliation, and query tools.

Runtime model

MetaModel is the runtime view of the loaded data model. It resolves classes and attributes, follows inheritance, maps attributes to their source classes and tables, and exposes shared fields such as friendlyname and finalclass. It also provides the class and attribute checks used by object reads, writes, links, and searches.

An attribute definition is the model's contract for one value. It gives the value type and rules for loading, writing, formatting, relationships, defaults, and dependent fields. This lets an object expose related values such as an external field without making each caller know the storage path.

References: home/…/metamodel.class.php• L1475-1523 home/…/metamodel.class.php• L1601-1718 home/…/metamodel.class.php• L1727-1795 home/…/dbobject.class.php• L835-877 home/…/dbobject.class.php• L892-953

Design documents

The model is assembled from design documents supplied by selected modules. These documents can define or extend classes, attributes, relationships, and presentation rules. ModelFactory combines the contributions into one runtime design for installation and use.

The available model therefore depends on the selected module set. Optional relationships can be left out when their target module is not active. A module can extend the model without forcing every installation to use that domain.

References: home/…/modelfactory.class.inc.php• L556-629 home/…/datamodel.core.xml• L1-12 home/…/metamodel.class.php• L3304-3357

Lifecycle metadata

Classes can define a state attribute and an obsolescence condition. These rules describe business status and identify records that are no longer active. Archive metadata provides a separate way to retain records while excluding them from normal results. The CMDB object lifecycle page explains how object changes apply these rules.

The model also supports uniqueness rules inherited through a class tree. A child can keep a parent rule or disable it for its branch. This lets shared identity rules remain consistent while allowing a concrete domain class to define a valid exception.

References: home/…/metamodel.class.php• L633-669 home/…/metamodel.class.php• L682-721 home/…/metamodel.class.php• L1044-1095 home/…/datamodel.itop-structure.xml• L24-38

Core support objects

The core model includes objects that connect managed data to automation, synchronization, audit, and notifications. Actions and triggers are model objects with status, links, and reconciliation rules. Synchronization sources describe the class scope and reconciliation policy for imported data. Audit rules store OQL definitions that assess managed data. Notification events link an action and trigger to a target context.

These objects use the same class and metadata contract as business records. For example, an action can select recipients through OQL and can keep execution records as model events. The model declaration also defines link uniqueness and delete behavior for notification subscriptions.

References: home/…/action.class.inc.php• L42-96 home/…/action.class.inc.php• L216-243 home/…/datamodel.core.xml• L4-37 home/…/datamodel.core.xml• L717-857 home/…/datamodel.core.xml• L903-925

Output safety

Metadata-driven values can reach HTML views and notifications. iTop therefore treats HTML as a separate output contract. DBObject escapes friendly names for HTML display, while HTMLSanitizer applies a configured sanitizer and falls back to a DOM-based sanitizer when the configured class is invalid or fails.

The fallback is part of the safety boundary. An invalid SVG sanitizer is logged and leaves the input unchanged, so installations must not treat a disabled or invalid sanitizer as a safe filter.

References: home/…/dbobject.class.php• L1660-1693 home/…/dbobject.class.php• L1181-1205 home/…/htmlsanitizer.class.inc.php• L21-80 home/…/htmlsanitizer.class.inc.php• L135-225 home/…/htmlsanitizer.class.inc.php• L263-407

Model diagnostics

The model also defines how platform faults become visible. LogAPI routes messages by level and channel to files and, when enabled, to EventIssue records. This keeps failures in model and persistence services diagnosable without making database logging a required part of every operation.

Logging can rotate files and can use the model's EventIssue class for database records. Database logging protects against re-entry and falls back to file logging when the issue record cannot be saved.

References: home/…/log.class.inc.php• L626-786 home/…/log.class.inc.php• L907-956 home/…/log.class.inc.php• L1469-1505

Packaged domain models

Packaged domain models turn the shared CMDB model into service-management data. Each module adds a focused business vocabulary and declares its dependencies. The selected modules then form the data model available in an iTop instance.

Structure model

The structure model provides shared business context for the other domains. It models organizations, locations, contacts, people, teams, documents, and catalog types. The model also exposes these records through administration and configuration-management views.

Organizations can form a hierarchy. Locations belong to organizations. People and teams extend the common contact model, and a link class records team membership. Documents share a common model with file, note, and web variants. This structure lets service and infrastructure records point to the same business context.

References: home/…/module.itop-structure.php• L3-28 home/…/datamodel.itop-structure.xml• L4-38 home/…/datamodel.itop-structure.xml• L396-434 home/…/datamodel.itop-structure.xml• L594-723 home/…/datamodel.itop-structure.xml• L1443-1499 home/…/datamodel.itop-structure.xml• L1625-1873

Configuration model

The configuration management model defines configuration items (CIs) and their technical relationships. It covers functional CIs, devices, servers, networks, software, applications, databases, and related records. Infrastructure modules extend this CI model with areas such as virtualization, storage, and end-user devices.

References: home/…/module.itop-config-mgmt.php• L3-31 home/…/datamodel.itop-config-mgmt.xml• L4-31 home/…/module.itop-virtualization-mgmt.php• L18-55 home/…/module.itop-storage-mgmt.php• L27-57

Attachment model

The attachment model stores files as separate records linked to allowed target classes. It supports draft files while a form is in progress and confirmed files with their target object. The console uses an authenticated AJAX boundary to add files and refresh the attachment view. Upload errors have stable numeric codes for empty files and denied actions.

The renderer presents stored and draft attachments together. It supports previews, downloads, delete marks, and a later refresh without submitting the host object. A read-only object state switches the endpoint to view mode, while the upload path checks permission for the target class before it creates the draft record.

References: home/…/ajax.itop-attachment.php• L44-91 home/…/ajax.itop-attachment.php• L101-127 home/…/ajax.itop-attachment.php• L129-163 home/…/renderers.itop-attachments.php• L72-125 home/…/renderers.itop-attachments.php• L411-570 home/…/AttachmentAjaxErrorEnum.php• L3-12 home/…/autoload_classmap.php• L8-12

Service and ITIL models

Service management connects organizations and contacts to contracts, services, service levels, and delivery responsibilities. ITIL ticket models add work records such as incidents, user requests, changes, problems, and known errors. These records use the same class, relationship, state, and history model as CIs, so service work can refer to the infrastructure it affects.

The ITIL and infrastructure data models page gives the domain-level view of these packaged modules and their relationships.

References: home/…/datamodel.itop-service-mgmt.xml• L43-109 home/…/datamodel.itop-service-mgmt.xml• L1024-1115 home/…/datamodel.itop-tickets.xml• L7-20 home/…/datamodel.itop-full-itil.xml• L1-74

Change checklist

When these files or sections are changed, remember to consider these:

  • A class hierarchy change can affect the concrete-class field, parent queries, table mapping, reconciliation keys, and external links.
  • An external key change must be checked with its external fields, linked sets, target class, delete policy, and reverse relation.
  • A state or obsolescence change must be checked against archive visibility, lifecycle actions, and searches that exclude inactive records.
  • A uniqueness-rule change must be checked across inherited rules and concrete child classes that disable or override the rule.
  • A module dependency or optional class reference must be checked against the model produced when that module is not selected.
  • A design-document change that alters stored fields may need a matching module database migration so existing records remain readable.
  • A sanitizer or output-format change must be checked at every HTML boundary, including object names, rich text, and notification bodies.
  • A logging change must be checked for both file output and optional EventIssue persistence, including the no-reentry fallback path.
  • An attachment AJAX contract change must keep the request parameters, CSRF checks, error codes, renderer refresh, and Composer class map aligned.

Important failure modes

TriggerConsequenceGuard
A parent class is queried without the concrete-class information needed by its hierarchy.The platform cannot resolve the correct object type.Preserve the concrete-class field for searches over classes with children.
A search uses unrestricted data access for a workflow that should use user visibility.The result can expose records outside the user's allowed scope.Use filtered searches unless an internal operation needs all data.
A module refers to a class that is not active.An expected attribute or relationship can disappear from that installation.Keep module dependencies and optional references aligned.
A class, attribute, or database mapping changes without a matching migration.Existing records can refer to an unknown class or field.Update the model and its installer migration together.
A CMDB record changes outside the persistent-object path.The record can miss write checks or change history.Use the model and persistence abstractions for managed data changes.
A sanitizer is invalid or fails for HTML input.The configured fallback may be used, or unsafe input may remain unchanged for an invalid SVG sanitizer.Treat sanitizer configuration as a security contract and inspect sanitizer logs.
Database issue logging re-enters the logging path.A fault can cause recursive logging and hide the original failure.Keep the database logging re-entry guard and file fallback.
An attachment request omits the authenticated AJAX or transaction checks.A caller can bypass the intended console upload boundary.Keep login, AJAX, and transaction validation before attachment operations.
An attachment upload targets a class the user cannot modify.The file is rejected and no draft attachment is created.Check the target class permission before persistence.
The attachment error enum and generated class map are out of sync.AJAX clients can receive missing or unstable error codes.Update the enum and Composer autoload metadata together.

Key files

FileWhy to read it
home/…/dbobject.class.phpDefines the shared persistent-object contract and in-memory state.
home/…/cmdbobject.class.inc.phpConnects persistent writes to CMDB history.
home/…/metamodel.class.phpDefines the runtime class registry, inheritance, metadata lookup, and database mapping.
home/…/dbsearch.class.phpDefines the shared search contract and visibility boundary.
home/…/dbobjectsearch.class.phpDefines class-scoped searches and relationship conditions.
home/…/dbunionsearch.class.phpDefines combined searches across compatible class branches.
home/…/dbobjectset.class.phpDefines the result abstraction used to load and iterate over objects.
home/…/cmdbsource.class.inc.phpDefines the database connection and transaction boundary.
home/…/modelfactory.class.inc.phpShows how selected module contributions become one runtime model.
home/…/datamodel.core.xmlShows core model declarations for actions, triggers, synchronization, audit, and notification records.
home/…/htmlsanitizer.class.inc.phpDefines the HTML and SVG sanitization boundary.
home/…/log.class.inc.phpDefines file and database diagnostics for model and persistence failures.
home/…/datamodel.itop-structure.xmlDefines the shared organization, location, contact, team, document, and typology model.
home/…/datamodel.itop-config-mgmt.xmlDefines the CI hierarchy and technical relationships.
home/…/datamodel.itop-service-mgmt.xmlDefines services, contracts, service levels, and delivery.
home/…/datamodel.itop-tickets.xmlDefines the common ticket model used by ITIL work records.
home/…/module.itop-virtualization-mgmt.phpShows how an infrastructure extension stays within the CI hierarchy.
home/…/ajax.itop-attachment.phpDefines the authenticated attachment upload and refresh boundary.
home/…/renderers.itop-attachments.phpDefines the console view of stored and draft attachments.
home/…/AttachmentAjaxErrorEnum.phpDefines stable attachment AJAX error codes.