日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

# 【Zabbix】Zabbix 分布式監(jiān)控

 看見(jiàn)就非常 2022-03-15

2022年02月26日 11:31:28閱讀數(shù):63博客 / 大寶

參考鏈接

阿里巴巴開(kāi)源鏡像站-OPSX鏡像站-阿里云開(kāi)發(fā)者社區(qū) (aliyun.com)

zabbix鏡像-zabbix下載地址-zabbix安裝教程-阿里巴巴開(kāi)源鏡像站 (aliyun.com)

Zabbix三種架構(gòu)

Server-Agent

Server-Node-Agent

Server-Proxy-Agent

配置介紹

Zabbix Proxy的配置

  • Server-Node-Agent
  • Server-Proxy-Agent

1、配置proxy主機(jī)

① 安裝相應(yīng)的zabbix包
  1. zabbix-proxy-mysql zabbix-get zabbix-agent zabbix-sender
② 準(zhǔn)備數(shù)據(jù)庫(kù)
  1. 創(chuàng)建、授權(quán)用戶、導(dǎo)入schema.sql
③ 修改配置文件
④ 在server端添加此Proxy
  1. Administration ——> Proxies
⑤ 在Server端配置通過(guò)此Proxy監(jiān)控的主機(jī)

<font color =red>注意:zabbix agent端要允許zabbix proxy主機(jī)執(zhí)行數(shù)據(jù)采集操作</font>

實(shí)戰(zhàn)演練—分布式監(jiān)控

實(shí)驗(yàn)部署架構(gòu)

主機(jī)名稱 IP地址 服務(wù)角色 架構(gòu)類型
zabbix-server 192.168.200.60 Zabbix 監(jiān)控端 /
zabbix-agent-centos 192.168.200.70 Zabbix 客戶端 Server-Agent
zbxproxy 192.168.200.90 Zabbix Proxy /
zabbix-agent-02 192.168.200.100 Zabbix 客戶端 Server-Proxy-Agent

1、實(shí)驗(yàn)前期準(zhǔn)備(Server端、Proxy端)

  • 配置服務(wù)端和代理端時(shí)間同步

    1. # 服務(wù)端和代理端安裝ntpdate服務(wù)包
    2. yum install -y ntpdate
    3. # 服務(wù)端和代理端同步阿里云時(shí)間服務(wù)器
    4. ntpdate ntp1.aliyun.com
  • 關(guān)閉防火墻、SELinux安全模式

    1. systemctl stop firewalld
    2. systemctl disable firewalld
    3. setenforce 0
    4. getenforce
    5. iptables -nL
  • 設(shè)置主機(jī)名

    1. [root@zabbix-server ~]# hostnamectl set-hostname zabbix-server
    2. [root@zabbix-proxy ~]# hostnamectl set-hostname zbxproxy.xybdiy.com
    3. [root@zabbix-agent-02 ~]# hostnamectl set-hostname zabbix-agent-02
  • 配置域名解析

    1. [root@zabbix-agent-02 ~]# cat /etc/hosts
    2. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    3. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    4. 192.168.200.60 zabbix-server
    5. 192.168.200.90 zbxproxy.xybdiy.com zbxproxy
    6. 192.168.200.100 zabbix-agent-02

    zabbix-server 直接監(jiān)控一臺(tái)主機(jī)zabbix-agent-centos

    zabbix-server 通過(guò)代理zbproxy 監(jiān)控zabbix-agent-02

2、在代理服務(wù)器上配置MySQL

  • 創(chuàng)建MariaDB.repo
  1. [root@zbproxy yum.repos.d]# vim mariadb.repo
  2. [root@zbproxy yum.repos.d]# cat mariadb.repo
  3. [mariadb]
  4. name = MariaDB
  5. baseurl = http://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64/
  6. gpgkey=http://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
  7. gpgcheck=1
  • 安裝mariadb
  1. [root@zbproxy ~]# yum install -y MariaDB-server MariaDB-client

