CentOS 7 搭建 Zabbix
Zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
实验环境:CentOS 7
实验步骤:
一、搭建LAMP环境
#yum -y install httpd php php-mbstring php-pear mariadb-server php-mysql php-gd php-xml php-bcmath
配置Apache
#rm -rf /etc/httpd/conf.d/welcome.conf
#vim /etc/httpd/conf/httpd.conf
#line 95: change to your server’s name(修改主机名)
ServerName www.server.world:80
#systemctl start httpd
#systemctl enable httpd
#firewall-cmd –add-service=http –permanent
#firewall-cmd –reload
配置PHP
# vim /etc/php.ini
#line 878: uncomment and add your timezone(修改时区)
date.timezone = “Asia/Shanghai”
重启Apache服务
#systemctl restart httpd
初始化MariDB
#systemctl start mariadb
#systemctl enable mariadb
#mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
Remove anonymous users? [Y/n] y
… Success!
Disallow root login remotely? [Y/n] y
… Success!
Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reload privilege tables now? [Y/n] y
… Success!
Thanks for using MariaDB!
二、安装Zabbix
#yum-y install http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
#yum -y install zabbix-get zabbix-server-mysql zabbix-web-mysql zabbix-agent
配置建立数据库
#mysql -u root -p
Enter password:
MariaDB [(none)]> create database zabbix;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@’%’ identified by ‘zabbix’;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
导入数据库
#cd /usr/share/doc/zabbix-server-mysql-3.0.2/
# gunzip create.sql.gz
# mysql -u root -p zabbix < create.sql
Enter password:
配置启动Zabbix
# vi /etc/zabbix/zabbix_server.conf
# line 82: add
DBHost=localhost
# line 116: add DB password for Zabbix
DBPassword=zabbix
#systemctl start zabbix-server
#systemctl enable zabbix-server
配置启动Zabbix agent监控
#vim /etc/zabbix/zabbix_agentd.conf
# line 95: specify Zabbix server
Server=127.0.0.1
# line 136: specify Zabbix server
ServerActive=127.0.0.1
# line 147: change to the own hostname
Hostname=www.server.world
#systemctl start zabbix-agent
#systemctl enable zabbix-agent
修改Apache配置
#vim /etc/httpd/conf.d/zabbix.conf
# line 10: add access permittion for Zabbix Web frontend
#Require all granted
Require ip 127.0.0.1 192.168.1.0/24
# line 20: uncomment and change to your timezone
php_value date.timezone Asia/Shanghai
重启服务
#systemctl restart httpd
初始化安装
在浏览器中访问“http://Zabbix server’s hostname or IP address/zabbix/”,进入初始界面,点击“下一步”
确定所有项OK,点击下一步
进入登录页,默认用户admin、密码zabbix
修改admin密码,配置Zabbix 的SMTP
设置监控目标主机
如果状态显示Enable,表明已经被监控了
查看监控画面
监控其他主机
安装zabbix-agent
#yum-yinstallhttp://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
# yum -y install zabbix-agent
#vim /etc/zabbix/zabbix_agentd.conf
# line 95: specify Zabbix server
Server=192.168.1.120
# line 136: specify Zabbix server
ServerActive=192.168.1.120
# line 147: change to the own hostname
Hostname=node01.server.world
#systemctl start zabbix-agent
#systemctl enable zabbix-agent
登录zabbix
查看监控数据
设置邮件通知
转载于:https://blog.51cto.com/10329031/1771070
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/109034.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...