@H_
404_0@实验环境:
@H_
404_0@操作系统:Centos 7.6
@H_
404_0@服务器ip:192.168.10.100
@H_
404_0@运行
用户:root
@H_
404_0@网络环境:Internet
@H_
404_0@Zabbix是
一个基于web界面的提供分布式系统监控及网络
功能的企业级的开源监控工具,做为
一个企业运维人员来说,zabbix可以给企业和运维人员带来很大的帮助,zabbix是
一个功能非常强大、跨平台、开源的企业级运维管理系统,由2部分构成:zabbix服务端和客户端(agentd),也可以通过系统
自带的SNMP来采集数据。
@H_
404_0@

@H_
404_0@Zabbix可以部署在Windows、
Linux、unix、MAC OS等平台上,可以监控任何网络设备、操作系统、中间件、
数据库等,做为
一个企业的运维技术人来说,监控是非常重要的,确保线上业务能够稳定运行,企业线上运行的和服务器网络设备等多不少,所以,我们可以通过监控发现服务器故障,方便运维人员技术发现问题和
解决问题,并且可以通过企业微信、企业QQ、企业钉钉、短信实现报警
功能,有故障可以及时的通过
管理员;开源的监控系统还有nagios、cacti、ganglia,我们
在这里只详细的介绍zabbix监控,不过要想搭建zabbix监控系统还是需要有Linux技术,要有对Linux有所了解并且熟悉一些常见的命令及配置,现在企业运维也是必不可少的,如果想往运维方向发展的可以去了解下
《Linux就该这么学》这边教程,里面的
内容非常详细,比较适合初学者,如果觉得自己有Linux基础可以参考下面的安装步骤,通过源码来编译部署并配置zabbix企业运维监控系统。
@H_
404_0@
@H_
404_0@1、install
PHP //通过yum源安装
PHP及一些与
PHP相关的库
@H_
404_0@# yum install
PHP.x86_64
PHP-cli.x86_64
PHP-fpm
PHP-gd
PHP-json
PHP-ldap
PHP-mbstring
PHP-
MysqLnd
PHP-xml
PHP-xmlrpc
PHP-opcache
PHP-simplexml
PHP-bcmath.x86_64 -y
@H_
404_0@
@H_
404_0@2、install database //yum源安装
MysqL(Mariadb)
数据库服务端和客户端
@H_
404_0@# yum install mariadb.x86_64 mariadb-devel.x86_64 mariadb-server.x86_64 -y
@H_
404_0@# sy
stemctl start mariadb.service //启动
数据库
@H_
404_0@
@H_
404_0@3、初始化
数据库
@H_
404_0@[root@localhost ~]#
MysqL_secure_installation
@H_
404_0@NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
@H_
404_0@ SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
@H_
404_0@In order to log into MariaDB to secure it, we'll need the current
@H_
404_0@password for the root user. If you've just installed MariaDB, and
@H_
404_0@you haven't set the root password yet, the password will be blank,
@H_
404_0@so you should just press enter here.
@H_
404_0@
@H_
404_0@Enter current password for root (enter for none):
@H_
404_0@OK, successfully used password, moving on...
@H_
404_0@
@H_
404_0@Setting the root password ensures that nobody can log into the MariaDB
@H_
404_0@root user without the proper authorisation.
@H_
404_0@
@H_
404_0@Set root password? [Y/n] y
@H_
404_0@New password:
@H_
404_0@Re-enter new password:
@H_
404_0@Password updated successfully!
@H_
404_0@Reloading privilege tables..
@H_
404_0@ ... Success!
@H_
404_0@
@H_
404_0@By default, a MariaDB installation has an anonymous user, allowing anyone
@H_
404_0@to log into MariaDB without having to have a user account created for
@H_
404_0@them. This is intended only for testing, and to make the installation
@H_
404_0@go a bit smoother. You should remove them before moving into a
@H_
404_0@production environment.
@H_
404_0@
@H_
404_0@Remove anonymous users? [Y/n] y
@H_
404_0@ ... Success!
@H_
404_0@
@H_
404_0@
normally, root should only be allowed to connect from 'localhost'. This
@H_
404_0@ensures that someone cannot guess at the root password from the network.
@H_
404_0@
@H_
404_0@
disallow root login remotely? [Y/n] n
@H_
404_0@ ... skipping.
@H_
404_0@
@H_
404_0@By default, MariaDB comes with a database named 'test' that anyone can
@H_
404_0@access. This is also intended only for testing, and should be removed
@H_
404_0@before moving into a production environment.
@H_
404_0@
@H_
404_0@Remove test database and access to it? [Y/n] n
@H_
404_0@ ... skipping.
@H_
404_0@
@H_
404_0@Reloading the privilege tables will ensure that all changes made so far
@H_
404_0@will take effect immediately.
@H_
404_0@
@H_
404_0@Reload privilege tables
Now? [Y/n] y
@H_
404_0@ ... Success!
@H_
404_0@
@H_
404_0@Cleaning up...
@H_
404_0@
@H_
404_0@All done! If you've completed all of the above steps, your MariaDB
@H_
404_0@installation should
Now be secure.
@H_
404_0@
@H_
404_0@Thanks for using MariaDB!
@H_
404_0@
@H_
404_0@3、install apache //yum源安装apache
@H_
404_0@# yum install httpd.x86_64 -y
@H_
404_0@4、install zabbix_server //源码安装zabbix服务端和客户端
@H_
404_0@# tar -zxvf zabbix-3.4.9.tar.gz && cd zabbix-3.4.9
@H_
404_0@# groupadd zabbix && useradd -g zabbix Zabbix //创建zabbix
用户及组
@H_
404_0@#./con
figure --prefix=/usr/local/zabbix user=zabbix group=zabbix --enable-server --enable-agent --enable-proxy --with-
MysqL --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 //配置编译
@H_
404_0@# make install //编译通过后安装zabbix server
@H_
404_0@
@H_
404_0@5、创建zabbix
数据库及zabbix
数据库用户并授权
@H_
404_0@[root@zabbix ~]#
MysqL -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 10 Server version: 5.5.47-MariaDB MariaDB Server
copyright (c) 2000, 2015, 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 CH
araCTER SET utf8 COLLATE utf8_bin;
@H_
404_0@Query OK, 1 row affected (0.00 sec)
@H_
404_0@MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY "password";
@H_
404_0@Query OK, 0 rows affected (0.00 sec)
@H_
404_0@MariaDB [(none)]> FLUSH PRIVILEGES;Q
@H_
404_0@uery OK, 0 rows affected (0.00 sec)
@H_
404_0@MariaDB [(none)]> exit Bye
@H_
404_0@
@H_
404_0@

