Path: blob/main/pkg/integrations/windows_exporter/config.go
5365 views
package windows_exporter //nolint:golint12import (3"github.com/go-kit/log"4"github.com/grafana/agent/pkg/integrations"5integrations_v2 "github.com/grafana/agent/pkg/integrations/v2"6"github.com/grafana/agent/pkg/integrations/v2/metricsutils"7)89// DefaultConfig holds the default settings for the windows_exporter integration.10var DefaultConfig = Config{11// NOTE(rfratto): there is an init function in config_windows.go that12// populates defaults for collectors based on the exporter defaults.13EnabledCollectors: "cpu,cs,logical_disk,net,os,service,system",1415Dfsr: DfsrConfig{16SourcesEnabled: "",17},18Exchange: ExchangeConfig{19EnabledList: "",20},21IIS: IISConfig{22AppBlackList: "",23AppWhiteList: "",24SiteBlackList: "",25SiteWhiteList: "",26AppInclude: "",27AppExclude: "",28SiteInclude: "",29SiteExclude: "",30},31LogicalDisk: LogicalDiskConfig{32BlackList: "",33WhiteList: "",34Include: "",35Exclude: "",36},37MSMQ: MSMQConfig{38Where: "",39},40MSSQL: MSSQLConfig{41EnabledClasses: "",42},43Network: NetworkConfig{44BlackList: "",45WhiteList: "",46Include: "",47Exclude: "",48},49Process: ProcessConfig{50BlackList: "",51WhiteList: "",52Include: "",53Exclude: "",54},55ScheduledTask: ScheduledTaskConfig{56Include: "",57Exclude: "",58},59Service: ServiceConfig{60UseApi: "",61Where: "",62},63SMTP: SMTPConfig{64BlackList: "",65WhiteList: "",66Include: "",67Exclude: "",68},69TextFile: TextFileConfig{70TextFileDirectory: "",71},72}7374func init() {75integrations.RegisterIntegration(&Config{})76integrations_v2.RegisterLegacy(&Config{}, integrations_v2.TypeSingleton, metricsutils.NewNamedShim("windows"))77}7879// Config controls the windows_exporter integration.80// All of these and their child fields are pointers, so we can determine if the value was set or not.81type Config struct {82EnabledCollectors string `yaml:"enabled_collectors"`8384Dfsr DfsrConfig `yaml:"dfsr,omitempty"`85Exchange ExchangeConfig `yaml:"exchange,omitempty"`86IIS IISConfig `yaml:"iis,omitempty"`87TextFile TextFileConfig `yaml:"text_file,omitempty"`88SMTP SMTPConfig `yaml:"smtp,omitempty"`89Service ServiceConfig `yaml:"service,omitempty"`90Process ProcessConfig `yaml:"process,omitempty"`91Network NetworkConfig `yaml:"network,omitempty"`92MSSQL MSSQLConfig `yaml:"mssql,omitempty"`93MSMQ MSMQConfig `yaml:"msmq,omitempty"`94LogicalDisk LogicalDiskConfig `yaml:"logical_disk,omitempty"`95ScheduledTask ScheduledTaskConfig `yaml:"scheduled_task,omitempty"`96}9798// UnmarshalYAML implements yaml.Unmarshaler for Config.99func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {100*c = DefaultConfig101102type plain Config103return unmarshal((*plain)(c))104}105106// Name returns the name used, "windows_explorer"107func (c *Config) Name() string {108return "windows_exporter"109}110111// InstanceKey returns the hostname:port of the agent.112func (c *Config) InstanceKey(agentKey string) (string, error) {113return agentKey, nil114}115116// NewIntegration creates an integration based on the given configuration117func (c *Config) NewIntegration(l log.Logger) (integrations.Integration, error) {118return New(l, c)119}120121// DfsrConfig handles settings for the windows_exporter dfsr collector122type DfsrConfig struct {123SourcesEnabled string `yaml:"sources_enabled,omitempty"`124}125126// ExchangeConfig handles settings for the windows_exporter Exchange collector127type ExchangeConfig struct {128EnabledList string `yaml:"enabled_list,omitempty"`129}130131// IISConfig handles settings for the windows_exporter IIS collector132type IISConfig struct {133SiteWhiteList string `yaml:"site_whitelist,omitempty"`134SiteBlackList string `yaml:"site_blacklist,omitempty"`135AppWhiteList string `yaml:"app_whitelist,omitempty"`136AppBlackList string `yaml:"app_blacklist,omitempty"`137SiteInclude string `yaml:"site_include,omitempty"`138SiteExclude string `yaml:"site_exclude,omitempty"`139AppInclude string `yaml:"app_include,omitempty"`140AppExclude string `yaml:"app_exclude,omitempty"`141}142143// TextFileConfig handles settings for the windows_exporter Text File collector144type TextFileConfig struct {145TextFileDirectory string `yaml:"text_file_directory,omitempty"`146}147148// SMTPConfig handles settings for the windows_exporter SMTP collector149type SMTPConfig struct {150BlackList string `yaml:"blacklist,omitempty"`151WhiteList string `yaml:"whitelist,omitempty"`152Include string `yaml:"include,omitempty"`153Exclude string `yaml:"exclude,omitempty"`154}155156// ServiceConfig handles settings for the windows_exporter service collector157type ServiceConfig struct {158UseApi string `yaml:"use_api,omitempty"`159Where string `yaml:"where_clause,omitempty"`160}161162// ProcessConfig handles settings for the windows_exporter process collector163type ProcessConfig struct {164BlackList string `yaml:"blacklist,omitempty"`165WhiteList string `yaml:"whitelist,omitempty"`166Include string `yaml:"include,omitempty"`167Exclude string `yaml:"exclude,omitempty"`168}169170// NetworkConfig handles settings for the windows_exporter network collector171type NetworkConfig struct {172BlackList string `yaml:"blacklist,omitempty"`173WhiteList string `yaml:"whitelist,omitempty"`174Include string `yaml:"include,omitempty"`175Exclude string `yaml:"exclude,omitempty"`176}177178// MSSQLConfig handles settings for the windows_exporter SQL server collector179type MSSQLConfig struct {180EnabledClasses string `yaml:"enabled_classes,omitempty"`181}182183// MSMQConfig handles settings for the windows_exporter MSMQ collector184type MSMQConfig struct {185Where string `yaml:"where_clause,omitempty"`186}187188// LogicalDiskConfig handles settings for the windows_exporter logical disk collector189type LogicalDiskConfig struct {190BlackList string `yaml:"blacklist,omitempty"`191WhiteList string `yaml:"whitelist,omitempty"`192Include string `yaml:"include,omitempty"`193Exclude string `yaml:"exclude,omitempty"`194}195196// ScheduledTaskConfig handles settings for the windows_exporter scheduled_task collector197type ScheduledTaskConfig struct {198Include string `yaml:"include,omitempty"`199Exclude string `yaml:"exclude,omitempty"`200}201202203