Ad Widget

Collapse

Connections one-liner

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • frater
    Senior Member
    • Oct 2010
    • 340

    #1

    Connections one-liner

    Code:
    UserParameter=net.connections, conntrack -C 2>/dev/null || sudo grep -c . /proc/net/ip_conntrack
    interval = 30 or 60 seconds
    applications = network, performance
    Code:
    echo "zabbix ALL =(ALL) NOPASSWD: `which grep`" >>/etc/sudoers
    If conntrack-tools is installed it will return the value of conntrack -C, if it isn't it will count the lines in /proc/net/ip_conntrack with grep.

    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.
    Last edited by frater; 05-02-2011, 15:21.
    Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP
Working...