Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-8724

Improve confusing error messages when proxy configuration file contains unexpected values

    XMLWordPrintable

Details

    • Team A
    • Sprint 104 (Sep 2023), Sprint 105 (Oct 2023), Sprint 106 (Nov 2023), Sprint 107 (Dec 2023)
    • 1.5

    Description

      I have spent a lot of time on this myself at least twice. I hope this can also help others.

      Imagine that you decide to change your proxy from active to passive. Edit proxy configuration file and change the mode.

      --- /etc/zabbix/zabbix_proxy.conf.bak   2023-09-25 17:15:56.614060919 +0300
      +++ /etc/zabbix/zabbix_proxy.conf       2023-09-25 16:25:56.203630575 +0300
      
       # 0 == active, 1 == passive
      -ProxyMode=0
      +ProxyMode=1 

      You don't want to change anything else, so you restart your proxy:

      $ sbin/zabbix_proxy -c /etc/zabbix/zabbix_proxy.conf 
      zabbix_proxy [2179126]: Warning: ServerPort parameter is deprecated, please specify port in Server parameter separated by ':' instead

      Let's check my server parameters:

      $ grep '^Server' /etc/zabbix/zabbix_proxy.conf
      Server=127.0.0.1
      ServerPort=10052 

      OK, let's do exactly as suggested:

      $ grep '^Server' /etc/zabbix/zabbix_proxy.conf 
      Server=127.0.0.1:10052 

      Now try again:

      $ sbin/zabbix_proxy -c /etc/zabbix/zabbix_proxy.conf
      zabbix_proxy [2179169]: ERROR: invalid entry in "Server" configuration parameter: "127.0.0.1:10052"

      What? I just did what I was told to!

      Finally I realized that Server parameter does not need port when proxy is passive, but it's not clear from the error messages at all.

      I propose to add 1 new and change 1 log messages. First, when ServerPort is specified, add this one:

      $ sbin/zabbix_proxy -c /etc/zabbix/zabbix_proxy.conf
      zabbix_proxy [2207881]: ServerPort parameter is deprecated, besides, it is ignored in passive proxy mode

      And second, when Server contains port, change existing to:

      $ sbin/zabbix_proxy -c /etc/zabbix/zabbix_proxy.conf
      zabbix_proxy [2208075]: ERROR: unexpected "Server" configuration parameter value "127.0.0.1:10052", in passive mode it can only contain comma-separated list of peers

      The patch is really trivial one, attached.

      Attachments

        Activity

          People

            dimir dimir
            dimir dimir
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: