Ad Widget

Collapse

Passing VMware Env Variables to Docker compose!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • einsteinagogo
    Junior Member
    • Feb 2025
    • 5

    #1

    Passing VMware Env Variables to Docker compose!

    Must be doing something wrong, I still cannot parse the variables

    # VMware monitoring settings
    ZBX_STARTVMWARECOLLECTORS: 3
    ZBX_VMWAREFREQUENCY: 60
    ZBX_VMWAREPERFFREQUENCY: 60
    ZBX_VMWARECACHESIZE: 32M
    ZBX_VMWARETIMEOUT: 120

    I've added these as a .ENV via Portainer, added them in the Stacks, and they are still defaults in the

    /etc/zabbix/zabbix_server_vmware.conf file

    other than hardcoding them in the above file I still don't know why the variables are not added to the file.

    e.g.

    ### Option: StartVMwareCollectors
    # Number of pre-forked vmware collector instances.
    #
    # Mandatory: no
    # Range: 0-250
    # Default:
    # StartVMwareCollectors=0

    StartVMwareCollectors=${ZBX_STARTVMWARECOLLECTORS}

    ### Option: VMwareFrequency
    # How often Zabbix will connect to VMware service to obtain a new data.
    #
    # Mandatory: no
    # Range: 10-86400
    # Default:
    # VMwareFrequency=60

    VMwareFrequency=${ZBX_VMWAREFREQUENCY}

    ### Option: VMwarePerfFrequency
    # How often Zabbix will connect to VMware service to obtain performance data.
    #
    # Mandatory: no
    # Range: 10-86400
    # Default:
    # VMwarePerfFrequency=60

    VMwarePerfFrequency=${ZBX_VMWAREPERFFREQUENCY}

    ### Option: VMwareCacheSize
    # Size of VMware cache, in bytes.
    # Shared memory size for storing VMware data.
    # Only used if VMware collectors are started.
    #
    # Mandatory: no
    # Range: 256K-2G
    # Default:
    # VMwareCacheSize=8M

    VMwareCacheSize=${ZBX_VMWARECACHESIZE}

    ### Option: VMwareTimeout
    # Specifies how many seconds vmware collector waits for response from VMware service.
    #
    # Mandatory: no
    # Range: 1-300
    # Default:
    # VMwareTimeout=10

    VMwareTimeout=${ZBX_VMWARETIMEOUT}
    bc9d571eb882:/etc/zabbix$

    Any ideas ?​
  • einsteinagogo
    Junior Member
    • Feb 2025
    • 5

    #2
    21 views, and no comments ?

    Comment

    • PavelZ
      Senior Member
      • Dec 2024
      • 162

      #3
      This configuration works exactly as described for me.
      Did you use a semi-official compose file ? i mean https://github.com/zabbix/zabbix-docker.
      It is quite complex and changes frequently. (That's why I don't use it, but it definitely works. I use a simpler set of files )

      Do you want to check in parts whether the variables were correctly transferred to the container with the server? Most likely this is the issue.
      This can be easily done using docker commands docker inspect. Also check entrypoint script at /usr/bin/docker-entrypoint.sh
      Last edited by PavelZ; 03-03-2025, 15:24.

      Comment

      • jhboricua
        Senior Member
        • Dec 2021
        • 113

        #4
        Have a look at this and see if you're running into what's described there:

        Comment

        • Brambo
          Senior Member
          • Jul 2023
          • 245

          #5
          What we do with docker compose file is: (i only add partial code)
          Code:
           volumes:
             - /etc/localtime:/etc/localtime:ro
             - ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts:ro
             - ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts:ro
          .....
          env_file:
          - ./env_vars/.env_db_mysql
          - ./env_vars/.env_srv​
          In the .env_srv we have all ZBX_xxx variables setup.
          And that file you can set values the way you want. (by hand or external tooling)
          And the file should look something like this (without line numbering of course )
          Click image for larger version

Name:	image.png
Views:	273
Size:	15.4 KB
ID:	500056

          Comment

          • einsteinagogo
            Junior Member
            • Feb 2025
            • 5

            #6
            Thanks I’m going to check my config

            Comment

            • einsteinagogo
              Junior Member
              • Feb 2025
              • 5

              #7
              Okay, still not finding that the variables are being updated in the correct .conf file.

              they are definately present in the entropy.sh , just not being acted upon.

              So removing environmental variables from portainter, end env files.... this is my docker compose in the stack

              zabbix-server:
              image: zabbix/zabbix-server-pgsql
              container_name: Zabbix-SERVER
              ports:
              - 10051:10051
              environment:
              DB_SERVER_HOST: postgres
              DB_SERVER_PORT: 5432
              POSTGRES_DB: zabbix
              POSTGRES_USER: zabbixuser
              POSTGRES_PASSWORD: zabbixpass
              ZBX_STARTVMWARECOLLECTORS: 3
              ZBX_VMWAREFREQUENCY: 60
              ZBX_VMWAREPERFFREQUENCY: 60
              ZBX_VMWARECACHESIZE: 32M
              ZBX_VMWARETIMEOUT: 120



              the first variables DB server etc are working okay, but the ZBX variables are not being written to the zabbix_server_vmware.conf ?

              Click image for larger version

Name:	image.png
Views:	275
Size:	22.4 KB
ID:	500831
              there are present, so this is not an env issue, something in the build is not passing the variables, or I've got the wrong variables ?
              Last edited by einsteinagogo; 20-03-2025, 16:16.

              Comment

              • Brambo
                Senior Member
                • Jul 2023
                • 245

                #8
                Well in my situation all .env_srv are parsed into the zabbix-server.conf (in /etc/zabbix) (left cat on the file / right content of the env file)
                Click image for larger version

Name:	image.png
Views:	236
Size:	26.4 KB
ID:	500837
                Click image for larger version

Name:	image.png
Views:	227
Size:	11.6 KB
ID:	500838
                Click image for larger version

Name:	image.png
Views:	221
Size:	51.9 KB
ID:	500839
                So I do think something is going wrong, are you looking in the correct container? Even in portainer the env variables are shown correct Click image for larger version

Name:	image.png
Views:	229
Size:	18.4 KB
ID:	500840​​​

                Comment

                Working...