1. 什么是zabbix
  2. zabbix作为一款企业级,开源的,分布式的监控套件,解决了以往监控软件的短板,可以说是现在流行的监控解决方案之一。

  3. 监控系统的理想化模样
  4. 1.监控数据收集及可视化。
  5. 2.数据要保存在数据库中。这样以后需要的时候可以对这些数据进行分析计算。
    3.方便,快速将监控加入服务器上,不需要繁琐的操作。
  6. 4.数据可视化不要很花里胡哨,直观好用。


  7. 异常数据报警
  8. 1.可以定义复杂的报警逻辑,可以做到Item之间的关联报警,而不是针对一个。
  9. 2.报警需要被确认,让运维人员知道多少报警已经有人认领并开始处理。
  10. 3.报警方式需要自定义,可以发送邮件和短信。
  11. 4.报警内容可以自行设置,在报警邮件中加入一些简单的分析,而不是让运维人员上服务器敲命令来获取基本的信息。
  12. 5.报警可以自动跑一些命令,这些命令是需要获取信息,也可以是自动修复。
  13. 和其他系统协同工作。
  14. 1)有强大的API可以使用,可以让其他系统调用完成工作
  15. 2)监控数据是开放的,数据库中的数据结构不要太复杂,让人无从下手。
  16. 3)监控可视化的图可以方便的引用,而不是要一大串javascript
  1. zabbix的编译安装
  2. 相对于yum安装,还是编译安装最舒服一些
  3. 1.自定义软件功能
  4. 2.优化编译参数,提高性能
  5. 3.解决不必要的软件以来
  6. 4.易做代码升级
  1. 进入正题
  2. 1.机器规划
  3. 10.0.0.20 zabbix Server
  4. 10.0.0.23 mysql master
  5. 2.zabbix官网下载源码包
  1. cd /usr/local/src
  2. groupadd -g 1002 zabbix
  3. groupadd -u 1002 -g 1002 zabbix
  4. id zabbix 验证zabbix用户
  5. wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.15/zabbix-4.0.15.tar.gz
  6. 3.解决必要的依赖关系
  7. #apt install libmysqld-dev libmysqlclient-dev libxml2-dev libxml2 snmp libsnmp-dev libevent-dev curl libcurl4-openssl-dev
  8. #apt install openjdk-8-jdk
  9. 4.开始编译安装
  10. ./configure -prefix=/apps/zabbix_server --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
  11. LDAP support: no
  12. IPv6 support: no
  13. ***********************************************************
  14. * Now run 'make install' *
  15. * *
  16. * Thank you for using Zabbix! *
  17. * <http://www.zabbix.com> *
  18. ***********************************************************
  19. #make
  20. #make install

/usr/bin/install -c -m 644 ‘zabbix_agentd.man’ ‘/apps/zabbix_proxy/share/man/man8/zabbix_agentd.8’
/usr/bin/install -c -m 644 ‘zabbix_proxy.man’ ‘/apps/zabbix_proxy/share/man/man8/zabbix_proxy.8’
make[2]: Leaving directory ‘/usr/local/src/zabbix-4.0.29/man’
make[1]: Leaving directory ‘/usr/local/src/zabbix-4.0.29/man’
Making install in misc
make[1]: Entering directory ‘/usr/local/src/zabbix-4.0.29/misc’
make[2]: Entering directory ‘/usr/local/src/zabbix-4.0.29/misc’
make[2]: Nothing to be done for ‘install-exec-am’.
make[2]: Nothing to be done for ‘install-data-am’.
make[2]: Leaving directory ‘/usr/local/src/zabbix-4.0.29/misc’
make[1]: Leaving directory ‘/usr/local/src/zabbix-4.0.29/misc’
make[1]: Entering directory ‘/usr/local/src/zabbix-4.0.29’
make[2]: Entering directory ‘/usr/local/src/zabbix-4.0.29’
make[2]: Nothing to be done for ‘install-exec-am’.
make[2]: Nothing to be done for ‘install-data-am’.
make[2]: Leaving directory ‘/usr/local/src/zabbix-4.0.29’
make[1]: Leaving directory ‘/usr/local/src/zabbix-4.0.29’

 

