<commit_before>package monitoring

import (
	"encoding/json"
	"fmt"
)

type Plugin struct {
	Name    string         `json:"name"`
	Enable  bool           `json:"enable"`
	Configs []PluginConfig `json:"configs"`
}

type PluginConfig struct {
	Category string `json:"category"`
	Type     string `json:"type"`
	Value    string `json:"value"`
}

const (
	USAGE_PERCENTAGE            = "percent-used"
	CLUSTER_UTILIZATION         = "cluster_utilization"
	SLU_UTILIZATION             = "slu_utilization"
	BLOCK_DEVICE_UTILIZATION    = "block_device_utilization"
	STORAGE_UTILIZATION         = "storage_utilization"
	FREE_SPACE                  = "free_bytes"
	USED_SPACE                  = "used_bytes"
	TOTAL_SPACE                 = "total_bytes"
	PERCENT_USED                = "percent_bytes"
	STORAGE_PROFILE_UTILIZATION = "storage_profile_utilization"
	USAGE_PERCENT               = "usage_percent"
	DISK                        = "disk"
	DISK_IOPS                   = "disk_iops"
	READ                        = "read"
	WRITE                       = "write"
	SLU                         = "slu"
	SYSTEM                      = "system"
	STORAGE_PROFILE             = "storage_profile"
	NODE                        = "node"
	NO_OF_OBJECT                = "no_of_object"
	PG_SUMMARY                  = "pg_summary"
	Latest                      = "latest"
	MEMORY                      = "memory"
	SWAP                        = "swap"
	CPU_USER                    = "cpu-user"
	USED                        = "used"
	TOTAL                       = "total"
	FREE                        = "free"
	NETWORK_LATENCY             = "network_latency"
	INTERFACE                   = "interface"
	AGGREGATION                 = "aggregation_"
	OCTETS                      = "octets"
	RX                          = "rx"
	TX                          = "tx"
	LOOP_BACK_INTERFACE         = "interface-lo"
	CRITICAL                    = "critical"
	WARN                        = "warn"
	WARNING                     = "warning"
	OK                          = "ok"
	THRESHOLD                   = "threshold"
	CPU                         = "cpu"
	SUM                         = "sum"
)

var (
	SupportedConfigCategories = []string{
		THRESHOLD,
		"interval",
		"miscellaneous",
	}

	SupportedThresholdTypes = []string{
		CRITICAL,
		WARNING,
	}

	SupportedMonitoringPlugins = []string{
		"df",
		MEMORY,
		"cpu",
		"disk",
		"network",
		SWAP,
	}

	MonitoringWritePlugin = "dbpush"
)

func Contains(key string, keys []string) bool {
	for _, permittedKey := range keys {
		if permittedKey == key {
			return true<commit_msg>monitoring : Add network constant<commit_after>package monitoring

import (
	"encoding/json"
	"fmt"
)

type Plugin struct {
	Name    string         `json:"name"`
	Enable  bool           `json:"enable"`
	Configs []PluginConfig `json:"configs"`
}

type PluginConfig struct {
	Category string `json:"category"`
	Type     string `json:"type"`
	Value    string `json:"value"`
}

const (
	USAGE_PERCENTAGE            = "percent-used"
	CLUSTER_UTILIZATION         = "cluster_utilization"
	SLU_UTILIZATION             = "slu_utilization"
	BLOCK_DEVICE_UTILIZATION    = "block_device_utilization"
	STORAGE_UTILIZATION         = "storage_utilization"
	FREE_SPACE                  = "free_bytes"
	USED_SPACE                  = "used_bytes"
	TOTAL_SPACE                 = "total_bytes"
	PERCENT_USED                = "percent_bytes"
	STORAGE_PROFILE_UTILIZATION = "storage_profile_utilization"
	USAGE_PERCENT               = "usage_percent"
	DISK                        = "disk"
	DISK_IOPS                   = "disk_iops"
	READ                        = "read"
	WRITE                       = "write"
	SLU                         = "slu"
	SYSTEM                      = "system"
	STORAGE_PROFILE             = "storage_profile"
	NODE                        = "node"
	NO_OF_OBJECT                = "no_of_object"
	PG_SUMMARY                  = "pg_summary"
	Latest                      = "latest"
	MEMORY                      = "memory"
	SWAP                        = "swap"
	CPU_USER                    = "cpu-user"
	USED                        = "used"
	TOTAL                       = "total"
	FREE                        = "free"
	NETWORK_LATENCY             = "network_latency"
	INTERFACE                   = "interface"
	AGGREGATION                 = "aggregation_"
	OCTETS                      = "octets"
	RX                          = "rx"
	TX                          = "tx"
	LOOP_BACK_INTERFACE         = "interface-lo"
	CRITICAL                    = "critical"
	WARN                        = "warn"
	WARNING                     = "warning"
	OK                          = "ok"
	THRESHOLD                   = "threshold"
	CPU                         = "cpu"
	SUM                         = "sum"
	NETWORK                     = "network"
)

var (
	SupportedConfigCategories = []string{
		THRESHOLD,
		"interval",
		"miscellaneous",
	}

	SupportedThresholdTypes = []string{
		CRITICAL,
		WARNING,
	}

	SupportedMonitoringPlugins = []string{
		"df",
		MEMORY,
		"cpu",
		"disk",
		"network",
		SWAP,
	}

	MonitoringWritePlugin = "dbpush"
)

func Contains(key string, keys []string) bool {
	for _, permittedKey := range keys {
		if permittedKey == key {
			return true
{'fraction_non_alphanumeric': 0.08957499523537259, 'fraction_numerical': 0.0, 'mean_word_length': 1.3778885364748528, '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': '4079080', 'n_tokens_mistral': 1656, 'n_tokens_neox': 1542, 'n_words': 302}