Skip to content

Keeping track of your Bonding Interfaces

Bonding InterfacesMost Linux distributions (RHEL, CentOS, Debian etc.) offer the ability to bond multiple networks devices together into Bonding Interfaces, using the bonding kernel module.

Bonding enables two or more network interfaces to act as one, which as a result can provide redundancy and additional bandwidth.

The Linux bonding kernel module keeps track of the status of your bonding interfaces at all times. The status information for each interface is written to files in this directory: /proc/net/bonding/

We use the Zabbix Agent to parse and present status information of bonding interfaces to Zabbix, while also keeping an eye on important health indicators!


  • O/S: CentOS, RHEL, Debian or Ubuntu (other distributions might work as well)
  • Zabbix Agent 1.8 and above
  • Zabbix Server 3.0

Zabbix Server 3.0 is required since the template utilizes Application Prototypes.

How it works

The item keys “bond.discovery” and “bond.slave.discovery” traverse your installed bonding interfaces as well as the slave interfaces attached to them. Through Low-level Discovery, several items are then created automatically for all bonding and slave interfaces, which are regularly pulled for data.

Item keys created for each bonding and slave interface:

  • Bond: ARP IP Target
  • Bond: ARP Polling Interval
  • Bond: Bonding Mode
  • Bond: Currently Active Slave
  • Bond: MII Polling Interval
  • Bond: MII Status
  • Bond: Primary Slave
  • Bond Slave: Link Failure Count
  • Bond Slave: MII Status
  • Bond Slave: Speed

The following triggers are created for each bonding and slave interface:

  • Bond: MII Status
  • Bond: Currently Active Slave
  • Bond Slave: MII Status
  • Bond Slave: Link Failure Count

Instructions – Keeping track of your Bonding Interfaces

NOTE: Make sure you have already installed the Zabbix Agent!

  1. Add the file “userparameter_bond.conf” to your Zabbix Agent include directory. See below for file contents. Example: /etc/zabbix/zabbix_agentd.d/userparameter_bond.conf
    1. Be aware, the config “include” directory varies between distributions.
      RHEL/CentOS: /etc/zabbix/zabbix_agentd.d/
      Debian/Ubuntu: /etc/zabbix/zabbix_agentd.conf.d/
  2. Restart the Zabbix Agent service.
  3. Import the template below and add it to your host(s).
  4. Wait for bonding and slave interface discovery.
    Note: The template default discovery interval is 6 hours. You can edit that to your liking.

Download template: Template App Linux Bonding

File: userparameter_bond.conf

