监控服务zabbix部署

监控服务zabbix部署

1. zabbix介绍

zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。

zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。

zabbix由2部分构成,zabbix server与可选组件zabbix agent

zabbix server可以通过SNMPzabbix agentping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Ubuntu,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。

zabbix agent需要安装在被监视的目标服务器上,它主要完成对硬件信息或与操作系统有关的内存,CPU等信息的收集。

zabbix server可以单独监视远程服务器的服务状态;同时也可以与zabbix agent配合,可以轮询zabbix agent主动接收监视数据(agent方式),同时还可被动接收zabbix agent发送的数据(trapping方式)。
另外zabbix server还支持SNMP (v1,v2),可以与SNMP软件(例如:net-snmp)等配合使用。

2. zabbix特点

zabbix的主要特点:

  • 安装与配置简单,学习成本低
  • 支持多语言(包括中文)
  • 免费开源
  • 自动发现服务器与网络设备
  • 分布式监视以及WEB集中管理功能
  • 可以无agent监视
  • 用户安全认证和柔软的授权方式
  • 通过WEB界面设置或查看监视结果
  • email等通知功能

Zabbix主要功能:

  • CPU负荷
  • 内存使用
  • 磁盘使用
  • 网络状况
  • 端口监视
  • 日志监视

3. zabbix配置文件

zabbix配置文件有两种:

  • 服务器端配置文件(/usr/local/etc/zabbix_server.conf)
  • 客户端配置文件(/usr/local/etc/zabbix_agentd.conf)
  • zabbix代理配置文件(/usr/local/etc/zabbix_proxy.conf)

服务器端配置文件zabbix_server.conf常用配置参数:

参数作用
LogFile设置服务端日志文件存放路径
ListenIP设置服务端监听IP
ListenPort设置服务端监听的端口号
PidFile设置服务端进程号文件存放路径
DBHost指定zabbix的数据库服务器IP
DBName指定zabbix使用的数据库库名
DBUser指定zabbix数据库登录用户
DBPassword指定zabbix数据库登录密码
DBPort指定zabbix数据库端口号
User设置zabbix以什么用户的身份运行
AlertScriptsPath设置告警脚本存放路径
ExternalScripts外部脚本存放路径

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

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

4. 部署zabbix

环境说明:

环境IP要安装的应用
服务器172.16.12.128lamp架构 zabbix server zabbix agent
客户端172.16.12.129zabbix agent

因为zabbix是用php语言开发的,所以必须先部署lamp架构,使其能够支持运行php网页

常用的监控软件:

nagios 		  	擅长报警,配置比较麻烦

cacti 			擅长画图,流量图

zabbix         	结合nagios和cacti的优点+grafana

prometheus    	普罗米修斯 (监控容器)


监控指标:

硬件: IPMI
      电源
      温度
软件: 
      系统
      		内存使用率
      		CPU使用率
      		磁盘使用率
      网络
      		网卡流量
      业务
      		进程
      		日志

部署zabbix服务步骤:

环境要求:
服务器端首先要部署好lamp架构

点击下行链接,进入源码安装部署lamp页面

源码部署lamp

由于当前我们安装的zabbix-6.4版本的限制,不支持10.3.28的mariadb,需要mariadb在10.5版本或以上所以我们要将lamp中的(mysql)mariadb替换成更高的版本,安装mariadb10.5.22操作如下:

进入mariadb官网
https://mariadb.com/downloads/

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

将下载的mariadb包上传到虚拟机中

