Ad Widget

Collapse

Linux available memory calculation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sterno
    Junior Member
    • Jan 2006
    • 24

    #1

    Linux available memory calculation

    I modified the agent code for Linux to add a "vm.memory.size[available]" key, which is (free + cache + buffer). This is the amount of memory that will be available if processes need it. Alternatively, a similar calculation of (used - cache - buffer) would yield the amount of memory actually being used by the OS and processes to run, which is what I graph in MRTG. I find both measures to be more generally useful than the standard "free" and "used" values, and I can't define an item that calculates either one because the field isn't long enough.

    The patch has had minimal testing, but Zabbix appears to return the correct data on my test system (RHEL4).

    Almost forgot, the patch is against 1.1beta7.
    Attached Files
    Last edited by sterno; 24-03-2006, 23:26.
  • mdasilva
    Junior Member
    • Feb 2006
    • 8

    #2
    great work

    excellent patch.

    how about getting a patch for timed averages for interfaces?
    net.if.in[eth0,avg15]

    Comment

    • mwdiers
      Junior Member
      • May 2006
      • 3

      #3
      Nice idea for a patch. I solved this particular problem with a couple of UserParameters:

      mem.available,free | grep buffers\/cache | cut --delimiter=' ' -f12
      mem.used,free | grep buffers\/cache | cut --delimiter=' ' -f7

      Of course, this has such general usage, that it's a pain to setup. I put these on every one of our servers.

      Sure would be nice if it were possible to create UserParameters server-side and put them into Templates.

      Comment

      • abi
        Member
        • Jun 2006
        • 81

        #4
        hi guys,

        is there a particular reason why this patch has not been added
        to CVS yet?

        Comment

        • Lunarnexus
          Junior Member
          • Nov 2007
          • 1

          #5
          Did this ever get integrated?

          So, here's the patch for v1.1, but I don't see this code in the source for 1.4.2-2. Did this patch ever get integrated into the code base?

          Right now, I'm using a UserParameter in zabbix_agentd.conf

          UserParameter=up.vm.memory.inactive,grep Inactive: /proc/meminfo | perl -p -e "s/\s+/ /g" | cut -f2 -d " "

          But, as you can see it opens at least 2 shells to get the job done, hence isn't very efficient.

          Comment

          • Alexei
            Founder, CEO
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2004
            • 5654

            #6
            Yes, the patch will be integrated into ZABBIX soon.
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            • sterno
              Junior Member
              • Jan 2006
              • 24

              #7
              I think the 1.4 packages created by Debian and Ubuntu include an updated version of the patch.

              Comment

              • Alexei
                Founder, CEO
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Sep 2004
                • 5654

                #8
                I included support of 'available' memory into ZABBIX code.
                Alexei Vladishev
                Creator of Zabbix, Product manager
                New York | Tokyo | Riga
                My Twitter

                Comment

                • cronosii
                  Junior Member
                  • Oct 2007
                  • 5

                  #9
                  Hi

                  I'm seeing something very weird:

                  HTML Code:
                  Host-A# md5sum /opt/zabbix/sbin/zabbix_agent
                  36dfffaea515b996fac59590c1155a7a  /opt/zabbix/sbin/zabbix_agent
                  Host-A# /etc/init.d/zabbix-agent stop
                  Stopping Zabbix agent daemon: zabbix_agentd
                  Host-A# ps aux | grep zabbix_agent | grep -v grep | wc -l
                  0
                  Host-A# /etc/init.d/zabbix-agent start
                  Starting Zabbix agent daemon: zabbix_agentd
                  Host-A# ps aux | grep zabbix_agent | grep -v grep | wc -l
                  4
                  Host-A# telnet localhost 10050
                  Trying 127.0.0.1...
                  Connected to localhost.
                  Escape character is '^]'.
                  vm.memory.size[available]
                  ZBXD    184832000Connection closed by foreign host.
                  Host-A# 
                  HTML Code:
                  Host-B# md5sum /opt/zabbix/sbin/zabbix_agent
                  36dfffaea515b996fac59590c1155a7a  /opt/zabbix/sbin/zabbix_agent
                  Host-B# /etc/init.d/zabbix-agent stop
                  Stopping Zabbix agent daemon: zabbix_agentd
                  Host-B# ps aux | grep zabbix_agent | grep -v grep | wc -l
                  0
                  Host-B# /etc/init.d/zabbix-agent start
                  Starting Zabbix agent daemon: zabbix_agentd
                  Host-B# ps aux | grep zabbix_agent | grep -v grep | wc -l
                  6
                  Host-B# telnet localhost 10050
                  Trying 127.0.0.1...
                  Connected to localhost.
                  Escape character is '^]'.
                  vm.memory.size[available]
                  ZBXDZBX_NOTSUPPORTEDConnection closed by foreign host.
                  Host-B# 
                  Even though is the same agent, available works on A but not on B. I built the agent in A. Why can this be happening?

                  This happens both built as shared or static

                  Thanks
                  Last edited by cronosii; 30-11-2007, 01:24.

                  Comment

                  • cronosii
                    Junior Member
                    • Oct 2007
                    • 5

                    #10
                    Ok, I found it... I was looking at /opt/zabbix/sbin/zabbix_agent instead of /opt/zabbix/sbin/zabbix_agentd... man, this took me a lot of time, the clue came when I launched gdb and the lines didn't match...

                    Comment

                    • jroberson
                      Senior Member
                      • May 2008
                      • 124

                      #11
                      Just came across this thread and noticed that vm.memory.size[available] isn't documented in the Zabbix Manual, but it does still seem to exists as I can create an item and get data from it.

                      I guess the vm.memory.size[used] was never implemented as I get an "unsupported" message.

                      Comment

                      Working...