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)
172.16.8.76 qas-zabbix-node01
172.16.8.77 vip地址
172.16.8.78 qas-zabbix-node02
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/
登陆默认用户名:Admin,密码:zabbix
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
http://172.16.8.76:9200/
http://172.16.8.78:9200/
因为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
修改head/_site/app.js,修改head连接es的地址(修改localhost为本机的IP地址)
vim _site/app.js
启动插件(后台启动方式)
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
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
转载于:https://blog.51cto.com/10880347/2324788