Zabbix ODBC database monitoring for Oracle and SQL databases

Zabbix runs SQL checks against Oracle and SQL Server through unixODBC on the server or proxy, so the design choices are driver, DSN, query scope and account privileges.

On this page

Zabbix ODBC database monitoring for Oracle and SQL databases: when your team needs it

Use Zabbix ODBC checks when a database team wants health and capacity data in Zabbix without installing a Zabbix agent on every database host. The Zabbix server or a Zabbix proxy opens a connection to the database through unixODBC and a vendor driver, runs a SQL query you define, and stores the result as Zabbix items. Three item types cover the work: db.odbc.select returns a single value from the first column of the first row, db.odbc.get returns all rows and columns as JSON for dependent items, and db.odbc.discovery returns low-level discovery data so Zabbix can create items for tablespaces, schemas or instances automatically. Because the collector sits on the monitoring side, this approach fits well when database hosts are locked down, when the DBA team does not want third-party software on the database server, or when one proxy in a network zone can reach several database listeners.

The approach has limits you should settle before design work starts. Zabbix ODBC checks only see what a SQL query can return, so OS-level metrics such as disk latency, process state and log files still need an agent or another method. Each check opens a database session, so frequent polling of heavy queries adds load to the database itself. The item timeout is used as both the login timeout and the query timeout, but some drivers ignore it, which means a hung connection can hold a poller longer than you expect. Test each driver and database version with a deliberately slow query and confirm how long the collector waits before it gives up.

Plan the monitoring account and the driver before you write any item. The account should have read-only access limited to the views or system tables the queries need, and the DBA team should own its password and rotation. Confirm with the vendor and your own environment which ODBC driver your database version supports, since Zabbix documents driver families for MySQL, PostgreSQL, Oracle and Microsoft SQL Server but the exact versions and their timeout behavior depend on the driver you install. The decision in front of you is whether ODBC checks give the health and capacity data your database team needs, or whether an agent-based or database-native method is the better fit for specific metrics.

Which ODBC driver fits each database

Zabbix runs SQL checks through unixODBC, so every monitored database needs a matching ODBC driver on the Zabbix server or proxy that runs the item. Zabbix documents a driver family for each of the four database engines covered here, and each driver has its own build, licensing and behavior quirks.

MariaDB connector for MySQL

Zabbix documents the MariaDB connector for MySQL targets. Install it on the server or proxy host that runs the ODBC items, then register it in odbcinst.ini so unixODBC can load it by name. Confirm the connector build works with the MySQL or MariaDB version you monitor, since the server release and the connector are chosen separately. Test a login and a simple SELECT 1 from the same host before you create any Zabbix item.

Zabbix ODBC docs

psqlODBC for PostgreSQL

Zabbix documents psqlODBC for PostgreSQL targets. Its build depends on the client libraries installed on the Zabbix host, so check which libpq version the package links against before you deploy. Confirm that the PostgreSQL server version you monitor is supported by both the driver and your Zabbix release. Keep the driver version recorded alongside the Zabbix version, because upgrades of either one can change how queries behave.

Oracle ODBC driver for Oracle

Zabbix documents the Oracle ODBC driver for Oracle databases. The driver depends on the Oracle Instant Client libraries, which must match the target database and must be installed where the Zabbix server or proxy runs. Oracle licensing and download terms apply to the client, so confirm them with your Oracle contract before deployment. Verify the library path in the unixODBC configuration, since a missing shared library is a common cause of failed Oracle checks.

FreeTDS or tdsodbc for SQL Server

Zabbix documents FreeTDS or tdsodbc for Microsoft SQL Server targets. Both use the TDS protocol, so confirm which SQL Server features and authentication modes your environment needs before you pick one. Check the TDS protocol version set in freetds.conf against the SQL Server version in use, since an unmatched value can cause login failures. Test encrypted connections separately, because TLS handling differs between the options.

