Zabbix

This guide is written when installing Zabbix V5.0.1. Terminology: Host and Client are equivalent, Server and Zabbix server are equivalent.

Repository

  • Install Zabbix repository
    # wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-1+buster_all.deb
    # dpkg -i zabbix-release_5.0-1+buster_all.deb
    # apt update
  • Replace buster with stretch for Debian 9

Server Installation

  • Install Zabbix server, frontend, agent
    # apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent
  • Create initial database
    # mysql -uroot -p
    password
    mysql> create database zabbix character set utf8 collate utf8_bin;
    mysql> create user zabbix@localhost identified by 'password';
    mysql> grant all privileges on zabbix.* to zabbix@localhost;
    mysql> quit;
  • Import initial schema and data. You will be prompted to enter your newly created password.
    # zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
  • Configure the database for Zabbix server
    sudo vim /etc/zabbix/zabbix_server.conf
    DBPassword=password
  • Configure PHP for Zabbix frontend, edit file /etc/zabbix/apache.conf, uncomment and set the right timezone for you.
  • Start Zabbix server and agent processes and make it start at system boot
    # systemctl restart zabbix-server zabbix-agent apache2
    # systemctl enable zabbix-server zabbix-agent apache2

Server Configuration

  • Connect to your newly installed Zabbix frontend: http://server_ip_or_name/zabbix
  • Follow steps described in Zabbix documentation
  • In the last step you need to save the configuration.
    1. Make /usr/share/zabbix/conf writeable for the apache2 user (www-data or bakuppc)
    2. Rename the symbolic link then save the configuration
    3. Move the configuration file to /etc/zabbix/web/
    4. Rename back the symbolic link
    5. If running under a default BackupPC installation change ownership of /etc/zabbix/web from www-data to backuppc

Apache Setup

  • If you run a separate server and want to make the web interface available, you need to setup a VirtualHost proxy on your main apache server. How this is done is described in Apache 2.4 and PHP 7.4

Clients Installation

Debian 10

Host

  • Install Zabbix agent
    # apt install zabbix-agent
  • Modify /etc/zabbix/zabbix_agentd.conf:
    #DenyKey=system.run[*]
    Server=192.168.x.x
    ServerActive=192.168.x.x
    Hostname=<hostname> # must be identical to the one used in Zabbix server configuration
  • Start Zabbix agent process and make it start at system boot
    # systemctl start zabbix-agent
    # systemctl enable zabbix-agent
  • Allow port 10050 in the host firewall, e.g. UFW Firewall
  • Allow port 10051 in the inter-zone firewall (if host is on different subnet than server), e.g. host → server, to allow active checks

Server

  • Create new host with interface Agent on IP address 192.168.x.x
  • Make sure the host name corresponds to Hostname in the configuration file of the host
  • Choose Linux servers as group
  • Choose Template OS Linux by Zabbix agent template under tab templates

Synology DSM6

Host

  • Enable SNMPv2 and set community name in Control Panel → Terminal & SNMP

Server

  • Create new host with interface SNMP
  • Import template xml file from Zabbix + Synology
  • Choose Templates as group
  • Choose Template Synology DiskStation template under tab templates
  • Set the {$SNMP_COMMUNITY} macro in host/macros tab

Windows 10

Host

  • Download Zabbix agent. Unzip and move to a folder, e.g. C:\zabbix.
  • Modify C:\zabbix\conf\zabbix_agentd.conf:
    #DenyKey=system.run[*]
    Server=192.168.x.x
    ServerActive=192.168.x.x
    #Hostname=Windows host
    HostnameItem=system.hostname # this is the Windows hostname, must be identical to the one used in Zabbix server configuration
  • Open a command prompt as administrator, start zabbix agent process and make it start at system boot
    C:\> C:\zabbix\bin\zabbix_agentd.exe -c C:\zabbix\conf\zabbix_agentd.conf -i
    C:\> C:\zabbix\bin\zabbix_agentd.exe -c C:\zabbix\conf\zabbix_agentd.conf -s
  • Open Windows firewall, select Change settings then Allow another app…, and browse to the agent executable, e.g. C:\zabbix\bin\zabbix_agentd.exe. Add the app to the firewall.

Server

  • Create new host with interface Agent
  • Make sure the host name corresponds to Hostname in the configuration file of the host
  • Choose Templates/Operating systems as group
  • Choose Template OS Windows by Zabbix agent template under tab templates

Links