Code:
UserParameter=net.connections, conntrack -C 2>/dev/null || sudo grep -c . /proc/net/ip_conntrack
applications = network, performance
Code:
echo "zabbix ALL =(ALL) NOPASSWD: `which grep`" >>/etc/sudoers
If you have more than 5000 connections you should really install conntrack-tools (apt-get install conntrack) as it's much faster.
Previously I did this with my generic function regcount, but it's worthwhile to make a special function for it.