image-20220216152841900

  • 修改數(shù)據(jù)庫(kù)配置文件
  1. [root@zbproxy ~]# vim /etc/my.cnf.d/server.cnf
  2. [mysqld]
  3. skip_name_resolve = ON # 跳過(guò)主機(jī)名解析
  4. innodb_file_per_table = ON # 開(kāi)啟獨(dú)立表空間
  5. innodb_buffer_pool_size = 256M # 緩存池大小
  6. max_connections = 2000 # 最大連接數(shù)
  7. log-bin = master-log # 開(kāi)啟二進(jìn)制日志
  • 啟動(dòng)數(shù)據(jù)庫(kù)服務(wù)
  1. [root@zbproxy ~]# systemctl start mariadb
  2. [root@zbproxy ~]# systemctl enable mariadb
  • 初始化數(shù)據(jù)庫(kù)
  1. [root@zbproxy ~]# mysql_secure_installation
  2. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
  3. SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
  4. In order to log into MariaDB to secure it, we'll need the current
  5. password for the root user. If you've just installed MariaDB, and
  6. you haven't set the root password yet, the password will be blank,
  7. so you should just press enter here.
  8. Enter current password for root (enter for none):
  9. OK, successfully used password, moving on...
  10. Setting the root password ensures that nobody can log into the MariaDB
  11. root user without the proper authorisation.
  12. Set root password? [Y/n] y
  13. New password:
  14. Re-enter new password:
  15. Password updated successfully!
  16. Reloading privilege tables..
  17. ... Success!
  18. By default, a MariaDB installation has an anonymous user, allowing anyone
  19. to log into MariaDB without having to have a user account created for
  20. them. This is intended only for testing, and to make the installation
  21. go a bit smoother. You should remove them before moving into a
  22. production environment.
  23. Remove anonymous users? [Y/n] y
  24. ... Success!
  25. Normally, root should only be allowed to connect from 'localhost'. This
  26. ensures that someone cannot guess at the root password from the network.
  27. Disallow root login remotely? [Y/n] n
  28. ... skipping.
  29. By default, MariaDB comes with a database named 'test' that anyone can
  30. access. This is also intended only for testing, and should be removed
  31. before moving into a production environment.
  32. Remove test database and access to it? [Y/n] y
  33. - Dropping test database...
  34. ... Success!
  35. - Removing privileges on test database...
  36. ... Success!
  37. Reloading the privilege tables will ensure that all changes made so far
  38. will take effect immediately.
  39. Reload privilege tables now? [Y/n] y
  40. ... Success!
  41. Cleaning up...
  42. All done! If you've completed all of the above steps, your MariaDB
  43. installation should now be secure.
  44. Thanks for using MariaDB!
  45. [root@zbproxy ~]# mysql -uroot -p000
  • 創(chuàng)建數(shù)據(jù)庫(kù) 和 授權(quán)用戶
  1. # 創(chuàng)建數(shù)據(jù)庫(kù)zbxproxydb
  2. MariaDB [(none)]> create database zbxproxydb character set 'utf8';
  3. Query OK, 1 row affected (0.00 sec)
  4. # 授權(quán)用戶zbxproxydb
  5. MariaDB [(none)]> grant all on zbxproxydb.* to 'zbxproxyuser'@'192.168.200.%' identified by 'zbxproxypass';
  6. Query OK, 0 rows affected (0.00 sec)
  7. # 刷新,重新加載
  8. MariaDB [(none)]> flush privileges;
  9. Query OK, 0 rows affected (0.00 sec)
  10. # 退出
  11. MariaDB [(none)]> exit
  12. Bye
  13. [root@zbproxy ~]#

3、在代理服務(wù)器上下載zabbix相應(yīng)的包。

主要是代理proxy的包

  1. [root@zbproxy src]# yum localinstall zabbix-agent-5.0.20-1.el7.x86_64.rpm zabbix-proxy-mysql-5.0.20-1.el7.x86_64.rpm zabbix-get-5.0.20-1.el7.x86_64.rpm zabbix-sender-5.0.20-1.el7.x86_64.rpm

image-20220216162920326

  • 初始化數(shù)據(jù)庫(kù)
  1. #查詢數(shù)據(jù)庫(kù)包
  2. [root@zbproxy src]# rpm -ql zabbix-proxy-mysql
  3. /etc/logrotate.d/zabbix-proxy
  4. /etc/zabbix/zabbix_proxy.conf
  5. /usr/lib/systemd/system/zabbix-proxy.service
  6. /usr/lib/tmpfiles.d/zabbix-proxy.conf
  7. /usr/lib/zabbix/externalscripts
  8. /usr/sbin/zabbix_proxy_mysql
  9. /usr/share/doc/zabbix-proxy-mysql-5.0.20
  10. /usr/share/doc/zabbix-proxy-mysql-5.0.20/AUTHORS
  11. /usr/share/doc/zabbix-proxy-mysql-5.0.20/COPYING
  12. /usr/share/doc/zabbix-proxy-mysql-5.0.20/ChangeLog
  13. /usr/share/doc/zabbix-proxy-mysql-5.0.20/NEWS
  14. /usr/share/doc/zabbix-proxy-mysql-5.0.20/README
  15. /usr/share/doc/zabbix-proxy-mysql-5.0.20/schema.sql.gz
  16. /usr/share/man/man8/zabbix_proxy.8.gz
  17. /var/log/zabbix
  18. /var/run/zabbix

