cetic / helm-zabbix

Helm Chart For Zabbix
https://artifacthub.io/packages/helm/cetic/zabbix
Apache License 2.0
56 stars 57 forks source link

[cetic/zabbix] warning message in the frontend #71

Closed scoopex closed 2 years ago

scoopex commented 2 years ago

Describe the bug

It seems that the deployed nginx image ("zabbix/zabbix-web-nginx-pgsql:ubuntu-6.0.7") has problems on connecting to the zabbix server instance. This problem appeared with release ~3.0.1 of the chart and clustered zabbix servers. A reduction of replicas to a single zabbix server lets the warning disappear.

See: The warning message

How to reproduce it (as minimally and precisely as possible):

Open zabbix web, wait for a few minutes to get the error message.

aeciopires commented 2 years ago

Hi @scoopex!

Thanks for your report. Does this problem happen using version 3.1.1 of helm chart? The version 3.0.1 of chart is old and it's will not be fixed.

I tested in my kind cluster with k8s v1.22.9 using Zabbix 6.0.7 and helm chart in version 3.1.1 with 2 replicas of zabbix-server component. Important: I used a new and clean database of PostgreSQL 14.x

I can't reproduce this issue.

See the evidences.

Please, could you test with helm chart 3.1.1?

Have a nice day!

2022-08-01_06-32 2022-08-01_06-35 2022-08-01_06-37 2022-08-01_06-39 2022-08-01_06-43 2022-08-01_06-45 2022-08-01_06-46

aeciopires commented 2 years ago

@sa-ChristianAnton for your information.

sa-ChristianAnton commented 2 years ago

I will look into this.

sa-ChristianAnton commented 2 years ago

Sorry, cannot reproduce, even using chart version 3.0.1.

I have deployed using this values.yaml:

zabbix_image_tag: ubuntu-6.0.7

db_access:
  use_unified_secret: true
  unified_secret_name: zabbixdb-pguser-zabbix
  unified_secret_autocreate: true

zabbixserver:
  enabled: true
  replicaCount: 2

postgresql:
  enabled: true

zabbixweb:
  enabled: true
  service:
    type: NodePort
    clusterIP:
    port: 80
    nodePort: 31080
    annotations: {}

After all containers came up, in Zabbix under "Reports"->"System Information" this came up:

Bildschirmfoto 2022-08-01 um 20 51 26

Note the green "yes" in the first line beside "Zabbix Server is running". This is only displayed, if the PHP service is actually able to contact the Zabbix server which is "active".

Zabbix web interface (container) finds the address of the Zabbix server to contact in Zabbix database, like this (executed in postgresql container):

root@mzbx-zabbix-postgresql-0:/# psql -U zabbix
psql (14.4 (Debian 14.4-1.pgdg110+1))
Type "help" for help.

zabbix=# select * from ha_node ;
         ha_nodeid         |                    name                    |    address    | port  | lastaccess | status |       ha_sessionid
---------------------------+--------------------------------------------+---------------+-------+------------+--------+---------------------------
 cl6b3pg3k00015i0sqwevtfpo | mzbx-zabbix-zabbix-server-6564dbf454-pgnhz | 10.42.230.100 | 10051 | 1659380053 |      3 | cl6b3pfso0000070smfpemwlm
 cl6b3phkr00015j0dljj5r3o3 | mzbx-zabbix-zabbix-server-6564dbf454-hfdtr | 10.42.36.185  | 10051 | 1659380055 |      0 | cl6b3phcu0000080dwa90t34k
(2 rows)

Note the addresses here are the same as in the above screenshot, and status "3" is "active".

Which exact addresses Zabbix Server writes into that "address" column depends on the ZBX_NODEADDRESS environment variable, which makes the configuration stanza "NodeAddress" to be set to this address. In our Helm Chart, we set this ENV var in the deployment for Zabbix server pods like that:

            - name: ZBX_NODEADDRESS
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP

The web interface will only catch up with this IP address from the database if the web interface has no "ZBX_SERVER" configuration stanza set in the /etc/zabbix/web/zabbix.conf.php file. In the Zabbix web container it is written as follows:

if (getenv('ZBX_SERVER_HOST')) {
    $ZBX_SERVER      = getenv('ZBX_SERVER_HOST');
    $ZBX_SERVER_PORT = getenv('ZBX_SERVER_PORT');
}

which means it depends on the environment variables ZBX_SERVER_HOST and ZBX_SERVER_PORT both NOT to be set:

zabbix@mzbx-zabbix-zabbix-web-599f56bc57-58nxp:/usr/share/zabbix$ env | grep ZBX_SERVER_HOST
zabbix@mzbx-zabbix-zabbix-web-599f56bc57-58nxp:/usr/share/zabbix$ env | grep ZBX_SERVER_PORT

So it works just fine.

I would like to see how these things look on your side. Maybe it helps us to find what's going wrong in your specific setup.

scoopex commented 2 years ago

I also experience this with the latest chart (3.1.1)

2022-08-05_17-58

zabbix=# select * from ha_node ;
         ha_nodeid         |                 name                  |   address    | port  | lastaccess | status |       ha_sessionid        
---------------------------+---------------------------------------+--------------+-------+------------+--------+---------------------------
 cl6gngtje00016hja426onjfg | zabbix-zabbix-server-586b7d679d-bh74c | 10.244.3.40  | 10051 | 1659715189 |      0 | cl6gngtdk000006jaqabclabc
 cl63w51t900016hk4bib83440 | zabbix-zabbix-server-586b7d679d-dwm86 | 10.244.0.125 | 10051 | 1659715189 |      3 | cl63w51abc00006k4o9zbdabc
sa-ChristianAnton commented 2 years ago

This is looking good so far. Can you check from inside your Zabbix-Web container that Zabbix Server is a) available on the IP address and the port from the DB query, and that there is no Env variable of those written by me in the last post set?

aeciopires commented 2 years ago

Hi guys!

This project is no longer supported. The code was migrated for https://github.com/zabbix-community/helm-zabbix We can continue the conversation in the new repository.