Steps to ensure correct operation of templates that collect metrics via ODBC monitoring:
1. Make sure that required ODBC driver is installed on Zabbix server or proxy.
2. Link the template to a target host (if the template is not available in your Zabbix installation, you may need to import the template's .xml file first - see Templates out-of-the-box section for instructions).
3. Adjust the values of mandatory macros as needed.
4. Configure the instance being monitored to allow sharing data with Zabbix - see instructions in the Additional steps/comments column.
This page contains only a minimum set of macros and setup steps that are required for proper template operation. A detailed description of a template, including the full list of macros, items and triggers, is available in the template's Readme.md file (accessible by clicking on a template name).
Template | Mandatory macros | Additional steps/comments |
---|---|---|
MSSQL by ODBC | {$MSSQL.DSN} - the system data source name (default: <Put your DSN here>) {$MSSQL.PORT} - the TCP port of Microsoft SQL Server (default: 1433) {$MSSQL.USER}, {$MSSQL.PASSWORD} - Microsoft SQL login credentials (default: not set) |
Create a Microsoft SQL user for monitoring and grant the user the following permissions: View Server State; View Any Definition (see Microsoft SQL documentation for details). The "Service's TCP port state" item uses {HOST.CONN} and {$MSSQL.PORT} macros to check the availability of the Microsoft SQL instance. |
MySQL by ODBC | {$MYSQL.DSN} - the system data source name (default: <Put your DSN here>) {$MYSQL.USER}, {$MYSQL.PASSWORD} - MySQL login credentials; password can be blank (default: not set) |
To grant required privileges to MySQL user that will be used for monitoring, run:GRANT USAGE,REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON %% *.* TO '<username>'@'%';%% See MYSQL documentation for details. |
Oracle by ODBC | {$ORACLE.DSN} - the system data source name (default: <Put your DSN here>) {$ORACLE.PORT} - the TCP port of Oracle DB (default: 1521) {$ORACLE.USER}, {$ORACLE.PASSWORD} - Oracle login credentials (default: not set) |
1. To create an Oracle user for monitoring, run:CREATE USER zabbix_mon IDENTIFIED BY <PASSWORD>; -- Grant access to the zabbix_mon user. GRANT CONNECT, CREATE SESSION TO zabbix_mon; GRANT SELECT ON V_$instance TO zabbix_mon; GRANT SELECT ON V_$database TO zabbix_mon; GRANT SELECT ON v_$sysmetric TO zabbix_mon; GRANT SELECT ON v$recovery_file_dest TO zabbix_mon; GRANT SELECT ON v$active_session_history TO zabbix_mon; GRANT SELECT ON v$osstat TO zabbix_mon; GRANT SELECT ON v$restore_point TO zabbix_mon; GRANT SELECT ON v$process TO zabbix_mon; GRANT SELECT ON v$datafile TO zabbix_mon; GRANT SELECT ON v$pgastat TO zabbix_mon; GRANT SELECT ON v$sgastat TO zabbix_mon; GRANT SELECT ON v$log TO zabbix_mon; GRANT SELECT ON v$archive_dest TO zabbix_mon; GRANT SELECT ON v$asm_diskgroup TO zabbix_mon; GRANT SELECT ON sys.dba_data_files TO zabbix_mon; GRANT SELECT ON DBA_TABLESPACES TO zabbix_mon; GRANT SELECT ON DBA_TABLESPACE_USAGE_METRICS TO zabbix_mon; GRANT SELECT ON DBA_USERS TO zabbix_mon; 2. Make sure, that ODBC connects to Oracle with session parameter NLS_NUMERIC_CHARACTERS= '.,' 3. Add a new record to odbc.ini: [$ORACLE.DSN] Driver = Oracle 19 ODBC driver Servername = $ORACLE.DSN DSN = $ORACLE.DSN 4. Check the connection via isql: isql $TNS_NAME $DB_USER $DB_PASSWORD 5. Configure Zabbix server or Zabbix proxy for Oracle ENV Usage. Edit or add a new file: /etc/sysconfig/zabbix-server, or for the proxy: /etc/sysconfig/zabbix-proxy. Then add the following lines to the file: export ORACLE_HOME=/usr/lib/oracle/19.6/client64 export PATH=$PATH:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib64:/usr/lib:$ORACLE_HOME/bin export TNS_ADMIN=$ORACLE_HOME/network/admin 6. Restart Zabbix server or proxy. |