@H_
404_0@
@H_
404_0@6、导入zabbix
默认
数据库:
@H_
404_0@#cd /root/zabbix-3.4.9/database/
MysqL
@H_
404_0@#
MysqL -uroot -p zabbix < schema.
sql &&
MysqL -uroot -p zabbix < images.
sql &&
MysqL -uroot -p zabbix < data.
sql
@H_
404_0@
@H_
404_0@7、编辑
默认安装
配置文件
@H_
404_0@# vim /usr/local/etc/zabbix_server.conf
@H_
404_0@# vim /usr/local/zabbix/etc/zabbix_server.conf
@H_
404_0@ListenPort=10051 //监听端口
@H_
404_0@DBHost=localhost //
数据库服务器
@H_
404_0@
dbname=Zabbix //
数据库名
@H_
404_0@DBUser=Zabbix //
数据库用户名
@H_
404_0@DBPassword=password //
数据库密码
@H_
404_0@
@H_
404_0@8、编辑并配置zabbix启动脚本,并设置开机
自动启动
@H_
404_0@#cd /root/zabbix-3.4.9/misc/init.d/tru64
@H_
404_0@# cp -r /root/zabbix-3.4.9/misc/init.d/tru64/zabbix_* /etc/init.d/
@H_
404_0@# chmod +x /etc/init.d/zabbix*
@H_
404_0@#chown -R zabbix:zabbix /usr/local/zabbix
@H_
404_0@# cp -r /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/
@H_
404_0@#/etc/init.d/zabbix_server restart
@H_
404_0@#/etc/init.d/zabbix_agentd restart
@H_
404_0@
@H_
404_0@9、拷贝zabbix web端
文件到apache根目录下面
@H_
404_0@#cd /root/zabbix-3.4.9/frontends/
@H_
404_0@# mkdir -p /var/www/html/zabbix/
@H_
404_0@#cp -ra
PHP/* /var/www/html/zabbix/
@H_
404_0@
@H_
404_0@10、访问web端
@H_
404_0@
http://ip/zabbix
@H_
404_0@
@H_
404_0@
错误如下:
@H_
404_0@l Minimum
required size of
PHP post is 16M (con
figuration option "post_max_size").
@H_
404_0@l Minimum
required limit on execution time of
PHP scripts is 300 (con
figuration option "max_execution_time").
@H_
404_0@l Minimum
required limit on input parse time for
PHP scripts is 300 (con
figuration option "max_input_time").
@H_
404_0@l Time zone for
PHP is not set (con
figuration p
arameter "date.timezone").
@H_
404_0@l At least one of
MysqL, Postgre
sql, Oracle or IBM DB2 should be supported.
@H_
404_0@l
PHP bcmath extension missing (
PHP con
figuration p
arameter --enable-bcmath).
@H_
404_0@l
PHP mbstring extension missing (
PHP con
figuration p
arameter --enable-mbstring).
@H_
404_0@l
PHP gd extension missing (
PHP con
figuration p
arameter --with-gd).
@H_
404_0@l
PHP gd PNG image support missing.
@H_
404_0@l
PHP gd JPEG image support missing.
@H_
404_0@l
PHP gd FreeType support missing.
@H_
404_0@l
PHP xmlwriter extension missing.
@H_
404_0@l
PHP xmlreader extension missing.
@H_
404_0@

@H_
404_0@
@H_
404_0@

@H_
404_0@
@H_
404_0@

@H_
404_0@
@H_
404_0@
解决步骤:
@H_
404_0@
#vim /etc/PHP.ini
@H_
404_0@
post_max_size8M16M
@H_
404_0@
max_execution_time30300
@H_
404_0@
max_input_time60300
@H_
404_0@
date.timezone = Asia/Shanghai
@H_
404_0@
@H_
404_0@
#systemctl restart httpd.service
@H_
404_0@

@H_
404_0@
@H_
404_0@

@H_
404_0@
@H_
404_0@

@H_
404_0@
@H_
404_0@

@H_
404_0@
@H_
404_0@

@H_
404_0@
@H_
404_0@
@H_
404_0@
@H_
404_0@
@H_
404_0@
@H_
404_0@先下载zabbix.conf.
PHP配置文件,再把下载的zabbix.conf.
PHP配置的
配置文件上传到/var/www/html/zabbix/conf/目录下。
@H_
404_0@
@H_
404_0@
#systemctl restart httpd.service //重启apache 服务
@H_
404_0@

@H_
404_0@
@H_
404_0@11、
管理员信息
@H_
404_0@user/password:Admin/Zabbix //Zabbix 前端
默认
用户名和
密码,如果是企业使用搭建成功后一定要
修改密码,也可以把
用户名修改这样安全些。
@H_
404_0@
@H_
404_0@12、client install zabbix_agentd //源码编译安装zabbix_agentd客户端
@H_
404_0@#./con
figure --prefix=/usr/local/zabbix --enable-agent
@H_
404_0@# make install
@H_
404_0@
@H_
404_0@13、
修改agentd
配置文件
@H_
404_0@# vim /usr/local/zabbix/etc/zabbix_agentd.conf
@H_
404_0@LogFile=/usr/local/zabbix/log/zabbix_agentd.log
@H_
404_0@EnableRemoteCommands=0
@H_
404_0@Server=192.168.10.100
@H_
404_0@ServerActive=192.168.10.100
@H_
404_0@Hostname=192.168.10.100
@H_
404_0@Timeout=30
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。