[root@centos2 lamp]# cd /usr/src
[root@centos2 src]# ls
debug  kernels  mariadb-10.5.22-rhel-8-x86_64-rpms.tar
[root@centos2 src]# tar xf mariadb-10.5.22-rhel-8-x86_64-rpms.tar 
[root@centos2 src]# cd mariadb-10.5.22-rhel-8-x86_64-rpms/
[root@centos2 mariadb-10.5.22-rhel-8-x86_64-rpms]# ls
galera-4-26.4.14-1.el8.x86_64.rpm                                    MariaDB-gssapi-server-10.5.22-1.el8.x86_64.rpm
MariaDB-10.5.22-1.el8.src.rpm                                        MariaDB-gssapi-server-debuginfo-10.5.22-1.el8.x86_64.rpm
MariaDB-backup-10.5.22-1.el8.x86_64.rpm                              MariaDB-oqgraph-engine-10.5.22-1.el8.x86_64.rpm
MariaDB-backup-debuginfo-10.5.22-1.el8.x86_64.rpm                    MariaDB-oqgraph-engine-debuginfo-10.5.22-1.el8.x86_64.rpm
MariaDB-client-10.5.22-1.el8.x86_64.rpm                              MariaDB-rocksdb-engine-10.5.22-1.el8.x86_64.rpm
MariaDB-client-debuginfo-10.5.22-1.el8.x86_64.rpm                    MariaDB-rocksdb-engine-debuginfo-10.5.22-1.el8.x86_64.rpm
MariaDB-columnstore-engine-10.5.22_5.6.8-1.el8.x86_64.rpm            MariaDB-s3-engine-10.5.22-1.el8.x86_64.rpm
MariaDB-columnstore-engine-debuginfo-10.5.22_5.6.8-1.el8.x86_64.rpm  MariaDB-s3-engine-debuginfo-10.5.22-1.el8.x86_64.rpm
MariaDB-common-10.5.22-1.el8.x86_64.rpm                              MariaDB-server-10.5.22-1.el8.x86_64.rpm
MariaDB-common-debuginfo-10.5.22-1.el8.x86_64.rpm                    MariaDB-server-debuginfo-10.5.22-1.el8.x86_64.rpm
MariaDB-compat-10.5.22-1.el8.x86_64.rpm                              MariaDB-shared-10.5.22-1.el8.x86_64.rpm
MariaDB-connect-engine-10.5.22-1.el8.x86_64.rpm                      MariaDB-shared-debuginfo-10.5.22-1.el8.x86_64.rpm
MariaDB-connect-engine-debuginfo-10.5.22-1.el8.x86_64.rpm            MariaDB-test-10.5.22-1.el8.x86_64.rpm
MariaDB-cracklib-password-check-10.5.22-1.el8.x86_64.rpm             MariaDB-test-debuginfo-10.5.22-1.el8.x86_64.rpm
MariaDB-cracklib-password-check-debuginfo-10.5.22-1.el8.x86_64.rpm   README
MariaDB-devel-10.5.22-1.el8.x86_64.rpm                               repodata
MariaDB-devel-debuginfo-10.5.22-1.el8.x86_64.rpm                     setup_repository
[root@centos2 mariadb-10.5.22-rhel-8-x86_64-rpms]# ./setup_repository 
Repository file successfully created! Please install MariaDB Server with this command:

   yum install MariaDB-server

[root@centos2 mariadb-10.5.22-rhel-8-x86_64-rpms]# yum install MariaDB-server -y
省略 . . . 

//开启数据库服务
[root@centos2 mariadb-10.5.22-rhel-8-x86_64-rpms]# systemctl start mariadb.service 
[root@centos2 mariadb-10.5.22-rhel-8-x86_64-rpms]# 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                                    [::]:22                                 [::]:*              
LISTEN           0                 80                                        *:3306                                  *:*
部署lamp之后能访问到这个页面说明部署成功

在这里插入图片描述

1、zabbix服务端的安装

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

//关闭防火墙和selinux
[root@centos2 src]# systemctl disable --now firewalld.service
[root@centos2 src]# setenforce 0

//安装依赖包
[root@centos2 ~]# yum -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/OpenIPMI-devel-2.0.31-3.el8.x86_64.rpm
[root@centos2 ~]# yum -y install net-snmp-devel libevent-devel mysql-devel	
安装过程略....

//下载zabbix
[root@centos2 ~]# cd /usr/src
[root@centos2 src]#
[root@centos2 src]# wget https://cdn.zabbix.com/zabbix/sources/stable/6.4/zabbix-6.4.6.tar.gz
--2023-09-22 15:06:16--  https://cdn.zabbix.com/zabbix/sources/stable/6.4/zabbix-6.4.6.tar.gz
Resolving cdn.zabbix.com (cdn.zabbix.com)... 104.26.7.148, 104.26.6.148, 172.67.69.4, ...
Connecting to cdn.zabbix.com (cdn.zabbix.com)|104.26.7.148|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 43744978 (42M) [application/octet-stream]
Saving to: ‘zabbix-6.4.6.tar.gz’

