zabbix使用,环境安装

前言

安装

首先安装mysql环境

docker pull mysql:5.7
docker run --name my-mysql -p 3305:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7

记录下mysql的ip

docker inspect my-mysql

这里是172.17.0.2,接下会用到

然后安装zabbix-server

docker pull zabbix/zabbix-server-mysql
docker run --name my-zabbix -e DB_SERVER_HOST="172.17.0.2" -e MYSQL_USER="root" -e MYSQL_PASSWORD="root" -p 10051:10051 -d zabbix/zabbix-server-mysql

上面的db地址就是mysql的ip地址 查看安装

docker logs my-zabbix

看到如下说明安装成功

** Deploying Zabbix server with mysql database
** Preparing the system
** Preparing Zabbix server
********************
* DB_SERVER_HOST: 172.17.0.2
* DB_SERVER_PORT: 3306
* DB_SERVER_DBNAME: zabbix
* DB_SERVER_ZBX_USER: root
* DB_SERVER_ZBX_PASS: root
********************
** Creating 'root' user in MySQL database
** Database 'zabbix' does not exist. Creating...
** Creating 'zabbix' schema in MySQL
** Preparing Zabbix server configuration file
** Cleaning the system
########################################################
** Starting Zabbix server
Starting Zabbix Server. Zabbix 4.0.2 (revision 87228).

记录下zabbix-server的ip地址

docker inspect my-zabbix

这里是172.17.0.3

安装zabbix-web

docker run --name my-zabbix-web -e DB_SERVER_HOST="172.17.0.2" -e MYSQL_USER="root" -e MYSQL_PASSWORD="root" -e ZBX_SERVER_HOST="172.17.0.3" -e PHP_TZ="Asia/Shanghai" -p 8888:80 -p 9999:443 -d zabbix/zabbix-web-nginx-mysql

这里把时间设置为了上海时间. 查看日志显示如下:

** Deploying Zabbix frontend (nginx) with mysql database
** Preparing the system
** Preparing Zabbix web-interface
********************
* DB_SERVER_HOST: 172.17.0.2
* DB_SERVER_PORT: 3306
* DB_SERVER_DBNAME: zabbix
* DB_SERVER_ZBX_USER: root
* DB_SERVER_ZBX_PASS: root
********************
** Disable default vhosts
** Adding Zabbix virtual host (HTTP)
**** Impossible to enable SSL support for Nginx. Certificates are missed.
** Preparing Zabbix frontend configuration file
** Updating '/etc/php7/conf.d/99-zabbix.ini' parameter "max_execution_time": '600'... updated
** Updating '/etc/php7/conf.d/99-zabbix.ini' parameter "memory_limit": '128M'... updated
** Updating '/etc/php7/conf.d/99-zabbix.ini' parameter "post_max_size": '16M'... updated
** Updating '/etc/php7/conf.d/99-zabbix.ini' parameter "upload_max_filesize": '2M'... updated
** Updating '/etc/php7/conf.d/99-zabbix.ini' parameter "max_input_time": '300'... updated
** Updating '/etc/php7/conf.d/99-zabbix.ini' parameter "date.timezone": 'Asia/Shanghai'... added
** Cleaning the system
########################################################
** Executing supervisord
2018-12-15 14:11:28,388 CRIT Set uid to user 0
2018-12-15 14:11:28,388 CRIT Set uid to user 0
2018-12-15 14:11:28,390 INFO Included extra file "/etc/supervisor/conf.d/supervisord_zabbix.conf" during parsing
2018-12-15 14:11:28,390 INFO Included extra file "/etc/supervisor/conf.d/supervisord_zabbix.conf" during parsing
2018-12-15 14:11:28,404 INFO RPC interface 'supervisor' initialized
2018-12-15 14:11:28,404 INFO RPC interface 'supervisor' initialized
2018-12-15 14:11:28,406 INFO supervisord started with pid 1
2018-12-15 14:11:28,406 INFO supervisord started with pid 1
2018-12-15 14:11:29,411 INFO spawned: 'nginx' with pid 40
2018-12-15 14:11:29,411 INFO spawned: 'nginx' with pid 40
2018-12-15 14:11:29,488 INFO spawned: 'php-fpm7' with pid 41
2018-12-15 14:11:29,488 INFO spawned: 'php-fpm7' with pid 41
[15-Dec-2018 14:11:29] WARNING: Nothing matches the include pattern '/etc/php5/fpm.d/*.conf' from /etc/php7/php-fpm.conf at line 15.
2018-12-15 14:11:31,549 INFO success: nginx entered RUNNING state, process has stayed up for > than 2 seconds (startsecs)
2018-12-15 14:11:31,549 INFO success: nginx entered RUNNING state, process has stayed up for > than 2 seconds (startsecs)
2018-12-15 14:11:31,549 INFO success: php-fpm7 entered RUNNING state, process has stayed up for > than 2 seconds (startsecs)
2018-12-15 14:11:31,549 INFO success: php-fpm7 entered RUNNING state, process has stayed up for > than 2 seconds (startsecs)
172.17.0.1 - - [15/Dec/2018:14:11:34 +0000] "GET / HTTP/1.1" 200 1341 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" "-"
172.17.0.1 - - [15/Dec/2018:14:11:34 +0000] "GET /styles/blue-theme.css HTTP/1.1" 200 20706 "http://localhost:8888/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" "-"
172.17.0.1 - - [15/Dec/2018:14:11:34 +0000] "GET /js/browsers.js HTTP/1.1" 200 1582 "http://localhost:8888/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" "-"
172.17.0.1 - - [15/Dec/2018:14:11:34 +0000] "GET /jsLoader.php?ver=4.0.2&lang=en_GB&showGuiMessaging=0 HTTP/1.1" 200 585637 "http://localhost:8888/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" "-"
172.17.0.1 - - [15/Dec/2018:14:11:35 +0000] "GET /img/icon-sprite.svg HTTP/1.1" 200 65254 "http://localhost:8888/styles/blue-theme.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" "-"
172.17.0.1 - - [15/Dec/2018:14:11:35 +0000] "GET /img/touch-icon-192x192.png HTTP/1.1" 200 1334 "http://localhost:8888/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" "-"
172.17.0.1 - - [15/Dec/2018:14:11:35 +0000] "GET /favicon.ico HTTP/1.1" 200 32988 "http://localhost:8888/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" "-"

