Zabbix Documentation 5.0 (current)| In development:5.2 (devel)| Unsupported:

User Tools

Site Tools



Zabbix agent template operation

Steps to ensure correct operation of templates that collect metrics with Zabbix agent:

1. Make sure that Zabbix agent is installed on the host. For active checks, also make sure that the host is added to the 'ServerActive' parameter of the agent configuration file.
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 file (accessible by clicking on a template name).
Template nameMandatory macrosAdditional steps/comments
Template App Apache by Zabbix agent {$APACHE.STATUS.HOST} - the hostname or IP address of Apache status page (default:
{$APACHE.STATUS.PATH} - the URL path (default: server-status?auto)
{$APACHE.STATUS.PORT} - the port of Apache status page (default: 80)
Apache module mod_status should be set (see Apache documentation for details).
To check availability, run:
httpd -M 2>/dev/null | grep status_module

Apache configuration example:
<Location “/server-status”>
SetHandler server-status
Require host
Template App HAProxy by Zabbix agent {$HAPROXY.STATS.PATH} - the path of HAProxy Stats page (default: stats)
{$HAPROXY.STATS.PORT} - the port of HAProxy Stats host or container (default: 8404)
{$HAPROXY.STATS.SCHEME} - the scheme of HAProxy Stats page. Supported: http (default), https
HAProxy Stats page should be set up (see HAProxy blog post for details or template's for configuration example).
Template App IIS by Zabbix agent / Template App IIS by Zabbix agent active {$IIS.PORT} - the port IIS Server listens on (default: 80)
{$IIS.SERVICE} - the service for port check (default: http). See net.tcp.service section for details.
The server should have the following roles:
Web Server
IIS Management Scripts and Tools

See IIS documentation for details.
Template App Nginx by Zabbix agent {$NGINX.STUB_STATUS.HOST} - the hostname or IP address of Nginx stub_status host or container (default: localhost)
{$NGINX.STUB_STATUS.PATH} - the path of Nginx stub_status page (default: basic_status)
{$NGINX.STUB_STATUS.PORT} - the port of Nginx stub_status host or container (default: 80)
ngx_http_stub_status_module should be set up (see Nginx documentation for details or template's for configuration example).
To check availability, run:
nginx -V 2>&1 | grep -o with-http_stub_status_module
Template App RabbitMQ cluster by Zabbix agent {$RABBITMQ.API.CLUSTER_HOST} - the hostname or IP address of RabbitMQ cluster API endpoint (default:
{$RABBITMQ.API.USER}, {$RABBITMQ.API.PASSWORD} - RabbitMQ login credentials (default username: zbx_monitor, password: zabbix)
Enable RabbitMQ management plugin (see RabbitMQ documentation).

To create a RabbitMQ user with nessesary permissions for monitoring, run:
rabbitmqctl add_user zbx_monitor <PASSWORD>
rabbitmqctl set_permissions -p / zbx_monitor "" "" ".*"
rabbitmqctl set_user_tags zbx_monitor monitoring

If the cluster consists of several nodes, it is recommended to assign the cluster template to a separate balancing host. In case of a single-node installation, the cluster template can be assigned to the host with a node template.
Template DB MySQL {$MYSQL.HOST} - the hostname or IP address of MySQL host or container (default: localhost)
{$MYSQL.PORT} - the database service port (default: 3306)
1. If necessary, add the path to the mysql and mysqladmin utilities to the global environment variable PATH.

2. Copy the template_db_mysql.conf file from templates directory of Zabbix into folder with Zabbix agent configuration (/etc/zabbix/zabbix_agentd.d/ by default) and restart Zabbix agent.

3. Create MySQL user zbx_monitor. To grant required priveleges to the user, run:
(see MYSQL documentation for details).

4. Create .my.cnf in the home directory of Zabbix agent for Linux (/var/lib/zabbix by default ) or my.cnf in c:\ for Windows. The file must have three strings:
Template DB PostgreSQL {$PG.DB} - the database name to connect to the server (default: postgres)
{$PG.HOST} - the database server host or socket directory (default:
{$PG.PORT} - the database server port (default: 5432)
{$PG.USER} - the database username (default: zbx_monitor)
1. Create a read-only user zbx_monitor with proper access to PostgreSQL server. For PostgreSQL 10 and newer, run:
GRANT pg_monitor TO zbx_monitor;
For older PostgreSQL versions, run:
GRANT SELECT ON pg_stat_database TO zbx_monitor;

2. Copy postgresql/ to Zabbix agent home directory (/var/lib/zabbix/).

3. Copy template_db_postgresql.conf from templates directory of Zabbix to Zabbix agent configuration directory (/etc/zabbix/zabbix_agentd.d/) and restart Zabbix agent.

4. Edit pg_hba.conf to allow connections from Zabbix agent (see PostgreSQL documentation for details).
Row examples:
host all zbx_monitor trust
host all zbx_monitor md5
host all zbx_monitor ::0/0 md5

5. To monitor a remote server, create a .pgpass file in Zabbix agent home directory (/var/lib/zabbix/) and add rows with the instance, port, database, user and password information (see PostgreSQL documentation for details).
Row examples: