Monitoring current RX and TX network interface buffers in Zabbix

One day after restarting the Ubuntu server, due to the long start of a large number of network interfaces, my script which increased the values of the buffers and also performed other settings was performed ahead of time, respectively, the changes did not apply and I found out about this problem only after 24 hours, so I decided monitor current RX and TX buffers.

Suppose if you run the command:

ethtool -g ens2f1

We’ll see:

Ring parameters for ens2f1:
Pre-set maximums:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096
Current hardware settings:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096

It turns out we need 8 and 11 lines, and also need to delete unnecessary characters to get only numbers, after thinking a few minutes, I came up with this:

ethtool -g ens2f1 | awk '(NR == 8)' | sed -r 's/^.{5}//'
ethtool -g ens2f1 | awk '(NR == 11)' | sed -r 's/^.{5}//'

The first command displays the current RX buffer value, and the second TX.
Accordingly, in the Zabbix agent configuration I indicated them as follows:

UserParameter=current_ens2f1_rx_buffer,ethtool -g ens2f1 | awk '(NR == 8)' | sed -r 's/^.{5}//'
UserParameter=current_ens2f1_tx_buffer,ethtool -g ens2f1 | awk '(NR == 11)' | sed -r 's/^.{5}//'

On my Zabbix server, in my template, I added Zabbix data elements with the keys current_ens2f1_rx_buffer and current_ens2f1_tx_buffer, and also created triggers, for example, with the expression:

{MyTemplate:current_ens1f0_tx_buffer.last(0)}<>4096

Accordingly, the trigger will work when the value is not equal to 4096.

Let me give you another example:

ethtool -l ens2d1
Channel parameters for ens2d1:
Pre-set maximums:
RX:             28
TX:             28
Other:          0
Combined:       0
Current hardware settings:
RX:             16
TX:             28
Other:          0
Combined:       0

ethtool -l ens2d1 | awk '(NR == 8)' | sed -r 's/^.{5}//'
16
ethtool -l ens2d1 | awk '(NR == 9)' | sed -r 's/^.{5}//'
28

See also my article:
Changing TX and RX network interface buffers in Linux

Join the Conversation

1 Comment

Leave a Reply