客户端(agent)负责采集数据发送到服务端(server)进行数据分析在存储到mysql,最后通过wed界面读取数据形成图像或报告。
wed界面自定义监控项,通过mysql传输到服务端(server)发送数据获取需求到客户端(agent),客户端发送数据到server
再到mysql,最后通过wed界面展示。
ip地址 | 服务器名 | 应用 |
---|---|---|
192.168.211.141 | server | |
192.168.211.136 | agent | |
192.168.211. | agent |
[root@master ~]# systemctl stop firewalld
[root@master ~]# setenforce 0
[root@master ~]# vim /etc/selinux/config
SELINUX=disabled
yum -y install httpd mariadb mariadb-server
yum install centos-release-scl
yum -y install rh-php72
yum -y install https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum install OpenIPMI OpenIPMI-libs OpenIPMI-modalias
yum install unixODBC fping -y
yum -y install rh-php72-php-mysqlnd
yum -y install rh-php72-php-bcmath rh-php72-php-fpm rh-php72-php-gd rh-php72-php-ldap rh-php72-php-mbstring
systemctl restart mariadb.service
systemctl enable mariadb.service
出现错误
yum -y install zabbix-server-mysql
错误:软件包:zabbix-server-mysql-3.0.25-1.el7.x86_64 (zabbix)
需要:libiksemel.so.3()(64bit)
错误:软件包:zabbix-server-mysql-3.0.25-1.el7.x86_64 (zabbix)
需要:fping
解决:
但是安装zabbix-server-mysql时报错,原因是缺少libiksemel.so.3()(64bit)和fping包。这是因为yum安装zabbix不仅需要配置zabbix包源,还需要配置好epel源和base源,base源我们有自带就不用说了。
这时我们需要配置epel源
yum -y install epel-release
mysql -uroot
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
grant all privileges on zabbix.* to zabbix@'%' identified by '123456' WITH GRAN
T OPTION;
flush privileges;
yum install zabbix-server-mysql
zcat /usr/share/doc/zabbix-server-mysql-5.0.9/create.sql.gz | mysql -u zabbix -p zabbix
[root@master ~]# vim /etc/zabbix/zabbix_server.conf
# DBHost=localhost //mysqlip如果在本机可以不改默认
systemctl restart zabbix-server zabbix-agent httpd mariadb rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd mariadb rh-php72-php-fpm
rpm -ivh zabbix-agent-5.0.0-1.el7.x86_64.rpm
或
yum install zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf //修改
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-jUZhT99z-1622518954377)(C:/Users/Administrator/AppData/Roaming/Typora/typora-user-images/image-20210601113304087.png)]
systemctl start zabbix-agent && systemctl enable zabbix-agent
netstat -lntp | grep 10050
netstat -lntp | grep 10051
下载zabbix-get
yum install zabbix-get
zabbix_agentd -p | grep system.cpu.load
zabbix_get -s 127.0.0.1 -p 10050 -k system.uname
zabbix_get -s 127.0.0.1 -p 10050 -k system.cpu.load[all,avg1]
yum install httpd
service httpd start
systemctl restart zabbix-server zabbix-agent httpd mariadb rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd mariadb rh-php72-php-fpm
systemctl restart mariadb
systemctl enable mariadb
systemctl enable zabbix-server.service
systemctl start zabbix-server.service
ps -ef |grep zabbix_server
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
[zabbix]
user = apache
group = apache
listen = /var/opt/rh/rh-php72/run/php-fpm/zabbix.sock
listen.acl_users = apache
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
php_value[session.save_handler] = files
php_value[session.save_path] = /var/opt/rh/rh-php72/lib/php/session/
php_value[max_execution_time] = 300
php_value[memory_limit] = 128M
php_value[post_max_size] = 16M
php_value[upload_max_filesize] = 2M
php_value[max_input_time] = 300
php_value[max_input_vars] = 10000
php_value[date.timezone] = Asia/shanghai
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
用谷歌浏览器访问http://ip//zabbix,界面如下:
填写配置文件密码
登录账号是Admn,密码是zabbix。
yum install zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf //修改
Server=192.168.211.141
systemctl restart zabbix-agent
systemctl status zabbix-agent
测试:
[root@master ~]# zabbix_get -s 192.168.211.139 -p 10050 -k system.uname
Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64