接下来就可以访问本机的8888端口访问了。默认的账号密码是Admin 密码是zabbixzabbix-web

安装zabbix-agent

docker pull zabbix/zabbix-agent
docker run --name my-zabbix-agent -e ZBX_HOSTNAME="Zabbix server" -e ZBX_SERVER_HOST="172.17.0.3" -d zabbix/zabbix-agent

这里的ZBX_HOSTNAME值是从web界面中查到的值。 查看日志docker logs my-zabbix-agent:

** Deploying Zabbix agent
** Preparing the system
** Preparing Zabbix agent
** Preparing Zabbix agent configuration file
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "PidFile": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "LogType": 'console'... added
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "LogFile": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "LogFileSize": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "DebugLevel": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "SourceIP": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "EnableRemoteCommands": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "LogRemoteCommands": ''... removed
** Using '172.17.0.3' servers for passive checks
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "Server": '172.17.0.3'... updated
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "ListenPort": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "ListenIP": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "StartAgents": ''... removed
** Using '172.17.0.3:10051' servers for active checks
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "ServerActive": '172.17.0.3:10051'... updated
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "Hostname": 'Zabbix server'... updated
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "HostnameItem": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "HostMetadata": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "HostMetadataItem": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "RefreshActiveChecks": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "BufferSend": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "BufferSize": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "MaxLinesPerSecond": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "Timeout": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "Include": '/etc/zabbix/zabbix_agentd.d/'... added first occurrence
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "UnsafeUserParameters": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "LoadModulePath": '/var/lib/zabbix/modules/'... added
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSConnect": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSAccept": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSCAFile": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSCRLFile": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSServerCertIssuer": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSServerCertSubject": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSCertFile": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSKeyFile": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSPSKIdentity": ''... removed
** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "TLSPSKFile": ''... removed
** Cleaning the system
########################################################
** Starting Zabbix agent
Starting Zabbix Agent [Zabbix server]. Zabbix 4.0.2 (revision 87228).
Press Ctrl+C to exit.

     1:20181215:144517.791 Starting Zabbix Agent [Zabbix server]. Zabbix 4.0.2 (revision 87228).
     1:20181215:144517.792 **** Enabled features ****
     1:20181215:144517.792 IPv6 support:          YES
     1:20181215:144517.792 TLS support:           YES
     1:20181215:144517.792 **************************
     1:20181215:144517.792 using configuration file: /etc/zabbix/zabbix_agentd.conf
     1:20181215:144517.792 agent #0 started [main process]
    56:20181215:144517.792 agent #1 started [collector]
    60:20181215:144517.792 agent #5 started [active checks #1]
    59:20181215:144517.794 agent #4 started [listener #3]
    58:20181215:144517.794 agent #3 started [listener #2]
    57:20181215:144517.796 agent #2 started [listener #1]

转载于:https://my.oschina.net/noryar/blog/3045313

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值