Ad Widget

Collapse

How does zabbix_agentd get swap statistics

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dave smith
    Junior Member
    • Aug 2006
    • 7

    #1

    How does zabbix_agentd get swap statistics

    Hi, I'm trying to measure the swap activity on our servers using the system.swap.in and the system.swap.out. On about half of our servers the agent says it's not supported, and on the other half it's always zero.

    How does the agent know if it has this data, and where does it get it from?

    I run "sar" on the servers, and it shows that pages are being loaded and saved to the swap. (with the -B parameter).

    Should I just write a script that queries "sar" instead of the internal agent checks?

    I'm using zabbix 1.4 from May 29th.

    Thanks!
    Dave Smith
  • dave smith
    Junior Member
    • Aug 2006
    • 7

    #2
    Ok, after spending a number of hours investigating, i think it's a sorta complicated problem.

    Zabbix Agent looks to /proc/diskstats (kernel 2.6), sees which device is the swap partition (/proc/swaps) and reads the block reads and writes for that device.

    On the servers where this doesn't work, we have used LVM which is a device mapper, so /proc/swaps shows /dev/mapper/raid5swap and /proc/partitions shows the physical device. It's therefore unable to match it based on the string name.

    If anyone is feeling productive, it could be matched on the unix device number. You would need to find the mapper device name from /proc/swaps, call stat on that device, which gives the major and minor numbers for the device. This can then be matched against the device in /proc/diskstats.

    Not sure what I'll do in the mean time.

    Comment

    • globifrosch
      Member
      • Sep 2005
      • 74

      #3
      ok, i've encountered this problem with zabbix agentd 1.6.1 and LVM. Zabbix agent tells "unsupported" for system.swap.out and system.swap.in

      for system without LVM it works without problems.

      - Thomas

      Comment

      • Takanori Suzuki
        Junior Member
        • Jun 2008
        • 11

        #4
        Hi, I posted bug info and a fix about this problem to BTS as "ZBX-1015".



        How to compile:

        (1) download following files.
        zabbix-1.6.5.tar.gz
        zabbix-1.6.5-dm_swap-02.patch (from ZBX-1015)

        (2) patch
        $ tar xzf zabbix-1.6.5.tar.gz
        $ cd zabbix-1.6.5
        $ patch -p1 < ../zabbix-1.6.5-dm_swap-02.patch
        patching file src/libs/zbxsysinfo/linux/swap.c

        (3) configure & make
        $ ./configure --enable-agent
        $ make

        (4) now, you can get swap.in and swap.out from LVM devices (and maybe also device-mapper devices.)
        $ ./src/zabbix_agent/zabbix_agentd -t system.swap.in[mapper/VolGroup00-LogVol01,count]
        system.swap.in[mapper/VolGroup00-LogVol01,count] [u|112427]
        Last edited by Takanori Suzuki; 28-08-2009, 08:21.

        Comment

        Working...