Warning: Undefined variable $allowed_html in /home/public/wp-content/themes/uncover/inc/template-functions.php on line 118

Track Packets per Second In Zabbix

Since this metric was not available on all my monitored devices, I had to create a solution.

First, create this script and put it where it goes, chmod as needed:

#network interface (eth0/wlan0)
#in or out (rx/tx)
DAT1=cat /sys/class/net/$ifname/statistics/${rxtx}_packets
sleep 1
DAT2=cat /sys/class/net/$ifname/statistics/${rxtx}_packets
DATDIFF=expr $DAT2 - $DAT1
echo "$DATDIFF"

Now add the UserParameter in the config file:

UserParameter=network.ifinfo[*],/etc/zabbix/scripts/pps.sh $1 $2

Now you can create an item, using keys such as:

network.ifinfo[wlan0, rx]
network.ifinfo[wlan0, tx]