码迷,mamicode.com
首页 > 其他好文 > 详细

zabbix

时间:2021-04-08 13:51:27      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:doc   png   config   insecure   eve   enter   request   虚拟   you   

zabbix服务端安装

环境:

主机 ip 应用
服务端 192.168.23.140 基于lamp架构下部署zabbix server, zabbix agent

准备工作

//安装依赖包
[root@localhost ~]# yum -y install net-snmp-devel libevent-devel

//下载zabbix(官方网站下载)
https://www.zabbix.com/cn/download_sources 
[root@localhost ~]# ls
anaconda-ks.cfg  lamp  zabbix-5.2.6.tar.gz

//解压
[root@localhost ~]# tar xf zabbix-5.2.6.tar.gz 
[root@localhost ~]# ls
anaconda-ks.cfg  lamp  zabbix-5.2.6  zabbix-5.2.6.tar.gz

//创建zabbix用户
[root@localhost ~]# useradd -r -M -s /sbin/nologin zabbix

//配置zabbix数据库
[root@localhost ~]# mysql -uroot -p
Enter password: 123456
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31 MySQL Community Server (GPL)
 
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
  
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.01 sec)
 
mysql>  grant all privileges on zabbix.* to zabbix@localhost identified by ‘123456‘;
Query OK, 0 rows affected, 1 warning (0.01 sec)
 
mysql>  grant all privileges on zabbix.* to zabbix@192.168.248.134 identified by ‘123456‘;
Query OK, 0 rows affected, 1 warning (0.01 sec)
 
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
 
mysql> quit


//导入表
[root@localhost database]# cd /usr/local/zabbix-5.2.6/database/mysql/
 
[root@localhost mysql]# ls
data.sql  double.sql  images.sql  Makefile.am  Makefile.in  schema.sql
 
[root@localhost mysql]# mysql -uroot -p123456 zabbix < schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
 
[root@localhost mysql]# mysql -uroot -p123456 zabbix < images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
 
[root@localhost mysql]# mysql -uroot -p123456 zabbix < data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

编译安装zabbix

[root@localhost ~]# cd /usr/local/zabbix-5.2.6/
[root@localhost zabbix-5.2.6]# ./configure --enable-server > --enable-agent > --with-mysql > --with-net-snmp > --with-libcurl > --with-libxml2

***********************************************************
*            Now run ‘make install‘                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************

[root@localhost zabbix-5.2.6]# make install

配置zabbix服务端

[root@localhost zabbix-5.2.6]# vim /usr/local/etc/zabbix_server.conf
.............................
.......................
BName=zabbix  
DBUser=zabbix
DBPassword=123456  //设置zabbix数据库的密码

//启动zabbix服务
[root@localhost zabbix-5.2.6]# zabbix_server
[root@localhost zabbix-5.2.6]# zabbix_agentd
[root@localhost zabbix-5.2.6]# ss -antl
State        Recv-Q       Send-Q              Local Address:Port                Peer Address:Port      
LISTEN       0            128                       0.0.0.0:22                       0.0.0.0:*         
LISTEN       0            128                       0.0.0.0:10050                    0.0.0.0:*         
LISTEN       0            128                       0.0.0.0:10051                    0.0.0.0:*         
LISTEN       0            128                       0.0.0.0:9000                     0.0.0.0:*         
LISTEN       0            80                              *:3306                           *:*         
LISTEN       0            128                             *:80                             *:*         
LISTEN       0            128                          [::]:22                          [::]:*

zabbix服务端web界面安装与配置

zabbix web界面安装前配置

//修改/etc/php.ini的配置并重启php-fpm
[root@localhost ~]# sed -ri ‘s/(post_max_size =).*/\1 16M/g‘ /etc/php.ini
[root@localhost ~]# sed -ri ‘s/(max_execution_time =).*/\1 300/g‘ /etc/php.ini
[root@localhost ~]# sed -ri ‘s/(max_input_time =).*/\1 300/g‘ /etc/php.ini
[root@localhost ~]# sed -i ‘/;date.timezone/a date.timezone = Asia/Shanghai‘ /etc/php.ini  //目前的版本可以不用此步
[root@localhost ~]# systemctl restart php-fpm

[root@localhost ~]# mkdir /usr/local/apache/htdocs/zabbix
[root@localhost ~]#  cp -a  /usr/local/zabbix-5.2.6/ui/*  /usr/local/apache/htdocs/zabbix/
[root@localhost ~]# chown -R apache.apache /usr/local/apache/htdocs

修改当前虚拟主机的配置文件

//修改虚拟主机配置的文件位置
[root@localhost ~]# vim /usr/local/apache/conf/httpd.conf

//在配置文件的末尾加如下内容

<VirtualHost *:80>
    DocumentRoot "/usr/local/apache/htdocs/zabbix"
    ServerName www.yc.com
    ProxyRequests Off
    ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/zabbix/$1
    <Directory "/usr/local/apache/htdocs/zabbix">
        Options none
        AllowOverride none
        Require all granted
    </Directory>
</VirtualHost>
 
//设置zabbix/conf目录的权限,让zabbix有权限生成配置文件zabbix.conf.php
[root@localhost ~]# chmod  777 /usr/local/apache/htdocs/zabbix/conf
 
//重启apache
[root@localhost ~]# apachectl -t
Syntax OK
[root@localhost ~]# apachectl restart

在web界面安装
技术图片

技术图片

技术图片

技术图片

接下来一直下一步即可
技术图片

  • zabbix默认登录用户名和密码:
用户名 密码
Admin zabbix

注:恢复zabbix/conf目录的权限为755

[root@localhost ~]# chmod  755 /usr/local/apache/htdocs/zabbix/conf

zabbix

标签:doc   png   config   insecure   eve   enter   request   虚拟   you   

原文地址:https://www.cnblogs.com/Ycqifei/p/14630342.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!