Ad Widget

Collapse

Connection issues with Zabbix agent/Proxies on Nginx reverse proxy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fred1984
    Junior Member
    • Mar 2022
    • 2

    #1

    Connection issues with Zabbix agent/Proxies on Nginx reverse proxy

    Dear guys,

    I hope this post is not a duplicate on another and I'm sorry if it is, but so far i didn't found anywhere the same problem. Also I normally diagnosed the cause but I don't know how to resolve it or if it is possible to resolve ( spent few days already on it...)


    so here is the situation:

    -we are testing zabbix (v6) server on a cloud server with currently assigned a public IP (under Ubuntu 20.04).
    - our company is using a nginx reverse proxy on another cloud server which has, as well, another public IP (under windows 2016)
    - I successfully reverse proxy zabbix server (followed the instructions from the official youtube video: https://www.youtube.com/watch?v=UjYZRm0ss30) and i customized a little bit to match to my situation

    server {
    listen 443 ssl;
    server_name zabbix.server.com;
    location / {
    proxy_pass http://PublicIPZabbixServer:80$request_uri;
    proxy_http_version 1.1;
    }
    }
    but i have a problem with the agents (tested in active mode and without encryption at that time). I certainly missed some skills , but my objective is to proxy also the agent into my main nginx server and only communicate with this nginx server. when i setup the Zabbix agents with my nginx server name (zabbix.server.com) agent refuse to connect and logs show a header issue:

    2148:20220317:113215.266 Starting Zabbix Agent [AgentHostname]. Zabbix 6.0.2 (revision d726a4d916).
    2148:20220317:113215.271 **** Enabled features ****
    2148:20220317:113215.276 IPv6 support: YES
    2148:20220317:113215.281 TLS support: NO
    2148:20220317:113215.285 **************************
    2148:20220317:113215.289 using configuration file: c:\Program Files\Zabbix6.0.2\conf\zabbix_agentd.conf
    2148:20220317:113215.874 agent #0 started [main process]
    4032:20220317:113215.880 agent #1 started [collector]
    8464:20220317:113215.885 agent #3 started[listener #2]
    10256:20220317:113215.890 agent #5 started [active checks #1]
    13256:20220317:113215.895 agent #4 started[listener #3]
    8404:20220317:113215.901 agent #2 started[listener #1]
    10256:20220317:113215.987 Message from zabbix.server.com is missing header. Message ignored.
    10256:20220317:113215.998 Unable to receive from [zabbix.server.com]:10051 []
    10256:20220317:113216.009 Active check configuration update started to fail
    I tried to add different header commands found from the forum : https://www.zabbix.com/forum/zabbix-...oxy-with-nginx but it seems there is not changes

    I also added into the reverse proxy an entry for the port 10051 just in case:

    server {
    listen 10051;
    #server_name zabbix.server.com;
    location / {
    proxy_pass http://PublicIPZabbixServer:10051$request_uri;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_http_version 1.1;
    }
    }
    I'm pretty sure something is incorrect on my nginx proxy instruction but i don't know what.

    The reason of this, is later on, the Zabbix server will not have a public IP, and it will be connected with internal IP with the Nginx server. So all connections must go through my Nginx server.

    That's it, i don't know if I'm clear, ask me question if it is, and i hope this post can find a solution

    Thanks in Advance,
    Frederic
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    Communication between Zabbix server and Zabbix agent uses its own protocol instead of HTTP or HTTPS, so maybe you need to use stream?

    This chapter describes how to use F5 NGINX Plus and NGINX Open Source to proxy and load balance TCP and UDP traffic.

    Comment

    • fred1984
      Junior Member
      • Mar 2022
      • 2

      #3
      Hi Atsushi,

      Thank you , indeed the problem comes from here! And indeed the Agent is not using HTTP protocol, so i didn't realized this problem

      For information for other people with this problem just add this:

      1 Add the HTML GUI reverse proxy
      2 Below the HTML tag, create a new one stream:

      stream {
      upstream zabbixagent {
      server PublicIPZabbixServer:10051;
      }
      server {
      listen 10051;
      proxy_pass zabbixagent;
      }
      }
      Thanks again !

      Comment

      Working...