UserParameter=bond.check[*],grep '$2' /proc/net/bonding/$1 -A6 | grep '$3' -m 1 | sed -n -e 's/^.*: //p'
UserParameter=bond.discovery,bond_list=$(ls /proc/net/bonding/);echo -n '{"data":[';for b in ${bond_list}; do echo -n "{\"{#BOND_IF}\": \"$b\"},";done |sed -e 's:\},$:\}:';echo -n ']}';
UserParameter=bond.slave.discovery,bond_list=$(ls /proc/net/bonding/);echo -n '{"data":[';for b in $bond_list;do if_list=$(grep 'Slave Interface' /proc/net/bonding/${b} | sed -n -e 's/^.*: //p');for i in $if_list;do echo -n "{\"{#BOND_IF}\": \"$b\", ";echo -n "\"{#SLAVE_IF}\": \"$i\"},";done;done|sed -e 's:\},$:\}:';echo -n ']}';


  1. Foulis Foulis


    I’m struggling with your bond.slave.discovery item , the value is coming back as invalid JSON. It looks to be an issue with the bracket and comma placements after each value, but I’m not a great coder, so not really understanding how to resolve it yet. Would you be able to revise the item? The bond.discovery item works great.


    • Just manually ran the “bond.slave.discovery” script on a CentOS 6 host configured with bonding and valid JSON was returned.

      Please try copy-pasting and executing the below snippet and then reply with the output you receive.

      bond_list=$(ls /proc/net/bonding/);echo -n '{"data":[';for b in ${bond_list};do if_list=$(grep 'Slave Interface' /proc/net/bonding/${b} | sed -n -e 's/^.*: //p');for i in ${if_list};do echo -n "{\"{#BOND_IF}\": \"$b\", ";echo -n "\"{#SLAVE_IF}\": \"$i\"},";done |sed -e 's:\},$:\}:';echo -n ']}';done
      • Foulis Foulis

        Thanks for replying

        I’m runnning this on el5 and el6 and get the same output, example below

        {“data”:[{“{#BOND_IF}”: “bond0”, “{#SLAVE_IF}”: “eth8”},{“{#BOND_IF}”: “bond0”, “{#SLAVE_IF}”: “eth12”}]}{“{#BOND_IF}”: “bond1”, “{#SLAVE_IF}”: “eth0”},{“{#BOND_IF}”: “bond1”, “{#SLAVE_IF}”: “eth2”}]}{“{#BOND_IF}”: “bond2”, “{#SLAVE_IF}”: “eth10”},{“{#BOND_IF}”: “bond2”, “{#SLAVE_IF}”: “eth11”}]}{“{#BOND_IF}”: “bond3”, “{#SLAVE_IF}”: “eth14”},{“{#BOND_IF}”: “bond3”, “{#SLAVE_IF}”: “eth15”}]}

        • I had a bug in the “bond.slave.discovery” discovery item.

          I’ve updated the post with the fixed script.

          Thank you for bringing it to my attention!

          • Foulis Foulis

            Works perfectly now, thanks

  2. sandeep sandeep

    can u please explain this:
    UserParameter=bond.check[*],grep ‘$2’ /proc/net/bonding/$1 -A6 | grep ‘$3’ -m 1 | sed -n -e ‘s/^.*: //p’

    what was the value for $1 , $2 and $3

    • Sandeep:

      $1, $2 and $3 are command parameters.

      $1 = Bond Interface Name
      $2 = Slave Interface Name
      $3 = Type of value to extract

      Example Item:
      bond.check[bond0,eth1,”Link Failure Count”]

      • sandeep sandeep

        Hi Martinmoerch…Thanks….that was really helpful for me.

      • Cyril Cyril

        $2 is missing in the keys of template
        bond.check[{#BOND_IF},,”MII Status”]
        bond.check[{#BOND_IF},,”Currently Active Slave”]

        should it be corrected to:
        bond.check[{#BOND_IF},{#SLAVE_IF},”MII Status”]
        bond.check[{#BOND_IF},{#SLAVE_IF},”Currently Active Slave”]

        • There are two discovery rules, bond.discovery and bond.slave.discovery

          bond.discovery item prototypes do not need the 2nd parameter. That is on purpose.

  3. sandeep sandeep

    Hi Martinmoerch in my case i have to bond i.e bond0 and bond1. I just want to monitor the status of both the bond’s, means bond0 and bond1 is active or not.
    plz help is there is any change in template and userparameter file

    • The updated userparameter_bond.conf file at the end of the blog post should autodiscover your interfaces. You can then disable discovery “Bond Slave Interfaces” if you only want Bond interface monitoring.

  4. sandeep sandeep

    my userparameter_bond.conf file is same is mentioned above, but when i down the bond0 or bond1 it not reflecting in zabbix server, but when i used zabbix_get command in zabbix server then it work properly. Plz help where is make mistake

    • The template doesn’t monitor bond interface status, since it is assumed a bond interface is always marked as “Up”.

      Try bringing the bond IF down and taking a look at the file /proc/net/bonding/bondX to see if there’s anything in the file that shows the bond IF as down. I do not currently have access to a system where I can test it.

      You can then create an additional prototype item that returns the data you want from the /proc file and create triggers if you wish.

  5. Paul Paul

    Worked well for me once I got some custom regex setup

    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.