Versions must match your environment

Driver version, client libraries and the unixODBC build must each be confirmed against the target database version and the Zabbix release in use. Record the exact package versions on the Zabbix host, since a server upgrade or an OS package update can change the driver stack. Ask your database and Zabbix vendors which combinations they support before you commit to a design.

Configuration options and when each fits

This table compares the three Zabbix ODBC item types and the DSN settings they depend on, by output shape, typical use and load on the database. Read it to pick the item type for each check before writing any SQL, and to see where timeouts apply.

OptionOutput shapeTypical useLoad and timeout notes
db.odbc.selectOne value per item, taken from the first column of the first rowA single count, status flag or aggregate, such as pending jobs or replication lagLightest option; one query per item. The item timeout applies as login and query timeout, but some drivers ignore it, so test each driver.
db.odbc.getRows and columns returned as JSONSeveral related values in one query, such as tablespace usage or session counts by stateHeavier than a single value because the full result set is returned; keep queries narrow and confirm the result size before scheduling.
db.odbc.discoveryLow-level discovery data in JSON for item and LLD prototypesFinding databases, schemas, tablespaces or tables that should each get their own itemsRuns on the discovery interval; a broad catalog query can be expensive, so discover only the objects you intend to monitor.
odbc.ini DSN settingsNamed connection definitions read by unixODBC on the server or proxyKeeping host, port, service name, driver and database out of item keysDriver path and connection options live here, so a wrong driver or timeout setting here affects every item that uses the DSN.
Item timeoutNot an output option; limits how long a login or query may runStopping a slow monitoring query from holding a pollerConfirm with your driver vendor whether the timeout is honored. A driver that ignores it can keep a poller busy during database slowdowns.
Monitoring account privilegesNot an output option; defines what each item can readLeast-privilege access to views and catalog tables needed by the checksGrant read access to specific views only. Confirm which system views each query needs before the account is created.

Setting up ODBC checks on the Zabbix server or proxy

This sequence takes a database connection from version checks to verified Zabbix items, with a check at each step confirming that the layer below works before the next one is built. The output is a DSN that unixODBC can reach, a read-only monitoring account, and items whose values and timeouts you have observed in the frontend.

  1. Confirm database and Zabbix versions

    Before installing anything, record the Zabbix server or proxy version, the database engine and version, and the operating system of the host that will run the checks. Check the requirements page for the Zabbix version you run, and confirm with the database vendor that your target version is supported by the driver you plan to use. Ask the database owner which service name, SID or database name the monitoring account should connect to. This step is done when you have a written version matrix that your change record can reference.

  2. Install unixODBC and the chosen driver

    On the Zabbix server or proxy host, install the unixODBC driver manager and the ODBC driver for your database. Zabbix documents MariaDB Connector/ODBC for MySQL, psqlODBC for PostgreSQL, the Oracle ODBC driver for Oracle, and FreeTDS or tdsodbc for Microsoft SQL Server, so choose from that list and confirm the driver version with the database vendor. Install the server or proxy package from the same packaging source as Zabbix itself. Done means odbcinst -j reports the location of your odbcinst.ini and lists the driver you installed under a driver section.

  3. Define the DSN in odbc.ini

    Add a DSN section to the odbc.ini file that unixODBC reads, naming the driver exactly as it appears in odbcinst.ini, plus the server address, port, database or service name and any driver-specific keys the vendor documents. Keep the DSN name short and stable, because it is the value you will later pass to db.odbc.select, db.odbc.get and db.odbc.discovery. Store the file with ownership and permissions that let the zabbix user read it, and do not put the monitoring password in this file if your driver supports a separate secret source. Done means the DSN appears in odbcinst-style listings with odbcinst -q -s.

  4. Test the connection with unixODBC tools

    Run isql against the DSN from the same host and as the same operating system user that runs the Zabbix server or proxy service, using a query such as a simple select of the current date from the database. Run it once as root and once as the zabbix user, because a permission gap on odbc.ini or on a driver library is a common cause of failures that appear only inside the daemon. Test the login timeout by pointing the DSN at an address that does not answer and confirming the call returns instead of hanging. Done means a plain query returns one row with the expected value under the service account.

  5. Create a least-privilege monitoring account

    Ask the database team to create a dedicated login with read access only to the views or catalog tables your checks need, and no write, DDL or administrative privileges. Prefer views or stored functions that return the specific metrics you want over granting broad access to base tables, and record exactly which objects the account can read. Confirm the password rotation process and who holds it, since this login will be used by every check on the host. Done means the same isql test passes with this account, and a deliberately forbidden statement fails with a permission error.

  6. Create items and a discovery rule

    In the frontend, add db.odbc.select items for single values, db.odbc.get items where you need rows and columns returned as JSON, and a db.odbc.discovery rule for low-level discovery of objects such as tablespaces or schemas. Each key takes the DSN name, the monitoring account credentials and the SQL statement, and the query should be kept small and indexed where possible. Set the item timeout deliberately, remembering that Zabbix applies it as both login and query timeout and that some drivers ignore it. Done means each item moves from unsupported to supported state and returns a value on its next poll.

  7. Verify values and timeouts in the frontend

    Compare the values shown in Latest data against the same queries run directly in the database for at least one full polling cycle, and confirm that discovery creates the expected prototype items. Then test the timeout by pointing one item at a slow query or an unreachable DSN and checking that the item reports an error within the configured timeout rather than stalling pollers. Review the server log for ODBC errors and confirm the driver error text is clear enough for your on-call team. Done means values match the database, discovery output matches the object list, and a forced failure produces a visible error on the item.

