Ad Widget

Collapse

Error: Cannot open file: [2] No such file or directory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicolas.pereira
    Junior Member
    • Dec 2024
    • 2

    #1

    Error: Cannot open file: [2] No such file or directory

    Hello, I have a Zabbix server running in a Docker container according to the .yaml compose file.

    I am trying to read a file that is being generated on the host machine according to the volume mapping in the compose.

    I am trying to use the item: vfs.file.contents[/var/lib/zabbix/httptrace_results.json]

    However, the error is always the same: Cannot open file: [2] No such file or directory

    I have already tried adjusting permissions, even setting chmod 777, but the error persists. Could someone help?

    I have also tried checking the logs of the Zabbix server container, but there is no output shown there. I have also tried without the ro option.

    Code:
      zabbix-server:
        image: zabbix/zabbix-server-mysql:ubuntu-latest
        container_name: zabbix-server
        privileged: true
        environment:
          DB_SERVER_HOST: zabbix-db
          MYSQL_DATABASE: zabbix
          MYSQL_USER: zabbix
          MYSQL_PASSWORD: 
          ZBX_SERVER_NAME: 'xpto'
          ZBX_CACHESIZE: 512M
          ZBX_VALUECACHESIZE: 256M
          ZBX_STARTPOLLERS: 15
          ZBX_STARTPREPROCESSORS: 10
          ZBX_STARTHTTPPOLLERS: 10
        depends_on:
          - zabbix-db
        ports:
          - "10051:10051"
        volumes:
          - /opt/monitor-data/zabbix-server-data:/var/lib/zabbix
          - /etc/localtime:/etc/localtime:ro
          - /root/monitor-cae/httptrace/httptrace_results.json:/var/lib/zabbix/httptrace_results.json:ro
        networks:
          zabbix-network:
            ipv4_address: 172.30.0.3
        restart: unless-stopped
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #2
    Edited the post,
    Can you access other files from the container correctly and check userparameters if you allowed the agent to be able to access it as wel.
    Last edited by Brambo; 10-12-2024, 12:44. Reason: Misunderstood the question.

    Comment

    • nicolas.pereira
      Junior Member
      • Dec 2024
      • 2

      #3
      I discovered the issue, and it was basically my mistake—I think I was tired.

      I was trying to read the file from inside the Zabbix Server container, which doesn’t have an agent installed. The location where I should have been looking for my file was on the host that runs the Zabbix Server, as only there an agent was installed. After fixing this, everything worked. Thank you!

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        As long as I understand this, your container maps /var/lib/zabbix as /opt/monitor-data/zabbix-server-data, so you should maybe turn to that file as "/opt/monitor-data/zabbix-server-data/httptrace_results.json" ?

        Comment

        • Brambo
          Senior Member
          • Jul 2023
          • 245

          #5
          Had a second look,
          Is it possible to do a docker exec and cat the file you try to use. If it's not possible by docker exec than you know where to look.
          A mount bind is possible on file but it should be there when you try to create the bind.

          Comment

          Working...