Ad Widget

Collapse

ZBX_SERVER_HOST and ZBX_ACTIVESERVERS causes duplicate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • richard.murray
    Junior Member
    • Apr 2018
    • 6

    #1

    ZBX_SERVER_HOST and ZBX_ACTIVESERVERS causes duplicate

    Deploying Zabbix agent, if ZBX_SERVER_HOST is given a value "X" and ZBX_ACTIVESERVERS is given the value "X" the agent fails to load with duplicate value in ZBX_ACTIVESERVERS. So the agent is combining the two values...
  • richard.murray
    Junior Member
    • Apr 2018
    • 6

    #2
    Update, another zabbix-server entry is being added to the ServerActive list which causes the agent to fail.

    I think this is a bug.!?

    The following yml causes the Zabbix agent to fail;

    ---
    apiVersion: v1
    kind: Service
    metadata:
    name: zabbix-agent
    labels:
    run: zabbix-agent
    spec:
    ports:
    - port: 10050
    protocol: TCP
    name: zabbix-passive
    selector:
    run: zabbix-agent
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: zabbix-agent
    spec:
    selector:
    matchLabels:
    run: zabbix-agent
    replicas: 1
    template:
    metadata:
    labels:
    run: zabbix-agent
    spec:
    hostname: "zabbix-agent"
    containers:
    - name: zabbix-agent
    image: zabbix/zabbix-agent:ubuntu-latest
    env:
    - name: ZBX_PASSIVE_ALLOW
    value: "false"
    - name: ZBX_ACTIVE_ALLOW
    value: "true"
    - name: ZBX_ACTIVESERVERS
    value: "zabbix-server"
    - name: ZBX_DEBUGLEVEL
    value: "3"
    ports:
    - containerPort: 10050

    Logs from zabbix-agent container;

    PS C:\kubectl> .\kubectl.exe logs zabbix-agent-744599fdd5-zf8gl
    ** 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": '3'... added
    ** 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
    ** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "Server": ''... removed
    ** 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 'zabbix-server:10051,zabbix-server' servers for active checks
    ** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "ServerActive": 'zabbix-server:10051,zabbix-server'... updated
    ** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "Hostname": ''... removed
    ** 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
    zabbix_agentd [56]: error parsing a "ServerActive" option: address "zabbix-server" specified more than once
    PS C:\kubectl>

    Comment

    • dimir
      Zabbix developer
      • Apr 2011
      • 1080

      #3
      This is not related to Zabbix, you have some kind of container issue. If it's docker report the issue there:

      Official Zabbix Dockerfiles. Contribute to zabbix/zabbix-docker development by creating an account on GitHub.

      Comment

      • vesper1978
        Member
        • Nov 2016
        • 59

        #4
        Looks like it's a kubernetes issue. You could check your base zabbix_agent.conf to see what "ServerActive" is set to before kubernetes applies the values in your yml. I suspect there's already a value in it, and it's being appended and not overwritten.

        Comment

        • richard.murray
          Junior Member
          • Apr 2018
          • 6

          #5
          Initially that's what I thought but it's the Zabbix Agent container which is doing the changing. If I don't specify a ZBX_SERVER_HOST it defaults to zabbix-server, but if I specify ZBX_ACTIVESERVERS it duplicates!

          You get ** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "ServerActive": 'zabbix-server:10051,zabbix-server'... updated

          The "iszabbix-server:10051" not mine!

          I think there is some issue with defaults and if this then that logic in the Zabbix Agent docker image..?

          This yml snippet;

          env:
          - name: ZBX_STARTAGENTS
          value: "0"
          - name: ZBX_PASSIVE_ALLOW
          value: "false"
          - name: ZBX_ACTIVE_ALLOW
          value: "true"
          - name: ZBX_ACTIVESERVERS
          value: "zabbix-server"
          - name: ZBX_DEBUGLEVEL
          value: "3"

          results in the following;

          PS C:\kubectl> .\kubectl.exe logs zabbix-agent-6895744ccf-j9894
          ** 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": '3'... added
          ** 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
          ** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "Server": ''... removed
          ** 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": '0'... added
          ** Using 'zabbix-server:10051,zabbix-server' servers for active checks
          ** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "ServerActive": 'zabbix-server:10051,zabbix-server'... updated
          ** Updating '/etc/zabbix/zabbix_agentd.conf' parameter "Hostname": ''... removed
          ** 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
          zabbix_agentd [59]: error parsing a "ServerActive" option: address "zabbix-server" specified more than once
          PS C:\kubectl>

          Comment

          • vesper1978
            Member
            • Nov 2016
            • 59

            #6
            So, sounds like the zabbix_agent.conf in your docker image has "ServerActive=zabbix-server:10051" already defined in it. If you want kubernetes to deploy docker images and configure your zabbix-agent then I'd suggest modifying the zabbix_agent.conf in the docker image so that anything you don't want it to append to is left blank.

            Comment

            • juanluisbaptiste
              Junior Member
              • Aug 2019
              • 2

              #7
              Hi,

              This has nothing to do with kubernetes, it also happens if you launch zabbix on your laptop with the official images. I'm testing 4.4 and this is still happening, sound more like a bug in the official images.

              Comment

              • Daz Romance
                Junior Member
                • Oct 2022
                • 1

                #8
                Hi,
                Sorry for digging up a very old thread but I have faced this issue recently and found a work around that could help other until this is fixed.

                The zabbix_agent2.conf file from the Docker image has "ServerActive=zabbix-server:10051" inside it and the env vars only append values to it. (seen in zabbix/zabbix-agent2:alpine-6.2-latest)

                So I just decided to NOT set the ZBX_SERVER_HOST or ZBX_ACTIVESERVERS vars and instead use the HostAlias feature in the daemonset configuration.
                With this "zabbix-server" will point to whatever IP you need :

                Code:
                hostAliases:
                  - ip: 12.34.56.78
                    hostnames:
                      - zabbix-server​
                This goes under the second "spec" in the daemonset definition.

                Hope this helps someone out there

                Comment

                Working...