Writing queries that stay cheap and predictable

Every ODBC check runs a real query against a production database, so the query design decides how much load monitoring adds. Keep each db.odbc.select, db.odbc.get and discovery query read-only, narrow in columns and rows, and aimed at metadata or summary views rather than business tables. Grant the monitoring account SELECT only on the specific views or fixed system tables it needs, such as Oracle data dictionary views like V$ or DBA_ views that your DBA approves, or the SQL Server dynamic management views the checks depend on. Avoid write privileges, stored procedures that change state, and ad hoc user schemas. A check that can only read a short list of objects is also much easier to explain in a security review.

Avoid full-table scans on large schemas, because a query that looks harmless on a test database can scan millions of rows in production. Filter on indexed columns, prefer counts and status fields from catalog views over COUNT(*) on fact tables, and avoid queries whose cost grows with history, such as scanning audit or log tables for the last hour. For lists such as tablespaces, databases, schemas or replication links, use low-level discovery through db.odbc.discovery so Zabbix creates one item per object instead of hard-coding names, and keep the discovery query itself cheap because it runs on its own schedule. Confirm the item intervals with the DBA, since a short interval on an expensive query is the most common cause of avoidable load.

Query cost lands on the database engine that serves your applications, so treat every check as a change that needs review before it goes live. Ask the DBA to run each query with its execution plan on a copy or during a quiet window, and to record its CPU, I/O and lock behavior. Agree on the item interval, the timeout and the maximum number of concurrent checks per database, and write them into the configuration review. Also confirm how the database vendor's own monitoring and licensing rules treat catalog and performance views, because some of them require specific packs or licenses. Re-review queries after schema changes, database upgrades or growth in table sizes, since a query that was cheap last year may not be cheap now.

Security and operational considerations

The security of Zabbix ODBC checks depends on three things: the database account the check uses, where the DSN credentials sit on disk, and which network zone the server or proxy running the query occupies. Each card below covers one of these decisions or a related operational risk, so the team can review them together before go-live.

Read-only monitoring accounts

Create a dedicated database login for each monitored instance and grant it only the views or catalog tables your items query, such as a set of performance views or a named reporting view. Avoid reusing an application account or a DBA account, because a compromised Zabbix host would then hold those rights. Ask the database team to confirm in writing that the login cannot write, change schemas or read business tables that no item needs. Review grants whenever an item is added or changed.

Zabbix ODBC docs

DSN credentials on the server or proxy

The odbc.ini file holds the DSN definitions, and any stored user name and password lives there too. Keep the file owned by root or the Zabbix service account with permissions that block other local users from reading it, and confirm that backups of the host are encrypted. Restrict who can log in to the server or proxy at all, since shell access there gives access to every configured database.

Patched ODBC driver packages

The unixODBC manager and the per-database driver, such as the Oracle ODBC driver, the psqlODBC driver or the MariaDB connector, are separate packages that receive their own security fixes. Put them on the same patch cycle as the Zabbix server and proxy hosts, and record the installed driver version in your configuration inventory. After any driver upgrade, run a test item against each DSN before relying on the new build.

Proxy placement in network zones

Place the proxy in the zone that already has a permitted route to the database listener, and keep the database port closed from every other zone. Running queries from the central server into a production database zone often requires a firewall rule that is wider than needed, so a proxy close to the database usually narrows the exposure. Confirm the path, the listener port and the allowed source address with the network team before creating the first item.

Frontend authentication is separate

Zabbix user authentication with internal accounts, LDAP, SAML or MFA controls who can sign in to the web interface and see or edit items. It does not control the credentials Zabbix uses to reach the database, which are held in the DSN configuration on the server or proxy. Plan both layers separately: a strong SSO and MFA setup for operators, and a database account scoped to read-only queries for the collector.

Zabbix authentication docs

Questions buyers ask before hiring help with ODBC monitoring

What makes ODBC monitoring cost more or less to set up?

The biggest drivers are the number of database engines, how much driver work each one needs, how many queries you run and how complex they are, and how many network zones the server or proxy must reach. Each Oracle or SQL Server instance may need its own driver build, DSN and firewall path, so ten databases across two engines take more effort than ten databases on one engine. Query design matters too: a handful of single-value checks is far smaller work than dozens of row-returning checks with discovery and JSON parsing. Database team review time is another driver, since queries must be approved against monitoring rules and production load. Ask any quote to list databases, engines, query count, discovery use and zones separately so you can see which line moves the price.

Can our own team set up Zabbix ODBC checks without a partner?

Yes, if you have a Linux engineer comfortable with unixODBC, a Zabbix administrator who understands items and templates, and a database owner who will review the monitoring account. The work is well documented in the official Zabbix ODBC monitoring documentation, and the hard parts are usually driver installation, DSN correctness and proving that a query is cheap enough to run every interval. Teams often struggle when they have no one who owns the database side of the decision or when they need several engines at once. A partner makes sense when the timeline is tight, the engines are unfamiliar to your staff or the checks must be reviewed by a formal change process before go-live.

What do we need from the database team before the work starts?

You need a named DBA or database owner who can approve the monitoring account, confirm which schemas and views may be read and agree on acceptable query cost. Ask them to create a read-only account with least privilege, ideally granted access to system views or specific monitoring views rather than application tables. They should also confirm the database version, listener or connection details, TLS requirements and any password rotation policy. Without this input, queries are guessed, and guesses are where timeouts and production load issues start. Plan for their review of every query before it goes into a template, not just the first one.

How long does it take to agree on the monitoring queries?

Query agreement usually takes longer than driver installation because it depends on people outside the monitoring team. The schedule depends on how many checks you need, how quickly the DBA can test them in a non-production copy and whether the business agrees which metrics matter. Measure each query's runtime under normal and peak load, keep single-value checks small, and avoid full table scans on large tables. Ask a vendor to state how they will run and record this testing and what sign-off is needed, and ask for a timeline that separates design, database review and production rollout. Any duration figure should come from the written scope for your environment.

