Zabbix Deploy

2025-05-11 zabbix 筆記 zabbix

部屬環境

  • Zabbix version: Zabbix-6
  • OS: Rocky Linux 9

安裝步驟

安裝 package

Rocky Linux 9

rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/9/x86_64/zabbix-release-6.0-4.el9.noarch.rpm
dnf clean all
dnf install zabbix-apache-conf
dnf install -y zabbix-server-pgsql zabbix-web-pgsql zabbix-sql-scripts zabbix-selinux-policy zabbix-agent 

Debian

wget https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-4%2Bdebian10_all.deb
dpkg -i zabbix-release_6.0-4+debian10_all.deb
apt update
apt install zabbix-server-pgsql zabbix-frontend-php php7.3-pgsql zabbix-apache-conf zabbix-sql-scripts zabbix-agent

匯入資料

  • 安裝資料庫

  • 設定資料庫

sudo -u postgres createuser --pwprompt zabbix
sudo -u postgres createdb -O zabbix zabbix
sudo -u postgres psql -c "GRANT ALL ON DATABASE zabbix to zabbix"
psql -U postgres -d zabbix
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO zabbix;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO zabbix;
# /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz
zcat server.sql.gz | sudo -u postgres psql zabbix
  • /etc/zabbix/zabbix_server.conf
DBPassword=Password

設定 zabbix

http://[ip]/zabbix

預設帳號密碼

Admin / zabbix

zabbix 繁體中文設定

  • 檢查有安裝繁體中文編碼
locale -a | grep "zh_TW"
  • /usr/share/zabbix/include/locales.inc.php
/**
 * Returns a list of all used locales.
 *
 * Each locale has the following properties:
 * - name       - the full name of the locale
 * - display    - whether to display the locale in the frontend
 *
 * @return array    an array of locales with locale codes as keys and arrays as values
 */
function getLocales(): array {
        return [
                'zh_TW' => ['name' => _('Chinese (zh_TW)'),     'display' => true],
        ];
}

啟動服務

systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm

Zabbix 監控 web

術語

  • web Scenario: web場景(站點)
  • web page :web頁麵,一個場景有多個頁麵
  • 內建key:要測一個頁麵,要測三個步驟(下邊3個內建key)

內建 key

  • web.test.in[Scenario,Step,bps]:傳輸速率
  • web.test.time[Scenario,Step]: 回響時長
  • web.test.rspcode[Scenario,Step]:回響碼

Zabbix Template 的平台

參考資料