Ad Widget

Collapse

High memory usage on a rasberry pi 4 8GB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • servant-frost
    Junior Member
    • Apr 2021
    • 19

    #1

    High memory usage on a rasberry pi 4 8GB

    Hello. I have an agent installed on a RPi4 with 8GB of ram. Without the Zabbix agent running, the Pi consumes about 1.5 GB of memory. If I enable the Zabbix agent, it will jump to 2.5 GB. Not such a big deal but over time (less than 24 hours), memory consumption will go to 7.5GB and the Pi will eventually crash due to no memory. If I stop the Zabbix agent service, it does not release the memory.

    Key items:
    Raspberry Pi OS Bullseye 64 bit
    Agent: zabbix-agent_5.4.10-1+debian11_amd64.deb

    Can anyone suggest how I can go about reducing memory consumption, or at least, capping it?

    Thank you.
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    Hmm, are you sure you are running an amd64 agent on your Pi? Because I only see arm64 and armhf packages in https://repo.zabbix.com/zabbix/5.4/r...main/z/zabbix/

    Anyway, it is always worth updating to the latest release when suspecting a problem.

    Markku

    Comment

    • servant-frost
      Junior Member
      • Apr 2021
      • 19

      #3
      You are absolutely correct. My apologies, I posted the wrong one. It is - zabbix-agent_5.4.12-1+debian11_arm64.deb

      Comment

      • orbenet
        Junior Member
        • May 2022
        • 5

        #4
        Hello servant-frost,

        I have some agents installed on Rpi3 and Rpi4. I wanted to mention that even if you use Zabbix Server 5 or 6 - you can use a lower version agent. I use Zabbix Agent version 4 on my Rpis and works pretty well.

        My suggestion is to try different versions of the agent until you can find one that would provide stability.

        Also, can you tell what processes are taking that much memory and their full commands? You can install htop (apt install htop) and run it and sort by mem usage to see what process is causing issue. Could be zabbix is not root cause and it is calling some other process which has an issue.

        Let me know how it goes - I will be checking back to see if I can provide more assistance.

        Comment

        • servant-frost
          Junior Member
          • Apr 2021
          • 19

          #5
          Hi there, I appreciate the suggestions. I have been doing some testing and here is what I noticed. Using top, I can see that if zabbix-agent isn't running, memory will be at about 400MB consumed. If it starts, the actual memory used goes up to 300MB but the free memory drops by 4G. If I look at the buffer/cache, it consumes 4282.9 MB and slowly grows. This doesn't happen if Zabbix isn't running. Using htop confirms that the agent itself isn't consuming a lot of memory. But it does cause the cache to instantly increase and slowly grow after that. Is there a way to limit this cache size? I will try older agents and see if that changes things.

          Comment


          • orbenet
            orbenet commented
            Editing a comment
            Gotcha! This is actually normal linux behavior! Buffer just means that data that was in RAM is staying there in case it is needed again. If you have something else that needs that RAM, it should clear it out.



            Do you have SWAP partition on your PI? With SWAP you should avoid memory exhaustion causing system freeze/crash.
        • servant-frost
          Junior Member
          • Apr 2021
          • 19

          #6
          I will check the swap partition today. It is the default install of the RPi OS. What I noticed is when I tried to install Suricata, it needs about 1GB of mem on its own, and both it and Zabbix can't run on the same Pi. It's one or the other. But what disturbed me is that, at least from what I could tell, the cache memory was never released and over time, the main memory would decrease until services would crash. I can use the device for about 2 days before services will crash. If I leave Zabbix off, this doesn't happen.

          Comment

          • NGate-Jonathan
            Member
            • Jun 2022
            • 32

            #7
            So far I running the agent on my Raspberry Pi 8GB and it works perfectly fine without any memory usage issue. RAM will be high for first few hours as the agent capture and retrieving the data to be sending over to the server. After that, the RAM usage will drop back to normal. That is my case. I running Ubuntu on my Raspberry Pi 8GB.

            Comment

            • servant-frost
              Junior Member
              • Apr 2021
              • 19

              #8
              I appreciate everyone's help on this. I may just format it and start over but my memory will continue to increase until services start crashing. Thank you all, I am grateful.

              Comment

              Working...