====== 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 serversudo 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 * See [[https://www.zabbix.com/download?zabbix=5.0&os_distribution=debian&os_version=10_buster&db=mysql&ws=apache|Install and configure Zabbix server for your platform]] ===== Server Configuration ===== * Connect to your newly installed Zabbix frontend: http://server_ip_or_name/zabbix * Follow steps described in Zabbix [[https://www.zabbix.com/documentation/current/manual/installation/install#installing_frontend|documentation]] * In the last step you need to save the configuration. - Make /usr/share/zabbix/conf writeable for the apache2 user (www-data or bakuppc) - Rename the symbolic link then save the configuration - Move the configuration file to /etc/zabbix/web/ - Rename back the symbolic link - 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 [[deb9:apache#proxy|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= # 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. [[deb9:ufw|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 {{ :deb10:zbx_export_synodiskstation_1.zip |xml}} file from [[https://share.zabbix.com/storage-devices/synology/synology-diskstation|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 [[https://www.zabbix.com/download_agents|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 bootC:\> 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 === * [[https://kb.iu.edu/d/avza#:~:text=From%20the%20Start%20menu%2C%20select,the%20machine%20without%20the%20domain.|how do I find my computer's hostname]] * [[https://www.tecmint.com/install-zabbix-agent-and-add-windows-host-to-zabbix-monioring/|How to Install Zabbix Agent and Add Windows Host to Zabbix Monitoring]] ===== Links ===== * [[https://www.youtube.com/watch?v=jtLUGgMeh3E|How To Use ZABBIX Maps For Better Visualization]]