Monitoring PPS (Packets Per Second) in Zabbix

I will give an example of monitoring PPS (Packets Per Second) on network interfaces in Linux.
In order to calculate the number of transmitted packets per second on the network interface, create two simple scripts, the first to calculate the transmitted packets:

TX1=`cat /sys/class/net/ens2f1/statistics/tx_packets`
sleep 1
TX2=`cat /sys/class/net/ens2f1/statistics/tx_packets`
TXPPS=`expr $TX2 - $TX1`
echo "$TXPPS"

And the second script for counting received packets per second:

RX1=`cat /sys/class/net/ens2f1/statistics/rx_packets`
sleep 1
RX2=`cat /sys/class/net/ens2f1/statistics/rx_packets`
RXPPS=`expr $RX2 - $RX1`
echo "$RXPPS"

Scripts can be placed in a directory with a zabbix agent, and in the configuration file /etc/zabbix/zabbix_agentd.conf we add:


Restart the zabbix agent to apply the changes:

sudo service zabbix-agent restart
sudo /etc/init.d/zabbix-agent restart

Done, now you can add data elements with the names tx_pps_ens2f1 and rx_pps_ens2f1 in the template or host on the zabbix server, “Element type:” Zabbix agent, “Value storage:” As is.
For them we will create graphs and triggers to receive notifications about large values.

Such simple scripts can be executed on other operating systems and some firmware of various devices, and the result can be output, for example, in http or pick up via ssh, etc.

See also my articles:
Examples of Items for Zabbix
PPS Viewer Script (Packets Per Second)

Leave a comment

Leave a Reply