zabbix
zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
zabbix 主要由2部分构成 zabbix server和 zabbix agent
一、实验环境
两台虚拟机 server1:172.25.6.2 注:虚拟机必须联网 在真机上执行 [root@foundation6 ~]# iptables -t nat -I POSTROUTING -s 172.25.6.0/24 -j MASQUERADE
二、zabbix的安装及配置
-
zabbix的安装
阿里巴巴开源镜像站下载:https://developer.aliyun.com/packageSearch?word=php php-mbstring-5.4.16-46.el7.x86_64.rpm php-bcmath-5.4.16-46.el7.x86_64.rpm [root@server2 ~]# cd /etc/yum.repos.d [root@server2 yum.repos.d]# ls dvd.repo redhat.repo [root@server2 yum.repos.d]# vim zabbix.repo [root@server2 yum.repos.d]# yum install -y php-mbstring-5.4.16-46.el7.x86_64.rpm php-bcmath-5.4.16-46.el7.x86_64.rpm [root@server2 yum.repos.d]# yum install -y zabbix-agent.x86_64 zabbix-server-mysql.x86_64 zabbix-web.noarch zabbix-web
-
mysql创建库和用户
1.安装mariadb-server [root@server2 ~]# yum install -y mariadb-server 2.开启mysql [root@server2 ~]# systemctl start mariadb 3.创建用户 [root@server2 ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;#创建一个zabbix库并设置为utf8的字符编码格式 Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> create user 'zabbix'@'localhost' identified by 'westos'; #创建账户并设置密码 Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to 'zabbix'@'localhost'; #设置权限 Query OK, 0 rows affected (0.00 sec) 4.测试 [root@server2 ~]# mysql -uzabbix -pwestos zabbix Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [zabbix]>
![]()
-
zabbix的开启
1.导入表 [root@server2 ~]# cd /usr/share/doc/zabbix-server-mysql-4.0.23/ [root@server2 zabbix-server-mysql-4.0.23]# ls AUTHORS ChangeLog COPYING create.sql.gz NEWS README [root@server2 zabbix-server-mysql-4.0.23]# zcat create.sql.gz | mysql -uzabbix -pwestos zabbix #对表进行导入 [root@server2 zabbix-server-mysql-4.0.23]# cd /etc/zabbix/ [root@server2 zabbix]# ls web zabbix_agentd.conf zabbix_agentd.d zabbix_server.conf [root@server2 zabbix]# vim zabbix_server.conf 124 DBPassword=westos #在124行注释打开添加密码 2.开启zabbix [root@server2 zabbix]# systemctl start zabbix-server [root@server2 zabbix]# systemctl enable zabbix-server Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service. 3.开启apache [root@server2 conf.d]# systemctl enable --now httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. 4.配置时间 [root@server2 conf.d]# vim /etc/php.ini 878 date.timezone =Asia/Shanghai [root@server2 conf.d]#systemctl restart httpd
![]()
-
测试
浏览器访问172.25.6.2/zabbix
点击Next step