zabbix-6.4.6.tar.gz       100%[=====================================>]  41.72M  3.47MB/s    in 22s     

2023-09-22 15:06:40 (1.93 MB/s) - ‘zabbix-6.4.6.tar.gz’ saved [43744978/43744978]

[root@centos2 src]# ls
apr-1.7.4.tar.gz       debug                kernels                 zabbix-6.4.6.tar.gz
apr-util-1.6.3.tar.gz  httpd-2.4.57.tar.gz  oniguruma-6.9.4.tar.gz

//创建zabbix用户和组并解压zabbix-6.4.6.tar.gz 
[root@centos2 src]# useradd -r -M -s /sbin/nologin zabbix
[root@centos2 src]# tar xf zabbix-6.4.6.tar.gz 
[root@centos2 src]# ls
apr-1.7.4.tar.gz       debug                kernels                 zabbix-6.4.6
apr-util-1.6.3.tar.gz  httpd-2.4.57.tar.gz  oniguruma-6.9.4.tar.gz  zabbix-6.4.6.tar.gz

//配置zabbix数据库,登录到数据库里面,创建zabbix数据库、zabbix用户,并授权
[root@centos2 ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 10.5.22-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> set password = password('Feitianxiang123!');   //给数据库配置密码
Query OK, 0 rows affected (0.008 sec)

MariaDB [(none)]> create database zabbix character set utf8mb4 collate utf8mb4_bin;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> create user 'zabbix'@'localhost' identified by 'Feitianxiang123!';
Query OK, 0 rows affected (0.005 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to 'zabbix'@'localhost';
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> set global log_bin_trust_function_creators = 1;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> quit
Bye

//导入数据库内容,将数据库内容还原
[root@centos2 src]# cd zabbix-6.4.6/
[root@centos2 zabbix-6.4.6]# ls
aclocal.m4  ChangeLog     config.sub    database  install-sh   man      README
AUTHORS     compile       configure     depcomp   m4           misc     sass
bin         conf          configure.ac  include   Makefile.am  missing  src
build       config.guess  COPYING       INSTALL   Makefile.in  NEWS     ui
[root@centos2 zabbix-6.4.6]# cd database/
[root@centos2 database]# ls
elasticsearch  Makefile.am  Makefile.in  mysql  oracle  postgresql  sqlite3
[root@centos2 database]# cd mysql/
[root@centos2 mysql]# ls
data.sql  double.sql  history_pk_prepare.sql  images.sql  Makefile.am  Makefile.in  schema.sql
[root@centos2 mysql]# mysql -uzabbix -pFeitianxiang123! zabbix < schema.sql 
[root@centos2 mysql]# mysql -uzabbix -pFeitianxiang123! zabbix < images.sql 
[root@centos2 mysql]# mysql -uzabbix -pFeitianxiang123! --default-character-set=utf8mb4 zabbix < data.sql  
[root@centos2 mysql]# mysql -uroot -pFeitianxiang123!
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.5.22-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> set global log_bin_trust_function_creators = 0;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> show tables from zabbix;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| auditlog                   |
| autoreg_host               |
| changelog                  |
| conditions                 |
| config                     |
| config_autoreg_tls         |
| connector                  |
| connector_tag              |
| corr_condition             |
| corr_condition_group       |
| corr_condition_tag         |
| corr_condition_tagpair     |
| corr_condition_tagvalue    |
| corr_operation             |
| correlation                |
| dashboard                  |
| dashboard_page             |
| dashboard_user             |
| dashboard_usrgrp           |
| dbversion                  |
| dchecks                    |
| dhosts                     |
| drules                     |
| dservices                  |
| escalations                |
| event_recovery             |
| event_suppress             |
| event_symptom              |
| event_tag                  |
| events                     |
| expressions                |
| functions                  |
| globalmacro                |
| globalvars                 |
| graph_discovery            |
| graph_theme                |
| graphs                     |
| graphs_items               |
| group_discovery            |
| group_prototype            |
| ha_node                    |
| history                    |
| history_log                |
| history_str                |
| history_text               |
| history_uint               |
| host_discovery             |
| host_inventory             |
| host_rtdata                |
| host_tag                   |
| hostmacro                  |
| hosts                      |
| hosts_groups               |
| hosts_templates            |
| housekeeper                |
| hstgrp                     |
| httpstep                   |
| httpstep_field             |
| httpstepitem               |
| httptest                   |
| httptest_field             |
| httptest_tag               |
| httptestitem               |
| icon_map                   |
| icon_mapping               |
| ids                        |
| images                     |
| interface                  |
| interface_discovery        |
| interface_snmp             |
| item_condition             |
| item_discovery             |
| item_parameter             |
| item_preproc               |
| item_rtdata                |
| item_tag                   |
| items                      |
| lld_macro_path             |
| lld_override               |
| lld_override_condition     |
| lld_override_opdiscover    |
| lld_override_operation     |
| lld_override_ophistory     |
| lld_override_opinventory   |
| lld_override_opperiod      |
| lld_override_opseverity    |
| lld_override_opstatus      |
| lld_override_optag         |
| lld_override_optemplate    |
| lld_override_optrends      |
| maintenance_tag            |
| maintenances               |
| maintenances_groups        |
| maintenances_hosts         |
| maintenances_windows       |
| media                      |
| media_type                 |
| media_type_message         |
| media_type_param           |
| module                     |
| opcommand                  |
| opcommand_grp              |
| opcommand_hst              |
| opconditions               |
| operations                 |
| opgroup                    |
| opinventory                |
| opmessage                  |
| opmessage_grp              |
| opmessage_usr              |
| optemplate                 |
| problem                    |
| problem_tag                |
| profiles                   |
| proxy_autoreg_host         |
| proxy_dhistory             |
| proxy_history              |
| regexps                    |
| report                     |
| report_param               |
| report_user                |
| report_usrgrp              |
| rights                     |
| role                       |
| role_rule                  |
| scim_group                 |
| script_param               |
| scripts                    |
| service_alarms             |
| service_problem            |
| service_problem_tag        |
| service_status_rule        |
| service_tag                |
| services                   |
| services_links             |
| sessions                   |
| sla                        |
| sla_excluded_downtime      |
| sla_schedule               |
| sla_service_tag            |
| sysmap_element_trigger     |
| sysmap_element_url         |
| sysmap_shape               |
| sysmap_url                 |
| sysmap_user                |
| sysmap_usrgrp              |
| sysmaps                    |
| sysmaps_element_tag        |
| sysmaps_elements           |
| sysmaps_link_triggers      |
| sysmaps_links              |
| tag_filter                 |
| task                       |
| task_acknowledge           |
| task_check_now             |
| task_close_problem         |
| task_data                  |
| task_remote_command        |
| task_remote_command_result |
| task_result                |
| timeperiods                |
| token                      |
| trends                     |
| trends_uint                |
| trigger_depends            |
| trigger_discovery          |
| trigger_queue              |
| trigger_tag                |
| triggers                   |
| user_scim_group            |
| userdirectory              |
| userdirectory_idpgroup     |
| userdirectory_ldap         |
| userdirectory_media        |
| userdirectory_saml         |
| userdirectory_usrgrp       |
| users                      |
| users_groups               |
| usrgrp                     |
| valuemap                   |
| valuemap_mapping           |
| widget                     |
| widget_field               |
+----------------------------+
186 rows in set (0.002 sec)

MariaDB [(none)]>quit
Bye

//导出一个环境变量
[root@centos2 mysql]# export CFLAGS="-std=gnu99"
[root@centos2 mysql]# echo $CFLAGS
-std=gnu99

//进入zabbix目录进行编译安装
[root@centos2 zabbix-6.4.6]# ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi
省略 . . .

最后出现这个视图则表示编译成功
***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************

//执行编译安装、编译安装zabbix不需要先make再make install,直接执行make install
[root@centos2 mysql]# make install
省略 . . .

//conf文件中存放着我们客户端和服务端的配置文件
[root@centos2 zabbix-6.4.6]# ls /usr/local/etc/
zabbix_agentd.conf  zabbix_agentd.conf.d  zabbix_server.conf  zabbix_server.conf.d

//修改服务端配置文件
//设置数据库信息
[root@centos2 conf]# vim /usr/local/etc/zabbix_server.conf
[root@centos2 conf]# grep -A2 DBPassword= /usr/local/etc/zabbix_server.conf
# DBPassword=
DBPassword=Feitianxiang123!    //设置zabbix数据库连接密码

### Option: DBSocket

//启动zabbix_server和zabbix_agentd
[root@centos2 ~]# zabbix_server
[root@centos2 ~]# zabbix_agentd
[root@centos2 ~]# 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                      127.0.0.1:9000                     0.0.0.0:*          
LISTEN      0            128                              *:80                             *:*          
LISTEN      0            128                           [::]:22                          [::]:*          
LISTEN      0            80                               *:3306                           *:*

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

2.1 zabbix web界面安装前配置
//修改/etc/php.ini的配置并重启php-fpm
[root@centos2 ~]# sed -ri 's/(post_max_size =).*/\1 16M/g' /etc/php.ini
[root@centos2 ~]# sed -ri 's/(max_execution_time =).*/\1 300/g' /etc/php.ini
[root@centos2 ~]# sed -ri 's/(max_input_time =).*/\1 300/g' /etc/php.ini
[root@centos2 ~]# sed -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini
[root@centos2 ~]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm  done

[root@centos2 ~]# cd /usr/src/zabbix-6.4.6/   //进入zabbix目录,找到存放php网页文件的目录ui
[root@centos2 zabbix-6.4.6]# ls
aclocal.m4  ChangeLog     config.log     configure.ac  include     Makefile     misc     sass
AUTHORS     compile       config.status  COPYING       INSTALL     Makefile.am  missing  src
bin         conf          config.sub     database      install-sh  Makefile.in  NEWS     ui
build       config.guess  configure      depcomp       m4          man          README

//将ui目录下面的所有文件复制到我们先前部署lamp中的文件存放目录
[root@centos2 zabbix-6.4.6]# \cp -a ui/* /usr/local/apache/htdocs/www.ftx.com
[root@centos2 zabbix-6.4.6]# ls /usr/local/apache/htdocs/www.ftx.com
api_jsonrpc.php     conf                         include         robots.txt
api_scim.php        data                         index_http.php  setup.php
app                 disc_prototypes.php          index.php       sysmap.php
assets              favicon.ico                  index_sso.php   sysmaps.php
audio               graphs.php                   items.php       templates.php
browserwarning.php  history.php                  js              toptriggers.php
chart2.php          host_discovery.php           jsLoader.php    tr_events.php
chart3.php          hostinventoriesoverview.php  jsrpc.php       trigger_prototypes.php
chart4.php          hostinventories.php          local           triggers.php
chart6.php          host_prototypes.php          locale          vendor
chart7.php          httpconf.php                 map.php         widgets
chart.php           httpdetails.php              modules         zabbix.php
composer.json       image.php                    report2.php
composer.lock       imgstore.php                 report4.php	


//修改目录文件属主
[root@centos2 zabbix-6.4.6]# chown -R apache.apache /usr/local/apache/htdocs

虚拟主机在上述部署lamp中已经配置完成
[root@centos2 zabbix-6.4.6]# tail -13 /usr/local/apache/conf/httpd.conf 
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/usr/local/apache/htdocs/www.ftx.com"
ServerName www.ftx.com
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/www.ftx.com/
<Directory "/usr/local/apache/htdocs/www.ftx.com">
Options none
AllowOverride none
Require all granted
</Directory>
</VirtualHost>

//设置www.ftx.com/conf目录的权限,让zabbix有权限生成配置文件zabbix.conf.php
[root@centos2 zabbix-6.4.6]# chmod 777 /usr/local/apache/htdocs/www.ftx.com/conf
[root@centos2 zabbix-6.4.6]# ll -d /usr/local/apache/htdocs/www.ftx.com/conf
drwxrwxrwx. 3 apache apache 94 Aug 22 16:10 /usr/local/apache/htdocs/www.ftx.com/conf

//重启apache
[root@centos2 zabbix-6.4.6]# systemctl restart httpd
[root@centos2 zabbix-6.4.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                      127.0.0.1:9000                     0.0.0.0:*          
LISTEN      0            128                              *:80                             *:*          
LISTEN      0            128                           [::]:22                          [::]:*          
LISTEN      0            80                               *:3306                           *:*
2.2 安装zabbix web界面
  • 修改/etc/hosts文件,添加域名与IP的映射
  • 在浏览器上访问域名,本文设置的域名为www.ftx.com,你需要修改成你自己的域名
  • 成功生成配置文件zabbix.conf.php后恢复www.ftx.com/conf目录的权限为755

修改C:\Windows\System32\drivers\etc下的hosts文件
在这里插入图片描述

在浏览器上访问域名进行安装:

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
)

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

用户名: Admin
密 码: zabbix
在这里插入图片描述

在这里插入图片描述

部署完成
恢复zabbix/conf目录的权限为755:
[root@client zabbix-6.4.6]# chmod 755 /usr/local/apache/htdocs/www.ftx.com/conf
[root@client zabbix-6.4.6]# ll -d /usr/local/apache/htdocs/www.ftx.com/conf
drwxr-xr-x. 3 apache apache 117 Sep 23 03:44 /usr/local/apache/htdocs/www.ftx.com/conf

错误排查报告

出现此错误:
configure: error: Invalid OPENIPMI directory - unable to find ipmiif.h

解决方法:
[root@centos2 zabbix-6.4.6]# yum -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/OpenIPMI-devel-2.0.31-3.el8.x86_64.rpm

出现此错误:
error: MySQL library not found

解决方法:
yum -y install mysql-devel

44973035)]

