diff --git a/README.rst b/README.rst index 20fae2a6..485d71e6 100644 --- a/README.rst +++ b/README.rst @@ -124,6 +124,11 @@ Several methods have been added which are not present in psutil, but will provid - system wide stats on network protocols (i.e IP, TCP, UDP, etc.) - sourced from /proc/net/snmp +- iptables nf_conntrack (linux only) + + - system wide stats on netfilter conntrack module + - sourced from /proc/sys/net/netfilter/nf_conntrack_count + Some codes are ported from Ohai. many thanks. @@ -153,6 +158,7 @@ net_connections x x net_protocols x net_if_addrs net_if_stats +netfilter_conntrack x ================= ====== ======= ====== ======= Process class diff --git a/net/net.go b/net/net.go index feb5c388..addb4481 100644 --- a/net/net.go +++ b/net/net.go @@ -65,8 +65,8 @@ type NetInterfaceStat struct { } type NetFilterStat struct { - ConnTrackCount int64 `json:"conntrackcount"` - ConnTrackMax int64 `json:"conntrackmax"` + ConnTrackCount int64 `json:"conn_track_count"` + ConnTrackMax int64 `json:"conn_track_max"` } var constMap = map[string]int{ diff --git a/net/net_linux.go b/net/net_linux.go index 058720a0..9e2d7403 100644 --- a/net/net_linux.go +++ b/net/net_linux.go @@ -165,8 +165,8 @@ func NetProtoCounters(protocols []string) ([]NetProtoCountersStat, error) { // the currently in use conntrack count and the max. // If the file does not exist or is invalid it will return nil. func NetFilterCounters() ([]NetFilterStat, error) { - countfile := "/proc/sys/net/netfilter/nf_conntrack_count" - maxfile := "/proc/sys/net/netfilter/nf_conntrack_max" + countfile := common.HostProc("sys/net/netfilter/nf_conntrack_count") + maxfile := common.HostProc("sys/net/netfilter/nf_conntrack_max") count, err := common.ReadInts(countfile)