首页 > 作文

zabbix监控部署

更新时间:2023-04-08 20:18:04 阅读: 评论:0

1. zabbix配置文件

zabbix配置文件有两种:

服务器端配置文件(/usr/local/etc/zabbix_rver.conf)客户端配置文件(/usr/local/etc/zabbix_agentd.conf)zabbix代理配置文件(/usr/local/etc/zabbix_proxy.conf)服务器端配置文件zabbix_rver.conf常用配置参数:参数作用LogFile设置服务端日志文件存放路径ListenIP设置服务端监听IPListenPort设置服务端监听的端口号PidFile设置服务端进程号文件存放路径DBHost指定zabbix的数据库服务器IPDBName指定zabbix使用的数据库库名DBUr指定zabbix数据库登录用户DBPassword指定zabbix数据库登录密码DBPort指定zabbix数据库端口号Ur设置zabbix以什么用户的身份运行AlertScriptsPath设置告警脚本存放路径ExternalScripts外部脚本存放路径

客户端配置文件zabbix_agentd.conf常用配置参数:

参数作用Server指定zabbix服务器的IP或域名ServerActive指定zabbix服务器的IP或域名Hostname指定本机的主机名,此项必须与web界面配置项一致UnsafeUrParameters是否启用自定义监控项,可选值为{1UrParameter指定自定义监控脚本参数LogFile设置客户端日志文件swing是什么意思存放路径

2.部署zabbix

环境说明:

环境IP要安装的应用服务器192.168.232.128lamp架构
zabbix rver
zabbix agent客户端192.168.232.130zabbix agent

安装依赖包

[root@wangyitong ~]# wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.1.tar.gz

下载zabbix与解压

[root@wangyitong ~]# wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.1.tar.gz[root@wangyitong ~]# lsanaconda-ks.cfg  lamp  zabbix-5.0.1.tar.gz[root@wangyitong ~]# tar xf zabbix-5.0.1.tar.gz

创建zabbix用户和组

[root@wangyitong ~]# uradd -r -M -s /sbin/nologin zabbix

配置zabbix数据库

[root@wangyitong ~]# mysql -uroot -p123456mysql: [Warning] Using a password on the command line interface can be inre.Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.30 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights rervOracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input state.mysql> create databa zabbix character t utf8 collate utf8_bin;Query OK, 1 row affected (0.01 c)mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix123';Query OK, 0 rows affected, 2 warnings (0.01 c)mysql> flush privileges;Query OK, 0 rows affected (0.02 c)mysql> quitBye[root@wangyitong ~]# cd zabbix-5.0.1/databa/mysql/[root@wangyitong mysql]# lsdata.sql  double.sql  images.sql  Makefile.am  Makefile.in  schema.sql[root@wa形态什么ngyitong mysql]# mysql -uzabbix -pzabbix123 zabbix < schema.sqlmysql: [Warning] Using a password on the command line interface can be incure.[root@wangyitong mysql]# mysql -uzabbix -pzabbix123 zabbix < images.sqlmysql: [Warning] Using a password on the command line interface can be incure.[root@wangyitong mysql]# mysql -uzabbix -pzabbix123 zabbix < data.sqlmysql: [Warning] Using a password on the command line interface can be incure.

编译安装zabbix

[root@wangyitong ~]# cd zabbix-5.0.1[root@wangyitong zabbix-5.0.1]# ./configure --enable-rver \> --enable-agent \> --with-mysql \> --with-net-snmp \> --with-libcurl \> --with-libxml2....[root@wangyitong zabbix-5.0.1]# make insatall

3.zabbix服务端配置

[root@wangyitong zabbix-5.0.1]# cd /usr/local/etc/[root@wangyitong etc]# lszabbix_agentd.conf    zabbix_rver.confzabbix_agentd.conf.d  zabbix_rver.conf.d[root@wangyitong etc]# vim zabbix_rver.confDBPassword=zabbix123      //设置zabbix数据库连接密码启动zabbix_rver和zabbix_agentd[root@wangyitong ~]# zabbix_rver [root@wangyitong ~]# zabbix_agentd[root@wangyitong ~]# ss -antlState      Recv-Q Send-Q Local Address:Port               Peer Address:Port              LISTEN     0      128         *:22                      *:*                  LISTEN     0      100    127.0.0.1:25                      *:*                  LISTEN     0      128         *:10050                   *:*                  LISTEN     0      128         *:10051                   *:*                  LISTEN     0      128    127.0.0.1:9000                    *:*                  LISTEN     0      128        :::80                     :::*                  LISTEN     0      128        :::22                     :::*                  LISTEN     0      100       ::1:25                     :::*                  LISTEN     0      80         :::3306                   :::*  

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

4.1 zabbix web界面安装前配置

修改/etc/php.ini的配置并重启php-fpm

root@wangyitong ~]# d -ri 's/(post_max_size =).*/ 16M/g' /etc/php.ini[root@wangyitong ~]# d -ri 's/(max_execution_time =).*/ 300/g' /etc/php.ini[root@wangyitong ~]# d -ri 's/(max_input_time =).*/ 300/g' /etc/php.ini[root@wangyitong ~]# d -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini[root@wangyitong ~]# rvice php-fpm restartGracefully shutting down php-fpm . doneStarting php-fpm  done