root@zabbix-server:~# ll /apps/zabbix_server/
total 28
drwxr-xr-x 7 root root 4096 Mar 10 14:33 ./
drwxr-xr-x 3 root root 4096 Mar 10 14:35 ../
drwxr-xr-x 2 root root 4096 Mar 10 14:33 bin/
drwxr-xr-x 4 root root 4096 Mar 10 14:33 etc/
drwxr-xr-x 3 root root 4096 Mar 10 14:33 lib/
drwxr-xr-x 3 root root 4096 Mar 10 14:34 sbin/
drwxr-xr-x 4 root root 4096 Mar 10 14:33 share/

 



  1. 5.准备数据库
  2. 数据库的名称为zabbix_server1;用户名冷雨夜,密码yuye
  3. root@zabbix-server:~# apt install apache2 mysql-client
  4. root@mysql-master:~# mysql
  5. mysql> create database zabbix_server1 character set utf8 collate utf8_bin;
  6. grant all privileges on zabbix_server1.* to lengyuye@"10.0.0.%" identified by 'yuye.zabbix';
  7. mysql> flush privileges;
  8. 6.导入数据库
  9. 6.1 zabbix_server节点验证是否可以成功登录mysl
  10. root@zabbix-server:/usr/local/src/zabbix-4.0.29/database/mysql# mysql -ulengyuye -pyuye.zabbix -h10.0.0.23
  11. mysql: [Warning] Using a password on the command line interface can be insecure.
  12. Welcome to the MySQL monitor. Commands end with ; or \g.
  13. Your MySQL connection id is 4
  14. Server version: 5.7.33-0ubuntu0.18.04.1 (Ubuntu)
  15. Copyright (c) 2000, 2021, Oracle and/or its affiliates.
  16. Oracle is a registered trademark of Oracle Corporation and/or its
  17. affiliates. Other names may be trademarks of their respective
  18. owners.
  19. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  20. mysql>
  21.  
  22. 6.2 导入数据库
  23. #编译安装和apt安装还是稍微不一样的,且看。看你是那一个数据库。
  24. pwd
  25. #/usr/local/src/zabbix-4.0.29/database/mysql
  26. #检测这个错误,不要紧,意思就是检测到明文密码是不安全的,没关系
  27. root@zabbix-server:/usr/local/src/zabbix-4.0.29/database/mysql# mysql -ulengyuye -pyuye.zabbix -h10.0.0.23 zabbix_server1 < schema.sql
  28. mysql: [Warning] Using a password on the command line interface can be insecure.
  29. root@zabbix-server:/usr/local/src/zabbix-4.0.29/database/mysql# mysql -ulengyuye -pyuye.zabbix -h10.0.0.23 zabbix_server1 < images.sql
  30. mysql: [Warning] Using a password on the command line interface can be insecure.
  31. root@zabbix-server:/usr/local/src/zabbix-4.0.29/database/mysql# mysql -ulengyuye -pyuye.zabbix -h10.0.0.23 zabbix_server1 < data.sql
  32. mysql: [Warning] Using a password on the command line interface can be insecure.
  1. 7.验证数据库
  2. mysql> use zabbix_server1;
  3. Reading table information for completion of table and column names
  4. You can turn off this feature to get a quicker startup with -A
  5. Database changed
  6. mysql> show tables;
  7. +----------------------------+
  8. | Tables_in_zabbix_server1 |
  9. +----------------------------+
  10. | acknowledges |
  11. | actions |
  12. | alerts |
  13. | application_discovery |
  14. | application_prototype |
  15. | application_template |
  16. | applications |
  17. | auditlog |
  18. | auditlog_details |
  19. | autoreg_host |
  20. | conditions |
  21. | config |
  22. | corr_condition |
  23. | corr_condition_group |
  24. | corr_condition_tag |
  25. | corr_condition_tagpair |
  26. | corr_condition_tagvalue |
  27. | corr_operation |
  28. | correlation |
  29. | dashboard |
  30. | dashboard_user |
  31. | dashboard_usrgrp |
  32. | dbversion |
  33. | dchecks |
  34. | dhosts |
  35. | drules |
  36. | dservices |
  37. | escalations |
  38. | event_recovery |
  39. | event_suppress |
  40. | event_tag |
  41. | events |
  42. | expressions |
  43. | functions |
  44. | globalmacro |
  45. | globalvars |
  46. | graph_discovery |
  47. | graph_theme |
  48. | graphs |
  49. | graphs_items |
  50. | group_discovery |
  51. | group_prototype |
  52. | history |
  53. | history_log |
  54. | history_str |
  55. | history_text |
  56. | history_uint |
  57. | host_discovery |
  58. | host_inventory |
  59. | hostmacro |
  60. | hosts |
  61. | hosts_groups |
  62. | hosts_templates |
  63. | housekeeper |
  64. | hstgrp |
  65. | httpstep |
  66. | httpstep_field |
  67. | httpstepitem |
  68. | httptest |
  69. | httptest_field |
  70. | httptestitem |
  71. | icon_map |
  72. | icon_mapping |
  73. | ids |
  74. | images |
  75. | interface |
  76. | interface_discovery |
  77. | item_application_prototype |
  78. | item_condition |
  79. | item_discovery |
  80. | item_preproc |
  81. | items |
  82. | items_applications |
  83. | maintenance_tag |
  84. | maintenances |
  85. | maintenances_groups |
  86. | maintenances_hosts |
  87. | maintenances_windows |
  88. | mappings |
  89. | media |
  90. | media_type |
  91. | opcommand |
  92. | opcommand_grp |
  93. | opcommand_hst |
  94. | opconditions |
  95. | operations |
  96. | opgroup |
  97. | opinventory |
  98. | opmessage |
  99. | opmessage_grp |
  100. | opmessage_usr |
  101. | optemplate |
  102. | problem |
  103. | problem_tag |
  104. | profiles |
  105. | proxy_autoreg_host |
  106. | proxy_dhistory |
  107. | proxy_history |
  108. | regexps |
  109. | rights |
  110. | screen_user |
  111. | screen_usrgrp |
  112. | screens |
  113. | screens_items |
  114. | scripts |
  115. | service_alarms |
  116. | services |
  117. | services_links |
  118. | services_times |
  119. | sessions |
  120. | slides |
  121. | slideshow_user |
  122. | slideshow_usrgrp |
  123. | slideshows |
  124. | sysmap_element_trigger |
  125. | sysmap_element_url |
  126. | sysmap_shape |
  127. | sysmap_url |
  128. | sysmap_user |
  129. | sysmap_usrgrp |
  130. | sysmaps |
  131. | sysmaps_elements |
  132. | sysmaps_link_triggers |
  133. | sysmaps_links |
  134. | tag_filter |
  135. | task |
  136. | task_acknowledge |
  137. | task_check_now |
  138. | task_close_problem |
  139. | task_remote_command |
  140. | task_remote_command_result |
  141. | timeperiods |
  142. | trends |
  143. | trends_uint |
  144. | trigger_depends |
  145. | trigger_discovery |
  146. | trigger_tag |
  147. | triggers |
  148. | users |
  149. | users_groups |
  150. | usrgrp |
  151. | valuemaps |
  152. | widget |
  153. | widget_field |
  154. +----------------------------+
  155. 144 rows in set (0.00 sec)
  1. 8.编辑zabbix server配置文件修改参数
  2. root@zabbix-server:~# vim /apps/zabbix_server/etc/zabbix_server.conf
  3. DBHost=10.0.0.23
  4. DBName=zabbix_server1
  5. DBUser=lengyuye
  6. DBPassword=lengyuye
  7. 9.启动zabbix
  8. #查看zabbix的端口是否被监听
  9. root@zabbix-server:/var/www/html/zabbix# ss -tnl
  10. LISTEN 0 128 0.0.0.0:10051 0.0.0.0:*
  11. LISTEN 0 128 0.0.0.0:43397
  12. #端口已经被监听启动zabbix server
  13. /apps/zabbix_server/sbin/zabbix_server -c /apps/zabbix_server/etc/zabbix_server.conf
  14. root@zabbix-server:~# tail /tmp/zabbix_server.log
  15. 1706:20210310:220941.608 VMware monitoring: YES
  16. 1706:20210310:220941.608 SMTP authentication: YES
  17. 1706:20210310:220941.608 Jabber notifications: NO
  18. 1706:20210310:220941.608 Ez Texting notifications: YES
  19. 1706:20210310:220941.608 ODBC: NO
  20. 1706:20210310:220941.608 SSH support: NO
  21. 1706:20210310:220941.608 IPv6 support: NO
  22. 1706:20210310:220941.608 TLS support: NO
  23. 1706:20210310:220941.608 ******************************
  24. 1706:20210310:220941.608 using configuration file: /apps/zabbix_server/etc/zabbix_server.conf
  1. 10.登录zabbix
  2. #可能会报错

 

 

  1. 11.修改配置文件
  2. apt-get install php7.2-ladp
  3. apt-get install php7.2-bcmath
  4. systemctl restart mysql
  5. systemctl restart apache2
    再次登录已经全部OK!!!

 

 

  1. 12.设置数据库





  1.  
  1. 13.zabbix server设置

 

 

  1. 14.确认信息

 

  1.  

 

 

  1. 15.手动创建配置文件
  2. <?php
  3. // Zabbix GUI configuration file.
  4. global $DB;
  5. $DB['TYPE'] = 'MYSQL';
  6. $DB['SERVER'] = '10.0.0.23';
  7. $DB['PORT'] = '3306';
  8. $DB['DATABASE'] = 'zabbix_server1';
  9. $DB['USER'] = 'lengyuye';
  10. $DB['PASSWORD'] = 'yuye.zabbix';
  11. // Schema name. Used for IBM DB2 and PostgreSQL.
  12. $DB['SCHEMA'] = '';
  13. $ZBX_SERVER = 'localhost';
  14. $ZBX_SERVER_PORT = '10051';
  15. $ZBX_SERVER_NAME = 'zabbix-server';
  16. $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
  17. #刷新页面,成功显示。

 

 

  1. 16.登录zabbix
  2. 用户名Admin
    密码zabbix

 

  1.  

 

 

  1. 编译安装到这里就全部OK了希望对有所帮助,!!!









版权声明:本文为xunweidezui原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/xunweidezui/p/14517113.html