微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

小白都能看懂的Linux系统下安装配置Zabbix

@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@# systemctl 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@#./configure --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 CHaraCTER 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 (configuration option "post_max_size").

@H_404_0@l   Minimum required limit on execution time of PHP scripts is 300 (configuration option "max_execution_time").

@H_404_0@l   Minimum required limit on input parse time for PHP scripts is 300 (configuration option "max_input_time").

@H_404_0@l   Time zone for PHP is not set (configuration parameter "date.timezone").

@H_404_0@l   At least one of MysqL, Postgresql, Oracle or IBM DB2 should be supported.

@H_404_0@l   PHP bcmath extension missing (PHP configuration parameter --enable-bcmath).

@H_404_0@l   PHP mbstring extension missing (PHP configuration parameter --enable-mbstring).

@H_404_0@l   PHP gd extension missing (PHP configuration parameter --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@#./configure --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] 举报,一经查实,本站将立刻删除。

相关推荐