创建数据存放目录并修改目录属主和属组

[root@wangyitong ~]# cd zabbix-5.0.1[root@wangyitong zabbix-5.0.1]# lsaclocal.m4  conf           configure.ac  install-sh   misc     uiAUTHORS     config.guess   COPYING       m4           missingbin         config.log     databa      Makefile     NEWSbuild       config.status  depcomp       Makefile.am  READMEChangeLog   config.sub     include       如何分辨假钱Makefile.in  sasscompile     configure      INSTALL       man          src[root@wangyitong zabbix-5.0.1]# cp -r ui /usr/loca生命的思考l/apache/htdocs/zabbix[root@wangyitong zabbix-5.0.1]# cd /usr/local/apache/htdocs/[root@wangyitong htdocs]# lsindex.html  test.com  zabbix[root@wangyitong htdocs]# chown -R apache.apache zabbix/[root@wangyitong htdocs]# lltotal 8-rw-r--r--.  1 apache apache   45 Jun 12  2007 index.htmldrwxr-xr-x.  2 apache apache   23 Jul 16 01:40 test.comdrwxr-xr-x. 12 apache apache 4096 Jul 16 20:16 zabbix

配置apache虚拟主机

[root@wangyitong ~]# vim /etc/httpd24/httpd.conf#添加下面的内容<VirtualHost *:80>    DocumentRoot "/usr/local/apache/htdocs/zabbix"    ServerName www.wyt.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&世界旅游景点gt;</VirtualHost>

设置zabbix/conf目录的权限,让zabbix有权限生成配置文件zabbix.conf.php

[root@wangyitong ~]# chmod 777 /usr/local/apache/htdocs/zabbix/conf[root@wangyitong ~]# ll -d /usr/local/apache/htdocs/zabbix/confdrwxrwxrwx. 3 apache apache 94 Jul 16 20:16 /usr/local/apache/htdocs/zabbix/conf

重启服务

[root@wangyitong ~]# apachectl stop[root@wangyitong ~]# apachectl start[root@wangyitong ~]# rvice php-fpm restartGracefully shutting down php-fpm . doneStarting php-fpm  done[root@wangyitong ~]# rvice mysqld restartShutting down MySQL.. SUCCESS! Starting MySQL. SUCCESS! [root@wangyitong ~]# ss -antlState      Recv-Q Send-Q Local Address:Port               Peer Address:Port              LISTEN     0      128         *:22                      *:*                  LISTEN     0      100    127.0.0.1:25                      *:*                  LISTEN     0      128         *:10050                   *:*                  LISTEN     15     128         *:10051                   *:*                  LISTEN     0      128    127.0.0.1:9000                    *:*                  LISTEN     0      128        :::80                     :::*                  LISTEN     0      128        :::22                     :::*                  LISTEN     0      100       ::1:25                     :::*                  LISTEN     0      80         :::3306                   :::*   

4.2.安装zabbix web界面

修改/etc/hosts文件,添加域名与IP的映射

在浏览器上用IP访问进行安装:

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

[root@wangyitong ~]# chmod 755 /usr/local/apache/htdocs/zabbix/conf[root@wangyitong ~]# ll -d /usr/local/apache/htdocs/zabbix/confdrwxr-xr-x. 3 apache apache 117 Jul 16 21:05 /usr/local/apache/htdocs/zabbix/conf

5.登录zabbix

用户名: Admin
密码: zabbix

6.监控配置流程

6.1 添加主机组

## 6.2 添加主机

本文地址:https://blog.csdn.net/lnsistw/article/details/107360705

本文发布于:2023-04-08 20:17:58,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/e95a5eface34706870ae59e80793ae5a.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:zabbix监控部署.doc

本文 PDF 下载地址:zabbix监控部署.pdf

相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图