CentOS上配置Zabbix-10319031
CentOS 7 搭建 ZabbixZabbix是一个基于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
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? y
... Success!
Disallow root login remotely? y
... Success!
Remove test database and access to it? y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? 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/”,进入初始界面,点击“下一步”
http://s4.运维网.com/wyfs02/M01/7F/D0/wKiom1ct4G2h3nb0AAD9mHP9EtE310.jpg
确定所有项OK,点击下一步
http://s3.运维网.com/wyfs02/M00/7F/CE/wKioL1ct4UnR447PAAHBh1kgJKk903.jpg
http://s1.运维网.com/wyfs02/M01/7F/CE/wKioL1ct4UrSDPyPAAFocCdI994750.jpg
http://s3.运维网.com/wyfs02/M02/7F/D0/wKiom1ct4HKhdQqiAAElx4Mk9PA862.jpg
http://s5.运维网.com/wyfs02/M02/7F/CE/wKioL1ct4U7w1bYmAAFuJrDzJvs479.jpg
http://s5.运维网.com/wyfs02/M00/7F/D0/wKiom1ct4HXSDnfqAAEXZZmm4J8890.jpg
进入登录页,默认用户admin、密码zabbix
http://s3.运维网.com/wyfs02/M00/7F/D0/wKiom1ct4HaTron3AAC5H8Bn4Yw272.jpg
http://s3.运维网.com/wyfs02/M01/7F/D0/wKiom1ct4HniudBCAAMUb3rInVA137.jpg
修改admin密码,配置Zabbix 的SMTP
http://s2.运维网.com/wyfs02/M02/7F/D0/wKiom1ct4H3ALCqHAALvWBbjPNk164.jpg
http://s1.运维网.com/wyfs02/M02/7F/CE/wKioL1ct4VjT33pAAAGpMWlJZW4563.jpg
http://s1.运维网.com/wyfs02/M01/7F/CE/wKioL1ct4V3T8TrpAAFwKBPR_as366.jpg
http://s1.运维网.com/wyfs02/M01/7F/D0/wKiom1ct4ISBGX_aAAE4oLS2lWM508.jpg
http://s2.运维网.com/wyfs02/M02/7F/CE/wKioL1ct4V_gr4EPAAD45NTJkj8015.jpg
http://s2.运维网.com/wyfs02/M01/7F/CE/wKioL1ct4WDyolAhAAELAHxzBbw397.jpg
设置监控目标主机
http://s4.运维网.com/wyfs02/M00/7F/CE/wKioL1ct4WOTZMlPAAJvK0yl2Do675.jpg
如果状态显示Enable,表明已经被监控了
http://s4.运维网.com/wyfs02/M02/7F/CE/wKioL1ct4WSBGhkmAAEGono6CVI659.jpg
查看监控画面
http://s5.运维网.com/wyfs02/M00/7F/CE/wKioL1ct4WazjYopAAIoUpjP9Ec011.jpg
http://s2.运维网.com/wyfs02/M02/7F/D0/wKiom1ct4I-wf297AALSHFt8qdQ350.jpg
监控其他主机
安装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
http://s2.运维网.com/wyfs02/M01/7F/D0/wKiom1ct4JLyhOjVAAJ8piMyIYM909.jpg
http://s5.运维网.com/wyfs02/M00/7F/D0/wKiom1ct4JWR-PIgAAJ0Xl4FBAg376.jpg
http://s1.运维网.com/wyfs02/M01/7F/D0/wKiom1ct4JfhW7vfAAF2WD4xWhI615.jpg
http://s2.运维网.com/wyfs02/M02/7F/CE/wKioL1ct4XOw7-O7AAG6V_HPc7o904.jpg
http://s2.运维网.com/wyfs02/M02/7F/D0/wKiom1ct4JqS-DxzAAFHJMpyVqo277.jpg
http://s2.运维网.com/wyfs02/M00/7F/CE/wKioL1ct4XXxnAYOAAEEz4UTX7Q815.jpg
http://s5.运维网.com/wyfs02/M01/7F/D0/wKiom1ct4Jzyxz5jAAF2seusbXw650.jpg
查看监控数据
http://s3.运维网.com/wyfs02/M02/7F/D0/wKiom1ct4J7TE0EDAAHA2vY84WU420.jpg
http://s2.运维网.com/wyfs02/M00/7F/D0/wKiom1ct4KWROsJ2AARoncLuVAw867.jpg
http://s3.运维网.com/wyfs02/M01/7F/D0/wKiom1ct4KvDmFCwAAP4xyRTReY640.jpg
设置邮件通知
http://s2.运维网.com/wyfs02/M00/7F/D0/wKiom1ct4K2hFKXiAAH1Gx07PYU540.jpg
http://s3.运维网.com/wyfs02/M02/7F/CE/wKioL1ct4YmT_E8jAAFLJl5Q628120.jpg
http://s1.运维网.com/wyfs02/M00/7F/D0/wKiom1ct4LCA6FBNAAFQU6IVWtA147.jpg
http://s4.运维网.com/wyfs02/M01/7F/CE/wKioL1ct4YyR-76tAAGvumlf22c395.jpg
http://s4.运维网.com/wyfs02/M02/7F/D0/wKiom1ct5LOyFiluAAE3KnH4OVA376.jpg
页:
[1]