<commit_before>package collectors

import (
	"os"
	"strconv"
	"strings"

	"github.com/oliveagle/go-collectors/datapoint"
	"github.com/oliveagle/go-collectors/metadata"
	"github.com/oliveagle/go-collectors/util"
)

func init() {
	collectors = append(collectors, &IntervalCollector{F: c_conntrack_linux, Enable: conntrackEnable})
}

const (
	conntrackCount = "/proc/sys/net/netfilter/nf_conntrack_count"
	conntrackMax   = "/proc/sys/net/netfilter/nf_conntrack_max"
)

func conntrackEnable() bool {
	f, err := os.Open(conntrackCount)
	defer f.Close()
	return err == nil
}

func c_conntrack_linux() (datapoint.MultiDataPoint, error) {
	var md datapoint.MultiDataPoint
	var max, count float64
	if err := readLine(conntrackCount, func(s string) error {
		values := strings.Fields(s)<commit_msg>fix import but not used el6<commit_after>package collectors

import (
	"os"
	"strconv"
	"strings"

	"github.com/oliveagle/go-collectors/datapoint"
	"github.com/oliveagle/go-collectors/metadata"
	// "github.com/oliveagle/go-collectors/util"
)

func init() {
	collectors = append(collectors, &IntervalCollector{F: c_conntrack_linux, Enable: conntrackEnable})
}

const (
	conntrackCount = "/proc/sys/net/netfilter/nf_conntrack_count"
	conntrackMax   = "/proc/sys/net/netfilter/nf_conntrack_max"
)

func conntrackEnable() bool {
	f, err := os.Open(conntrackCount)
	defer f.Close()
	return err == nil
}

func c_conntrack_linux() (datapoint.MultiDataPoint, error) {
	var md datapoint.MultiDataPoint
	var max, count float64
	if err := readLine(conntrackCount, func(s string) error {
		values := strings.Fields(s)
{'fraction_non_alphanumeric': 0.12680477087256747, 'fraction_numerical': 0.003138731952291274, 'mean_word_length': 5.250980392156863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5422968', 'n_tokens_mistral': 590, 'n_tokens_neox': 580, 'n_words': 108}