企业级监控系统zabbix—安装部署zabbix
1.安装zabbix
安装zabbix监控所需软件:
cd 4.4/
yum install zabbix-server-mysql-4.4.1-1.el7.x86_64.rpm zabbix-web-mysql-4.4.1-1.el7.noarch.rpm zabbix-web-4.4.1-1.el7.noarch.rpm php-* fping-3.10-1.el7.x86_64.rpm -y
2.配置数据库
yum install mariadb-server -y
systemctl start mariadb
mysql_secure_installation
进入到数据库中使用utf-8编码并对用户授权
mysql -uroot -p123
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost
-> identified by '123';
Query OK, 0 rows affected (0.00 sec)
导入zabbix数据库:
find / -name create.sql.gz
zcat /usr/share/doc/zabbix-server-mysql-4.4.1/create.sql.gz | mysql -uzabbix -p zabbix
查看导入的zabbix数据库:
mysql -uroot -p123
MariaDB [(none)]> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [zabbix]> show tables;
3.编辑zabbix的配置文件
修改数据库密码:
vim /etc/zabbix/zabbix_server.conf
124 DBPassword=123 #这里的密码是zabbix用户的密码,不是数据库的登陆密码(我设置的密码是相同的)
systemctl start zabbix-server
netstat -antlp
修改时区:
vim /etc/httpd/conf.d/zabbix.conf
20 php_value date.timezone Asia/Shanghai #修改时区为亚洲上海
systemctl start httpd
4.zabbix的web界面配置
浏览器访问172.25.254.1/zabbix/,进行zabbix的web界面配置
进入zabbix平台后,可以修改监控界面语言和登陆密码:
在zabbix-web页面看到zabbix-server不可用:这是因为zabbix-server自身也要添加zabbix-agent
yum install zabbix-agent-4.4.1-1.el7.x86_64.rpm -y
systemctl start zabbix-agent
netstat -antlp | grep 10050
systemctl restart zabbix-server
再次刷新页面,它就可用了
5.添加zabbix-agent
在server2中:
rpm -ivh zabbix-agent-4.4.1-1.el7.x86_64.rpm
在服务器端(zabbix web)添加监控:
手动创建主机:
查看到没有模版,需要手动添加:
添加完后,ZBX为灰色(不可用):
编辑agent配置文件
vim /etc/zabbix/zabbix_agentd.conf
98 Server=172.25.254.1 #zabbix被动模式要来取的ip地址(zabbix-server)
139 ServerActive=172.25.254.1 #zabbix主动模式要发送的ip地址(zabbix-server)
150 Hostname=server2
systemctl start zabbix-agent
netstat -antlp | grep 10050
注意:确保各个服务器中写好了解析(/etc/hosts)
在zabbix-server端:
cat /var/log/zabbix/zabbix_server.log
刷新页面,查看到ZBX变为绿色了: