zabbix的部署原理 zabbix server須要把監控數據入sql數據庫,因此得Mysql環境 zabbix的web是基於php開發的,因此得LNMP環境 部署zabbix server和zabbix web zabbix的官網 https://www.zabbix.com/ Zabbix Server編譯安裝 yum install -y libevent-devel wget tar gcc gcc-c++ make net-snmp-devel libxml2-devel libcurl-devel useradd -s /sbin/nologin zabbix cd /usr/local/src/ wget 'https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.3/zabbix-4.0.3.tar.gz' tar -zxvf zabbix-4.0.3.tar.gz cd zabbix-4.0.3 ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 make && make install 選項說明 --prefix指定安裝目錄 --enable-server安裝zabbix server --enable-agent安裝zabbix agent --with-mysql用mysql來存儲 zabbix server的安裝驗證 環境變量設置:export PATH=$PATH:/usr/local/zabbix/sbin/:/usr/local/zabbix/bin/ 查看版本:zabbix_server --version zabbix server的啓動 須要到mysql裏作數據庫初始化 配置zabbix server,最主要是配置鏈接mysql的用戶名和密碼 啓動zabbix server Mysql數據庫初始化mysql -h 127.0.0.1 -uroot -pzabbixpwd -A create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@'127.0.0.1' identified by 'zabbixpwd'; flush privileges; set names utf8; use zabbix; source /usr/local/src/zabbix-4.0.3/database/mysql/schema.sql; source /usr/local/src/zabbix-4.0.3/database/mysql/data.sql; source /usr/local/src/zabbix-4.0.3/database/mysql/images.sql; zabbix server的配置/usr/local/zabbix/etc/zabbix_server.conf LogFile=/usr/local/zabbix/zabbix_server.log DBHost=127.0.0.1 DBName=zabbix DBUser=zabbix DBPassword=zabbixpwd DBPort=3306 Timeout=30 AlertScriptsPath=/usr/local/zabbix/alertscripts ExternalScripts=/usr/local/zabbix/externalscripts LogSlowQueries=3000 啓動zabbix server chown zabbix:zabbix -R /usr/local/zabbix/ zabbix_server Zabbix Web的安裝 mkdir /usr/local/nginx/html/zabbix cp -a /usr/local/src/zabbix-4.0.3/frontends/php/* /usr/local/nginx/html/zabbix/ 訪問zabbix web,須要作一些初始化配置 http://192.168.237.49/zabbix/ zabbix web須要php作配置優化 post_max_size = 32M max_execution_time = 350 max_input_time = 350 date.timezone = Asia/Shanghai always_populate_raw_post_data = -1 systemctl restart php-fpm 登陸zabbix 默認用戶名和密碼:Admin zabbix 禁用Zabbix server主機的監控 禁用guest用戶 更改Admin的密碼,改爲本身的密碼