docker安装zabbix出现的问题

1、根据官方文档启动zabbix-web-nginx-mysql容器时,网页访问http://IP+8081,访问失败。

 官方启动zabbix-web-nginx-mysql容器:

# docker run --name zabbix-web-nginx-mysql -t \
      -e DB_SERVER_HOST="mysql-server" \
      -e MYSQL_DATABASE="zabbix" \
      -e MYSQL_USER="zabbix" \
      -e MYSQL_PASSWORD="zabbix_pwd" \
      -e MYSQL_ROOT_PASSWORD="root_pwd" \
      --link mysql-server:mysql \
      --link zabbix-server-mysql:zabbix-server \
      -p 80:80 \
      -d zabbix/zabbix-web-nginx-mysql:latest

浏览器访问http://IP+80时,访问页面失败。 可能是端口映射的问题。 在容器中nginx的端口是8080 。 在启动容器时, 可将端口映射改为  -p  80:8080

# docker run --name zabbix-web-nginx-mysql -t \
      ......

      -p 80:8080 \
      -d zabbix/zabbix-web-nginx-mysql:latest

2、首次网页登陆zabbix提示账号密码错误

  1.   默认账号密码,Admin/zabbix。 此处注意 Admin非admin
  2.   修改密码    
    1、进入mysql容器
    [root@hecs-136019 ~]# docker exec -it zabbix-mysql /bin/bash
    
    
    
    2、连接数据库 进入zabbix库
    root@5e035217b7f5:/# mysql -uzabbix -pzabbix
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 300
    Server version: 8.0.28 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2022, Oracle and/or its affiliates.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> use zabbix;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    mysql> show tables;
    +----------------------------+
    | Tables_in_zabbix           |
    +----------------------------+
    | acknowledges               |
    | actions                    |
    |               |
    | triggers                   |
    | users                      |
    | users_groups               |
    | usrgrp                     |
    | valuemap                   |
    | valuemap_mapping           |
    | widget                     |
    | widget_field               |
    +----------------------------+
    173 rows in set (0.00 sec)
    
    
    
    #账号密码存在users表内, userid为1的是Admin账号
    
    
    mysql> select * from users;
    +--------+----------+--------+---------------+--------------------------------------------------------------+-----+-----------+------------+---------+---------+---------+----------------+------------+---------------+---------------+----------+--------+
    | userid | username | name   | surname       | passwd                                                       | url | autologin | autologout | lang    | refresh | theme   | attempt_failed | attempt_ip | attempt_clock | rows_per_page | timezone | roleid |
    +--------+----------+--------+---------------+--------------------------------------------------------------+-----+-----------+------------+---------+---------+---------+----------------+------------+---------------+---------------+----------+--------+
    |      1 | Admin    | Zabbix | Administrator | $2y$10$92nDno4n0Zm7Ej7Jfsz8WukBfgSS/U0QkIuu8WkJPihXBb2A1UrEK |     |         1 | 0          | default | 30s     | default |              0 |            |             0 |            50 | default  |      3 |
    |      2 | guest    |        |               | $2y$10$89otZrRNmde97rIyzclecuk6LwKAsHN0BcvoOKGjbT.BwMBfm7G06 |     |         0 | 15m        | default | 30s     | default |              0 |            |             0 |            50 | default  |      4 |
    +--------+----------+--------+---------------+--------------------------------------------------------------+-----+-----------+------------+---------+---------+---------+----------------+------------+---------------+---------------+----------+--------+
    2 rows in set (0.00 sec)
    
    
    # 查看密码是md5加密状态
    
    
    mysql> select userid,passwd from users;
    +--------+--------------------------------------------------------------+
    | userid | passwd                                                       |
    +--------+--------------------------------------------------------------+
    |      1 | $2y$10$92nDno4n0Zm7Ej7Jfsz8WukBfgSS/U0QkIuu8WkJPihXBb2A1UrEK |
    |      2 | $2y$10$89otZrRNmde97rIyzclecuk6LwKAsHN0BcvoOKGjbT.BwMBfm7G06 |
    +--------+--------------------------------------------------------------+
    2 rows in set (0.00 sec)
    
    3、另外开启终端,生成一个md5加密密码 对应的密码为redhat
    
    [root@hecs-136019 ~]# echo -n redhat | openssl md5
    (stdin)= e2798af12a7a0f4f70b4d69efbc25f4d
    
    4、继续在mysql容器里更改Admin密码为redhat
    
    mysql> update users set passwd='e2798af12a7a0f4f70b4d69efbc25f4d' where userid=1;
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0

3、时区不对

docker安装zabbix出现的问题_第1张图片

 修改时区为UTC

1、进入zabbix-web-nginx-mysql容器, 找到php-fpm的配置文件

[root@hecs-136019 ~]# docker exec -it zabbix-web-nginx-mysql /bin/bash

 bash-5.1$ cd  /etc/php8/php-fpm.d
 bash-5.1$ ls
 zabbix.conf

2、修改为UTC

 bash-5.1$ vi zabbix.conf 

   php_value[date.timezone] = UTC

4、zabbix-server状态异常

更改/etc/zabbix/zabbix-agentd.conf配置文件
  UnsafeUserParameters=1

[root@hecs-136019 ~]# docker exec  -it zabbix-agent-2 /bin/bash

 5cd564f525d5:/var/lib/zabbix$ ls /etc/zabbix/
 zabbix_agent2.conf  zabbix_agent2.d  zabbix_agentd.d
 5cd564f525d5:/var/lib/zabbix$
 5cd564f525d5:/var/lib/zabbix$ vi /etc/zabbix/zabbix_agent2.conf
   ......
    UnsafeUserParameters=1
   ......

退出容器 重启zabbix-agent容器, 查看zabbix-server状态

 

你可能感兴趣的:(docker,zabbix,运维)