[comment]: # translation:outdated

[comment]: # ({new-7f0ac7a3})
# Zabbix agent 2 template operation

Steps to ensure correct operation of templates that collect metrics with
[Zabbix agent 2](/manual/concepts/agent2):

1\. Make sure that the agent 2 is installed on the host, and that the
installed version contains the required plugin. In some cases, you may
need to
[upgrade](https://www.zabbix.com/documentation/current/manual/installation/upgrade)
the agent 2 first.\
2. [Link](/manual/config/templates/linking#linking_a_template) the
template to a target host (if the template is not available in your
Zabbix installation, you may need to import the template's import file
first - see [Templates
out-of-the-box](/manual/config/templates_out_of_the_box) section for
instructions).\
3. Adjust the values of mandatory macros as needed. Note, that user
macros can be used to override configuration parameters.\
4. Configure the instance being monitored to allow sharing data with
Zabbix - see instructions in the *Additional steps/comments* column.

::: noteimportant
 Zabbix agent 2 templates work in conjunction with
the plugins. While the basic configuration can be done by simply
adjusting user macros, the deeper customization can be achieved by
[configuring the plugin](/manual/config/items/plugins#named_sessions)
itself. For example, if a plugin supports named sessions, it is possible
to monitor several entities of the same kind (e.g. MySQL1 and MySQL2) by
specifying named session with own URI, username and password for each
entity in the configuration file. 
:::

::: notetip
 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 name|Mandatory macros|Additional steps/comments|
|-------------|----------------|-------------------------|
|[Ceph by Zabbix agent 2](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/ceph_agent2/README.md)|**{$CEPH.API.KEY}** - the API key (default: `zabbix_pass`).<br>Required, if {$CEPH.CONNSTRING} is a URI.<br>Must be empty, if {$CEPH.CONNSTRING} is a session name.<br>**{$CEPH.CONNSTRING}** - connection string; can be a session name or a URI defined in the following format: <protocol(host:port)>. For URI only HTTPS schema is supported.<br>Examples: Prod, https://localhost:8003 (default)<br>**{$CEPH.USER}** - user to be used for monitoring (default:`zabbix`).<br>Required, if {$CEPH.CONNSTRING} is a URI.<br>Must be empty, if {$CEPH.CONNSTRING} is a session name.|Works with *Ceph* plugin; named sessions are supported.<br><br>1. Configure the Ceph RESTful Module according to [documentation](https://docs.ceph.com/en/latest/mgr/restful/).<br><br>2. Make sure a RESTful API endpoint is available for connection.|
|[Docker](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/docker/README.md)|\-|Works with *Docker* plugin; named sessions are not supported.<br><br>To set path to Docker API endpoint edit Plugins.Docker.Endpoint parameter in the agent 2 [configuration file](/manual/appendix/config/zabbix_agent2) (default: `Plugins.Docker.Endpoint=unix:///var/run/docker.sock`).<br><br>To test availability, run:<br>`zabbix_get -s docker-host -k docker.info`|
|[Memcached](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/memcached/README.md)|**{$MEMCACHED.CONN.URI}** - connection string in the URI format; port is optional; password is not used.<br>If not set, the plugin's default value is used: tcp://localhost:11211.<br>Examples: tcp://127.0.0.1:11211, tcp://localhost, unix:/var/run/memcached.sock.|Works with *Memcached* plugin; named sessions are supported.<br><br>To test availability, run:<br>`zabbix_get -s memcached-host -k memcached.ping`|
|[MongoDB cluster by Zabbix agent 2](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mongodb_cluster/README.md)|**{$MONGODB.CONNSTRING}** - connection string in the URI format; password is not used (default: tcp://localhost:27017).<br>Can be a session name or a URI defined in the following format: %% <protocol(host:port)>%%<br>For URI only TCP scheme is supported.<br>Examples: MongoDB1, tcp://172.16.0.10<br>**{$MONGODB.USER}**, **{$MONGODB.PASSWORD}** - MongoDB credentials (default: none).<br>If not set and {$MONGODB.CONNSTRING} is a URI, parameters from the configuration file will be used.<br>Must be empty, if {$MONGODB.CONNSTRING} is a session name.|Works with *MongoDB* plugin; named sessions are supported.<br>For MongoDB configuration instructions, see [plugins](/manual/config/items/plugins).<br>To test availability, run:<br>`zabbix_get -s mongos.node -k 'mongodb.ping["{$MONGODB.CONNSTRING}","{$MONGODB.USER}","{$MONGODB.PASSWORD}"]"`|
|[MongoDB node by Zabbix agent 2](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mongodb/README.md)|**{$MONGODB.CONNSTRING}** - connection string in the URI format; password is not used (default: tcp://localhost:27017).<br>Can be a session name or a URI defined in the following format: %% <protocol(host:port)>%%<br>For URI only TCP scheme is supported.<br>Examples: MongoDB1, tcp://172.16.0.10<br>**{$MONGODB.USER}**, **{$MONGODB.PASSWORD}** - MongoDB credentials (default: none).<br>If not set and {$MONGODB.CONNSTRING} is a URI, parameters from the configuration file will be used.<br>Must be empty, if {$MONGODB.CONNSTRING} is a session name.|Works with *MongoDB* plugin; named sessions are supported.<br>For MongoDB configuration instructions, see [plugins](/manual/config/items/plugins).<br>To test availability, run:<br>`zabbix_get -s mongodb.node -k 'mongodb.ping["{$MONGODB.CONNSTRING}","{$MONGODB.USER}","{$MONGODB.PASSWORD}"]"`|
|[MySQL by Zabbix agent 2](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/mysql_agent2/README.md)|**{$MYSQL.DSN}** - the system data source name of the MySQL instance (default: <Put your DSN>).<br>Can be a session name or a URI defined in the following format: %% <protocol(host:port or /path/to/socket)/>%%<br>For URI only TCP and Unix schemas are supported.<br>Examples: MySQL1, tcp://localhost:3306, tcp://172.16.0.10, unix:/var/run/mysql.sock<br>**{$MYSQL.USER}**, **{$MYSQL.PASSWORD}** - MySQL credentials (default: none). Required, if {$MYSQL.DSN} is a URI.<br>Must be empty, if {$MYSQL.DSN} is a session name.|Works with *MySQL* plugin; named sessions are supported.<br><br>To grant required privileges to a MySQL user that will be used for monitoring, run:<br>`GRANT USAGE,REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO '<username>'@'%';`<br><br>See MySQL documentation for information about [user privileges](https://dev.mysql.com/doc/refman/8.0/en/grant.html) and [Unix sockets](https://dev.mysql.com/doc/refman/8.0/en/problems-with-mysql-sock.html).|
|[Oracle by Zabbix agent 2](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/oracle_agent2/README.md)|**{$ORACLE.CONNSTRING}** - connection string; can be a session name or a URI defined in the following format: <protocol(host:port or /path/to/socket)/><br>For URI only TCP schema is supported.<br>Examples: Oracle1, tcp://localhost:1521<br><br>**{$ORACLE.SERVICE}** - Oracle Service name (default: ORA). Required, if {$ORACLE.CONNSTRING} is a URI.<br>Must be empty, if {$ORACLE.CONNSTRING} is a session name.<br><br>**{$ORACLE.USER}**, **{$ORACLE.PASSWORD}** - Oracle credentials (default username: zabbix, password: zabbix\_password). Required, if {$ORACLE.CONNSTRING} is a URI.<br>Must be empty, if {$ORACLE.CONNSTRING} is a session name.|Works with *Oracle* plugin; named sessions are supported.<br><br>Install [Oracle Instant Client](https://www.oracle.com/database/technologies/instant-client/downloads.html).<br>To create Oracle user with required privileges, run:<br>`CREATE USER zabbix_mon IDENTIFIED BY <PASSWORD>;`<br>`-- Grant access to the zabbix_mon user.`<br>`GRANT CONNECT, CREATE SESSION TO zabbix_mon;`<br>`GRANT SELECT ON DBA_TABLESPACE_USAGE_METRICS TO zabbix_mon;`<br>`GRANT SELECT ON DBA_TABLESPACES TO zabbix_mon;`<br>`GRANT SELECT ON DBA_USERS TO zabbix_mon;`<br>`GRANT SELECT ON SYS.DBA_DATA_FILES TO zabbix_mon;`<br>`GRANT SELECT ON V$ACTIVE_SESSION_HISTORY TO zabbix_mon;`<br>`GRANT SELECT ON V$ARCHIVE_DEST TO zabbix_mon;`<br>`GRANT SELECT ON V$ASM_DISKGROUP TO zabbix_mon;`<br>`GRANT SELECT ON V$DATABASE TO zabbix_mon;`<br>`GRANT SELECT ON V$DATAFILE TO zabbix_mon;`<br>`GRANT SELECT ON V$INSTANCE TO zabbix_mon;`<br>`GRANT SELECT ON V$LOG TO zabbix_mon;`<br>`GRANT SELECT ON V$OSSTAT TO zabbix_mon;`<br>`GRANT SELECT ON V$PGASTAT TO zabbix_mon;`<br>`GRANT SELECT ON V$PROCESS TO zabbix_mon;`<br>`GRANT SELECT ON V$RECOVERY_FILE_DEST TO zabbix_mon;`<br>`GRANT SELECT ON V$RESTORE_POINT TO zabbix_mon;`<br>`GRANT SELECT ON V$SESSION TO zabbix_mon;`<br>`GRANT SELECT ON V$SGASTAT TO zabbix_mon;`<br>`GRANT SELECT ON V$SYSMETRIC TO zabbix_mon;`<br>`GRANT SELECT ON V$SYSTEM_PARAMETER TO zabbix_mon;`|
|[PostgreSQL Agent 2](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/postgresql_agent2)|**{$PG.URI}** - connection string; can be a session name or a URI defined in the following format:<br>%% <protocol(host:port or /path/to/socket)/>%%. For URI only TCP and Unix schemas are supported.<br>Examples: Postgres1, tcp://localhost:5432, tcp://172.16.0.10<br>**{$PG.USER}**, **{$PG.PASSWORD}** - PostgreSQL credentials (default username: postgres, password:postgres).<br>Required, if {$PG.URI} is a URI. Must be empty, if {$PG.URI} is a session name.|Works with *PostgreSQL* plugin; named sessions are supported.<br><br>To create a user with required privileges, for PostgreSQL 10 and newer, run:<br>`CREATE USER 'zbx_monitor' IDENTIFIED BY '<password>';`<br>`GRANT EXECUTE ON FUNCTION pg_catalog.pg_ls_dir(text) TO zbx_monitor;`\\\\`GRANT EXECUTE ON FUNCTION pg_catalog.pg_stat_file(text) TO zbx_monitor;`<br><br>Edit pg\_hba.conf to allow connections from Zabbix agent (see [PostgreSQL documentation](https://www.postgresql.org/docs/current/auth-pg-hba-conf.html) for details).|
|[Redis](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/db/redis/README.md)|**{$REDIS.CONN.URI}** -connection string in the URI format; port is optional; password is not used.<br>If not set, the plugin's default value is used: tcp://localhost:6379|Works with *Redis* plugin; named sessions are supported.<br><br>To test availability, run:<br>`zabbix_get -s redis-master -k redis.ping`|
|[SMART by Zabbix agent 2](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/module/smart_agent2/README.md) / [SMART by Zabbix agent 2 active](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/module/smart_agent2_active)|\-|Sudo/root access rights to smartctl are required for the user executing Zabbix agent 2. The minimum required smartctl version is 7.1.<br><br>Disk discovery LLD rule finds all HDD, SSD, NVMe disks with S.M.A.R.T. enabled.<br><br>Attribute discovery LLD rule finds all Vendor Specific Attributes for each disk.<br><br>To skip some attributes, set regular expressions with disk names in {$SMART.DISK.NAME.MATCHES} and with attribute IDs in {$SMART.ATTRIBUTE.ID.MATCHES} on the host level.|
|[Systemd by Zabbix agent 2](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/systemd/README.md)|\-|No specific configuration is required.|
|[Website certificate by Zabbix agent 2](https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/certificate_agent2/README.md)|\*\* {$CERT.WEBSITE.HOSTNAME}\*\* - the website's DNS name for the connection (default: <Put DNS name>).|Works with *WebCertificate* plugin; named sessions are not supported.<br>To test availability, run:<br>`zabbix_get -s <zabbix_agent_addr> -k web.certificate.get[<website_DNS_name>]`<br><br>Create a separate host for the TLS/SSL certificate with Zabbix agent interface and link the template to this host.|

[comment]: # ({/new-7f0ac7a3})