zabbix-proxymysql 包里帶有導(dǎo)入數(shù)據(jù)的文件schema.sql.gz

  1. # 復(fù)制schema.sql.gz
  2. [root@zbproxy ~]# cp /usr/share/doc/zabbix-proxy-mysql-5.0.20/schema.sql.gz .
  3. [root@zbproxy ~]# ls
  4. anaconda-ks.cfg schema.sql.gz
  5. # 解壓
  6. [root@zbproxy ~]# gzip -d schema.sql.gz
  7. [root@zbproxy ~]# ls
  8. anaconda-ks.cfg schema.sql
  9. # 導(dǎo)入數(shù)據(jù),出現(xiàn)以下問(wèn)題
  10. [root@zbproxy ~]# mysql -uroot -p000 < schema.sql
  11. ERROR 1046 (3D000) at line 1: No database selected
  12. 解決辦法:
  13. [root@zbproxy ~]# vim schema.sql
  14. 在首部添加如下內(nèi)容:
  15. USE zbxproxydb;
  16. 按:wq保存退出
  17. [root@zbproxy ~]# mysql -uroot -p000 < schema.sql
  • 查看數(shù)據(jù)已經(jīng)生成
  1. MariaDB [(none)]> show databases;
  2. +--------------------+
  3. | Database |
  4. +--------------------+
  5. | information_schema |
  6. | mysql |
  7. | performance_schema |
  8. | zbxproxydb |
  9. +--------------------+
  10. 4 rows in set (0.00 sec)
  11. MariaDB [(none)]> use zbxproxydb;
  12. Reading table information for completion of table and column names
  13. You can turn off this feature to get a quicker startup with -A
  14. Database changed
  15. MariaDB [zbxproxydb]> show tables;
  16. +----------------------------+
  17. | Tables_in_zbxproxydb |
  18. +----------------------------+
  19. | acknowledges |
  20. | actions |
  21. | alerts |
  22. | application_discovery |
  23. | application_prototype |
  24. | application_template |
  25. | applications |
  26. | auditlog |
  27. | auditlog_details |
  28. | autoreg_host |
  29. | conditions |
  30. | config |
  31. | config_autoreg_tls |
  32. | corr_condition |
  33. | corr_condition_group |
  34. | corr_condition_tag |
  35. | corr_condition_tagpair |
  36. | corr_condition_tagvalue |
  37. | corr_operation |
  38. | correlation |
  39. | dashboard |
  40. | dashboard_user |
  41. | dashboard_usrgrp |
  42. | dbversion |
  43. | dchecks |
  44. | dhosts |
  45. | drules |
  46. | dservices |
  47. | escalations |
  48. | event_recovery |
  49. | event_suppress |
  50. | event_tag |
  51. | events |
  52. | expressions |
  53. | functions |
  54. | globalmacro |
  55. | globalvars |
  56. | graph_discovery |
  57. | graph_theme |
  58. | graphs |
  59. | graphs_items |
  60. | group_discovery |
  61. | group_prototype |
  62. | history |
  63. | history_log |
  64. | history_str |
  65. | history_text |
  66. | history_uint |
  67. | host_discovery |
  68. | host_inventory |
  69. | host_tag |
  70. | hostmacro |
  71. | hosts |
  72. | hosts_groups |
  73. | hosts_templates |
  74. | housekeeper |
  75. | hstgrp |
  76. | httpstep |
  77. | httpstep_field |
  78. | httpstepitem |
  79. | httptest |
  80. | httptest_field |
  81. | httptestitem |
  82. | icon_map |
  83. | icon_mapping |
  84. | ids |
  85. | images |
  86. | interface |
  87. | interface_discovery |
  88. | interface_snmp |
  89. | item_application_prototype |
  90. | item_condition |
  91. | item_discovery |
  92. | item_preproc |
  93. | item_rtdata |
  94. | items |
  95. | items_applications |
  96. | lld_macro_path |
  97. | lld_override |
  98. | lld_override_condition |
  99. | lld_override_opdiscover |
  100. | lld_override_operation |
  101. | lld_override_ophistory |
  102. | lld_override_opinventory |
  103. | lld_override_opperiod |
  104. | lld_override_opseverity |
  105. | lld_override_opstatus |
  106. | lld_override_optag |
  107. | lld_override_optemplate |
  108. | lld_override_optrends |
  109. | maintenance_tag |
  110. | maintenances |
  111. | maintenances_groups |
  112. | maintenances_hosts |
  113. | maintenances_windows |
  114. | mappings |
  115. | media |
  116. | media_type |
  117. | media_type_message |
  118. | media_type_param |
  119. | module |
  120. | opcommand |
  121. | opcommand_grp |
  122. | opcommand_hst |
  123. | opconditions |
  124. | operations |
  125. | opgroup |
  126. | opinventory |
  127. | opmessage |
  128. | opmessage_grp |
  129. | opmessage_usr |
  130. | optemplate |
  131. | problem |
  132. | problem_tag |
  133. | profiles |
  134. | proxy_autoreg_host |
  135. | proxy_dhistory |
  136. | proxy_history |
  137. | regexps |
  138. | rights |
  139. | screen_user |
  140. | screen_usrgrp |
  141. | screens |
  142. | screens_items |
  143. | scripts |
  144. | service_alarms |
  145. | services |
  146. | services_links |
  147. | services_times |
  148. | sessions |
  149. | slides |
  150. | slideshow_user |
  151. | slideshow_usrgrp |
  152. | slideshows |
  153. | sysmap_element_trigger |
  154. | sysmap_element_url |
  155. | sysmap_shape |
  156. | sysmap_url |
  157. | sysmap_user |
  158. | sysmap_usrgrp |
  159. | sysmaps |
  160. | sysmaps_elements |
  161. | sysmaps_link_triggers |
  162. | sysmaps_links |
  163. | tag_filter |
  164. | task |
  165. | task_acknowledge |
  166. | task_check_now |
  167. | task_close_problem |
  168. | task_data |
  169. | task_remote_command |
  170. | task_remote_command_result |
  171. | task_result |
  172. | timeperiods |
  173. | trends |
  174. | trends_uint |
  175. | trigger_depends |
  176. | trigger_discovery |
  177. | trigger_tag |
  178. | triggers |
  179. | users |
  180. | users_groups |
  181. | usrgrp |
  182. | valuemaps |
  183. | widget |
  184. | widget_field |
  185. +----------------------------+
  186. 166 rows in set (0.00 sec)
  187. MariaDB [zbxproxydb]>