What recurring work comes after ODBC checks go live?

Recurring work falls into three groups: driver and library patching, query maintenance and access review. ODBC drivers for Oracle, PostgreSQL, MySQL or SQL Server receive updates, and unixODBC and the Zabbix server or proxy also need upgrades, so each change should be retested against your DSNs. Schema changes, renamed views or new indexes can break or slow a query without any visible error until a problem appears, so someone must own the query inventory. Access review matters as well: monitoring accounts should be checked when database users are rotated or privileges change. Ask whether these tasks sit in a retainer, your team's runbook or both.

What does a fixed-scope ODBC monitoring engagement include?

A fixed-scope engagement is agreed in writing before work starts and lists the databases, engines, checks, network zones and deliverables. At DeployOpen, a typical written scope covers planning the driver for each engine, configuring unixODBC and DSNs on the server or proxy, building the Zabbix items and templates, setting timeouts, documenting the least-privilege accounts and handing over the query inventory. Anything outside that list, such as new engines, custom dashboards or ongoing query reviews, should appear as a separate line in the scope. Ask for the acceptance criteria in writing so you know when the work is complete.

Why do ODBC checks time out, and who should fix it?

Zabbix uses the item timeout as both the login and query timeout, but some drivers ignore it, so a stalled database can hold a poller longer than expected. The usual causes are a slow query, a locked table, a network path through a firewall or a driver that does not honor the timeout setting. The engineer should check the query plan, the driver behavior and the network path, while the DBA reviews whether the query is safe to run. Agree on ownership before go-live: the monitoring team owns the Zabbix item and its interval, and the database team owns the query and the account. Keeping both in the runbook prevents the common pattern of blaming the monitoring tool for a database problem.

How an ODBC check reaches the database

The check starts in the Zabbix server or proxy process, which calls the unixODBC driver manager. The driver manager reads the DSN in odbc.ini, loads the vendor driver for that database, and opens a connection with the monitoring account inside the database network. The query result returns along the same path as one value or as rows, and that value is what the item stores. Check the trust boundary: the account, its grants and the network path from the Zabbix host to the database port are the parts you control and should verify first.

Data path from the Zabbix process through the ODBC stack to the database, with the trust boundary marked.

How DeployOpen scopes and delivers ODBC monitoring

DeployOpen plans Zabbix ODBC database monitoring as a fixed-scope piece of work: which databases are watched, which driver and DSN each one needs, and which read-only account runs each query. The work is built in your infrastructure, tested against your own databases, and handed over with documentation your DBA and monitoring team can maintain.

How we scope

  • Inventory each Oracle and SQL database, its version, host location and the Zabbix server or proxy that will run its checks.
  • Agree the list of metrics and queries, with the business reason for each, before any template or item is written.
  • Confirm with your DBA team which monitoring account, privileges and network paths they will approve, in writing, before build starts.

How we build

  • Install unixODBC and the driver chosen for each database engine, then set up odbc.ini DSNs and test each connection from the Zabbix host.
  • Build db.odbc.select, db.odbc.get and db.odbc.discovery items with explicit timeouts, tested against sample data and slow-query conditions.
  • Create least-privilege database accounts with read-only grants and test that the checks fail safely when a password or grant changes.

How we hand over

  • Deliver the written configuration: DSN definitions, driver versions, item keys, template structure and the database grants each check depends on.
  • Provide a runbook covering credential rotation, driver updates and how to read a failed ODBC item in the Zabbix frontend and server log.
  • Walk your operations and DBA staff through the handover and record which tests passed, failed or were deferred, with reasons.

How we support

  • Engagements are fixed-scope, and the scope, deliverables and timelines are agreed in writing before work starts.
  • Ongoing support, driver and Zabbix upgrades, and continuous testing are available as a retainer, so checks keep working after each change.
  • Confirm the support model, response expectations and retainer terms in the written scope, since these depend on your environment.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.