部署完成
恢复zabbix/conf目录的权限为755:
[root@client zabbix-6.4.6]# chmod 755 /usr/local/apache/htdocs/www.ftx.com/conf
[root@client zabbix-6.4.6]# ll -d /usr/local/apache/htdocs/www.ftx.com/conf
drwxr-xr-x. 3 apache apache 117 Sep 23 03:44 /usr/local/apache/htdocs/www.ftx.com/conf

错误排查报告

出现此错误:
configure: error: Invalid OPENIPMI directory - unable to find ipmiif.h

解决方法:
[root@centos2 zabbix-6.4.6]# yum -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/OpenIPMI-devel-2.0.31-3.el8.x86_64.rpm

出现此错误:
error: MySQL library not found

解决方法:
yum -y install mysql-devel
  • 7
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
以下是在Linux上搭建部署Zabbix监控服务的步骤: 1.安装LAMP(Linux、Apache、MySQL、PHP)环境 2.安装Zabbix server和Zabbix agent 3.创建Zabbix数据库 4.导入Zabbix数据库 5.配置Zabbix server 6.启动Zabbix server和Zabbix agent 7.访问Zabbix web界面 具体步骤如下: 1.安装LAMP环境 在Linux上安装Apache、MySQL和PHP,可以使用以下命令: ```shell sudo apt-get update sudo apt-get install apache2 mysql-server php php-mysql libapache2-mod-php ``` 2.安装Zabbix server和Zabbix agent 可以使用以下命令安装Zabbix server和Zabbix agent: ```shell sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent ``` 3.创建Zabbix数据库 使用以下命令登录到MySQL: ```shell sudo mysql -u root -p ``` 创建一个名为“zabbix”的数据库: ```mysql create database zabbix character set utf8 collate utf8_bin; ``` 创建一个名为“zabbix”的用户,并授予该用户对“zabbix”数据库的所有权限: ```mysql grant all privileges on zabbix.* to zabbix@localhost identified by 'password'; ``` 退出MySQL: ```mysql exit; ``` 4.导入Zabbix数据库 使用以下命令导入Zabbix数据库: ```shell zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix ``` 5.配置Zabbix server 编辑Zabbix server配置文件“/etc/zabbix/zabbix_server.conf”,并将以下行取消注释并修改: ```conf DBName=zabbix DBUser=zabbix DBPassword=password ``` 6.启动Zabbix server和Zabbix agent 使用以下命令启动Zabbix server和Zabbix agent: ```shell sudo systemctl start zabbix-server zabbix-agent sudo systemctl enable zabbix-server zabbix-agent ``` 7.访问Zabbix web界面 在Web浏览器中输入服务器的IP地址或域名,然后输入用户名“Admin”和密码“zabbix”登录到Zabbix web界面。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值