4、配置proxy端

  1. [root@zbproxy ~]# vim /etc/zabbix/zabbix_proxy.conf
  2. Server=192.168.200.60 # server 的IP
  3. ServerPort=10051 # server 的端口
  4. Hostname=zbxproxy.xybdiy.com # 主機(jī)名
  5. ListenPort=10051 # proxy自己的監(jiān)聽(tīng)端口
  6. EnableRemoteCommands=1 # 允許遠(yuǎn)程命令
  7. LogRemoteCommands=1 # 記錄遠(yuǎn)程命令的日志
  8. DBHost=192.168.200.90
  9. DBName=zbxproxydb
  10. DBUser=zbxproxyuser
  11. DBPassword=zbxproxypass
  12. ConfigFrequency=30 # 意思是多長(zhǎng)時(shí)間去服務(wù)端拖一次有自己監(jiān)控的操作配置,為了實(shí)驗(yàn)更快的生效。這里設(shè)置30秒,默認(rèn)3600s
  13. DataSenderFrequency=1 # 每一秒向server 端發(fā)一次數(shù)據(jù),發(fā)送頻度

開(kāi)啟proxy服務(wù)

  1. [root@zbxproxy zabbix]# systemctl start zabbix-proxy
  2. [root@zbxproxy zabbix]# systemctl enable zabbix-proxy

5、配置Agent端允許proxy代理監(jiān)控

  1. [root@zabbix-agent-02 ~]# vim /etc/zabbix/zabbix_agentd.conf
  2. Server=192.168.200.60,192.168.200.90
  3. ServerActive=192.168.200.60,192.168.200.90
  4. [root@zabbix-agent-02 ~]# systemctl restart zabbix-agent

6、把代理加入監(jiān)控server 創(chuàng)建配置agent代理

  • 創(chuàng)建agent代理

image-20220216201314751

  • 配置

image-20220216201502680

image-20220216201529415

  • 創(chuàng)建agent端主機(jī)并采用代理監(jiān)控

image-20220216202120895

image-20220216202135544

image-20220216202831810

版權(quán)申明:本博文版權(quán)歸博主所有,轉(zhuǎn)載請(qǐng)注明地址!如有侵權(quán)、違法,請(qǐng)聯(lián)系admin@舉報(bào)處理!

全部評(píng)論

文明上網(wǎng)理性發(fā)言,請(qǐng)遵守新聞評(píng)論服務(wù)協(xié)議

條評(píng)論
    • 本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
      轉(zhuǎn)藏 分享 獻(xiàn)花(0

      0條評(píng)論

      發(fā)表

      請(qǐng)遵守用戶 評(píng)論公約

      類似文章 更多