Zabbix 4.0.2是一個長期支持版本(LTS),至少提供 5 年的技術支持;
下面簡單看一下Zabbix 4.0.2 新特徵
更具時效的監控項值檢查(Checking item value immediately)
新的 HTTP 監控項類型(New HTTP item type)
監控項原型能夠依賴於常規的監控項(Item prototypes can depend on regular items)
更靈活的主動式 Agent 自動註冊(More flexible active agent auto-registration)
支持 MySQL 8.0(MySQL 8.0 supported)
Elasticsearch 配置基於日期的索引(Date-based indices setup for Elasticsearch)php
172.16.8.76 qas-zabbix-node01
172.16.8.77 vip地址
172.16.8.78 qas-zabbix-node02 html
CentOS Linux release 7.5.1804 (Core) zabbix-4.0.2.tar.gz mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz jdk-8u181-linux-x64.tar.gz elasticsearch-6.5.1.tar.gz kibana-6.5.1-linux-x86_64.tar.gz
mysql安裝請參考相關連接:
Centos7.5安裝mysql5.7.24二進制包方式部署前端
相關連接 zabbix官網:https://www.zabbix.com/ zabbix下載:https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.0.2/zabbix-4.0.2.tar.gz/download
yum -y install gcc* make php php-gd php-mysql php-bcmath \ php-mbstring php-xml curl curl-devel net-snmp net-snmp-devel \ perl-DBI httpd mysql-devel libxml2-devel curl-devel unixODBC-devel \ net-snmp-devel OpenIPMI-devel openldap openldap-devel php-ldap libevent-devel
groupadd zabbix useradd -g zabbix zabbix mkdir -pv /app/zabbix4
tar -xvf zabbix-4.0.2.tar.gz cd zabbix-4.0.2 ./configure --prefix=/app/zabbix4 --enable-server --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc make && make install
create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix2018'; grant all privileges on zabbix.* to zabbix@"172.16.8.%" identified by 'zabbix2018'; FLUSH PRIVILEGES; 導入數據庫 cd /app/tools/zabbix-4.0.2/database/mysql/ mysql -uzabbix -pzabbix2018 zabbix < schema.sql mysql -uzabbix -pzabbix2018 zabbix < images.sql mysql -uzabbix -pzabbix2018 zabbix < data.sql
vim /etc/php.ini date.timezone= Asia/Shanghai max_execution_time = 300 post_max_size = 32M memory_limit = 128M mbstring.func_overload = 1 max_input_time = 300
cd /app/tools/zabbix-4.0.2/ cp -r frontends/php/ /var/www/html/zabbix ll /var/www/html/ chown -R apache.apache /var/www/html/zabbix/
建立相關目錄 mkdir /app/zabbix4/{tmp,logs,alertscripts,externalscripts} -p chown -R zabbix.zabbix /app/zabbix4 修配置文件以下: # grep -n ^[a-Z] /app/zabbix4/etc/zabbix_server.conf 38:LogFile=/app/zabbix4/logs/zabbix_server.log 68:PidFile=/app/zabbix4/tmp/zabbix_server.pid 94:DBName=zabbix 110:DBUser=zabbix 118:DBPassword=zabbix2018 125:DBSocket=/tmp/mysql.sock 465:Timeout=4 506:AlertScriptsPath=/app/zabbix4/alertscripts 515:ExternalScripts=/app/zabbix4/externalscripts 551:LogSlowQueries=3000
cd /app/tools/zabbix-4.0.2/ cp misc/init.d/fedora/core/zabbix_server /etc/init.d/ vim /etc/init.d/zabbix_server BASEDIR=/app/zabbix4
chkconfig --add zabbix_server chkconfig zabbix_server on systemctl enable httpd.service systemctl start httpd.service /etc/init.d/zabbix_server restart
http://172.16.8.76/zabbix/java
登錄默認用戶名:Admin,密碼:zabbix
node
tar -xvf jdk-8u181-linux-x64.tar.gz -C ../ cd /app/ mv jdk1.8.0_181/ jdk chown -R root.root jdk 編輯profile文件,添加jdk環境變量 vim /etc/profile JAVA_HOME=//app/jdk/jdk1.8.0_181 CLASSPATH=$JAVA_HOME/lib/ PATH=$PATH:$JAVA_HOME/bin export PATH JAVA_HOME CLASSPATH
tar -xvf elasticsearch-6.5.1.tar.gz -C ../ cd /app/ mv elasticsearch-6.5.1 elasticsearch6.5 chown -R zabbix.zabbix elasticsearch6.5 su - zabbix mkdir -p /app/elasticsearch6.5/data
su - zabbix node01 mkdir -p /app/elasticsearch6.5/data grep -n ^[a-Z] /app/elasticsearch6.5/config/elasticsearch.yml 17:cluster.name: app-zabbix 23:node.name: 172.16.8.76 33:path.data: /app/elasticsearch6.5/data 37:path.logs: /app/elasticsearch6.5/logs 43:bootstrap.memory_lock: true 55:network.host: 0.0.0.0 59:http.port: 9200 60:transport.tcp.port: 9300 69:discovery.zen.ping.unicast.hosts: ["172.16.8.76:9300", "172.16.8.78:9300"] 73:discovery.zen.minimum_master_nodes: 1 90:bootstrap.system_call_filter: false 91:http.cors.enabled: true 92:http.cors.allow-origin: "*"
node02 grep -n ^[a-Z] /app/elasticsearch6.5/config/elasticsearch.yml 17:cluster.name: app-zabbix 23:node.name: 172.16.8.78 33:path.data: /app/elasticsearch6.5/data 37:path.logs: /app/elasticsearch6.5/logs 43:bootstrap.memory_lock: true 55:network.host: 0.0.0.0 59:http.port: 9200 60:transport.tcp.port: 9300 69:discovery.zen.ping.unicast.hosts: ["172.16.8.76:9300", "172.16.8.78:9300"] 73:discovery.zen.minimum_master_nodes: 1 90:bootstrap.system_call_filter: false 91:http.cors.enabled: true 92:http.cors.allow-origin: "*"
vim /etc/security/limits.conf * soft nofile 65536 * hard nofile 131072 zabbix soft memlock unlimited zabbix hard memlock unlimited zabbix hard nproc 4096 zabbix soft nproc 4096
vim /etc/sysctl.conf vm.max_map_count=262144 vm.swappiness=1 用命令sysctl -p 生效 sysctl vm.max_map_count 查看值是否修改, 也能夠經過sysctl -w vm.max_map_count=262144 臨時設置值
./elasticsearch -d
由於head是一個用於管理Elasticsearch的web前端插件,該插件在es5版本之後採用獨立服務的形式進行安裝使用(以前的版本能夠直接在es安裝目錄中直接安裝),由於須要安裝nodejs、npm yum -y install nodejs npm git clone https://github.com/mobz/elasticsearch-head.git cd elasticsearch-head/ npm install
修改Gruntfile.js文件,修改服務監聽地址(增長hostname屬性,將其值設置爲*)
vim Gruntfile.js
git
修改head/_site/app.js,修改head鏈接es的地址(修改localhost爲本機的IP地址)
vim _site/app.js
github
啓動插件(後臺啓動方式) cd /app/elasticsearch-head/node_modules/grunt/bin nohup ./grunt server & exit 啓動成功後,可在瀏覽器訪問插件與ES進行交互 http://172.16.8.76:9100/
tar -xvf kibana-6.5.1-linux-x86_64.tar.gz -C ../ mv kibana-6.5.1-linux-x86_64/ kibana6.5 chown -R zabbix.zabbix kibana6.5 grep -n ^[a-Z] /app/kibana6.5/config/kibana.yml 2:server.port: 5601 7:server.host: "0.0.0.0" 28:elasticsearch.url: "http://172.16.8.78:9200"
直接訪問URLhttp://172.16.8.78:5601
web
vim /app/zabbix4/etc/zabbix_server.conf HistoryStorageURL=http://172.16.8.76:9200 HistoryStorageTypes=uint,dbl,str,log,text /etc/init.d/zabbix_server restart