<commit_before>package web

import (
	"github.com/zenoss/serviced/domain"

	"fmt"
)

//profile defines meta-data for the host/pool resource's metrics and graphs
var (
	zero       int = 0
	onehundred int = 100

	profile = domain.MonitorProfile{
		MetricConfigs: []domain.MetricConfig{
			//CPU
			domain.MetricConfig{
				ID:          "cpu",
				Name:        "CPU Usage",
				Description: "CPU Statistics",
				Metrics: []domain.Metric{
					domain.Metric{ID: "cpu.system", Name: "CPU System"},
					domain.Metric{ID: "cpu.user", Name: "CPU User"},
					domain.Metric{ID: "cpu.idle", Name: "CPU Idle"},
					domain.Metric{ID: "cpu.iowait", Name: "CPU IO Wait"},
					domain.Metric{ID: "cpu.nice", Name: "CPU Nice"},
				},
			},
			//Memory
			domain.MetricConfig{
				ID:          "memory",
				Name:        "Memory Usage",
				Description: "Memory Usage Statistics -- /proc/meminfo",
				Metrics: []domain.Metric{
					domain.Metric{ID: "memory.buffers", Name: "Memory Buffer"},
					domain.Metric{ID: "memory.cached", Name: "Memory Cache"},
					domain.Metric{ID: "memory.free", Name: "Memory Free"},
					domain.Metric{ID: "memory.total", Name: "Total Memory"},
					domain.Metric{ID: "memory.used", Name: "Used Memory"},
					domain.Metric{ID: "swap.total", Name: "Total Swap"},
					domain.Metric{ID: "swap.free", Name: "Free Swap"},
				},
			},
			//Virtual Memory
			domain.MetricConfig{
				ID:          "virtual.memory",
				Name:        "Virtual Memory Usage",
				Description: "Virtual Memory Usage Statistics -- /proc/vmstat",
				Metrics: []domain.Metric{
					domain.Metric{ID: "vmstat.pgfault", Name: "Minor Page Fault"},
					domain.Metric{ID: "vmstat.pgmajfault", Name: "Major Page Fault"},
				},
			},
			//Files
			domain.MetricConfig{
				ID:          "files",
				Name:        "File Usage",
				Description: "File Statistics",
				Metrics: []domain.Metric{
					domain.Metric{ID: "Serviced.OpenFileDescriptors", Name: "OpenFileDescriptors"},
				},
			},
		},
	}
)

//Open File Descriptors
func newOpenFileDescriptorsGraph(tags map[string][]string) domain.GraphConfig {
	return domain.GraphConfig{
		DataPoints: []domain.DataPoint{
			domain.DataPoint{
				ID:         "ofd",
				Aggregator: "avg",
				Color:      "#aec7e8",
				Fill:       false,
				Format:     "%6.2f",
				Legend:     "Serviced Open File Descriptors",
				Metric:     "Serviced.OpenFileDescriptors",
				Name:       "Serviced Open File Descriptors",
				Rate:       false,
				Type:       "line",
			},
		},
		ID:     "serviced.ofd",
		Name:   "Serviced Open File Descriptors",
		Footer: false,
		Format: "%d",
		MinY:   &zero,
		Range: &domain.GraphConfigRange{
			End:   "0s-ago",
			Start: "1h-ago",
		},
		ReturnSet:   "EXACT",
		Type:        "line",
		DownSample:  "1m-avg",
		Tags:        tags,
		Description: "Graph of serviced's total open file descriptors over time",
	}
}

//Major Page Faults<commit_msg>Set Open File Descriptors Graph Metric Source<commit_after>package web

import (
	"github.com/zenoss/serviced/domain"

	"fmt"
)

//profile defines meta-data for the host/pool resource's metrics and graphs
var (
	zero       int = 0
	onehundred int = 100

	profile = domain.MonitorProfile{
		MetricConfigs: []domain.MetricConfig{
			//CPU
			domain.MetricConfig{
				ID:          "cpu",
				Name:        "CPU Usage",
				Description: "CPU Statistics",
				Metrics: []domain.Metric{
					domain.Metric{ID: "cpu.system", Name: "CPU System"},
					domain.Metric{ID: "cpu.user", Name: "CPU User"},
					domain.Metric{ID: "cpu.idle", Name: "CPU Idle"},
					domain.Metric{ID: "cpu.iowait", Name: "CPU IO Wait"},
					domain.Metric{ID: "cpu.nice", Name: "CPU Nice"},
				},
			},
			//Memory
			domain.MetricConfig{
				ID:          "memory",
				Name:        "Memory Usage",
				Description: "Memory Usage Statistics -- /proc/meminfo",
				Metrics: []domain.Metric{
					domain.Metric{ID: "memory.buffers", Name: "Memory Buffer"},
					domain.Metric{ID: "memory.cached", Name: "Memory Cache"},
					domain.Metric{ID: "memory.free", Name: "Memory Free"},
					domain.Metric{ID: "memory.total", Name: "Total Memory"},
					domain.Metric{ID: "memory.used", Name: "Used Memory"},
					domain.Metric{ID: "swap.total", Name: "Total Swap"},
					domain.Metric{ID: "swap.free", Name: "Free Swap"},
				},
			},
			//Virtual Memory
			domain.MetricConfig{
				ID:          "virtual.memory",
				Name:        "Virtual Memory Usage",
				Description: "Virtual Memory Usage Statistics -- /proc/vmstat",
				Metrics: []domain.Metric{
					domain.Metric{ID: "vmstat.pgfault", Name: "Minor Page Fault"},
					domain.Metric{ID: "vmstat.pgmajfault", Name: "Major Page Fault"},
				},
			},
			//Files
			domain.MetricConfig{
				ID:          "files",
				Name:        "File Usage",
				Description: "File Statistics",
				Metrics: []domain.Metric{
					domain.Metric{ID: "Serviced.OpenFileDescriptors", Name: "OpenFileDescriptors"},
				},
			},
		},
	}
)

//Open File Descriptors
func newOpenFileDescriptorsGraph(tags map[string][]string) domain.GraphConfig {
	return domain.GraphConfig{
		DataPoints: []domain.DataPoint{
			domain.DataPoint{
				ID:           "ofd",
				Aggregator:   "avg",
				Color:        "#aec7e8",
				Fill:         false,
				Format:       "%6.2f",
				Legend:       "Serviced Open File Descriptors",
				Metric:       "Serviced.OpenFileDescriptors",
				MetricSource: "files",
				Name:         "Serviced Open File Descriptors",
				Rate:         false,
				Type:         "line",
			},
		},
		ID:     "serviced.ofd",
		Name:   "Serviced Open File Descriptors",
		Footer: false,
		Format: "%d",
		MinY:   &zero,
		Range: &domain.GraphConfigRange{
			End:   "0s-ago",
			Start: "1h-ago",
		},
		ReturnSet:   "EXACT",
		Type:        "line",
		DownSample:  "1m-avg",
		Tags:        tags,
		Description: "Graph of serviced's total open file descriptors over time",
	}
}

//Major Page Faults
{'fraction_non_alphanumeric': 0.15126335424792267, 'fraction_numerical': 0.0037307105307783617, 'mean_word_length': 2.725837018319646, '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': '56495', 'n_tokens_mistral': 2347, 'n_tokens_neox': 1934, 'n_words': 479}