Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/integrations/windows_exporter/config.go
5365 views
1
package windows_exporter //nolint:golint
2
3
import (
4
"github.com/go-kit/log"
5
"github.com/grafana/agent/pkg/integrations"
6
integrations_v2 "github.com/grafana/agent/pkg/integrations/v2"
7
"github.com/grafana/agent/pkg/integrations/v2/metricsutils"
8
)
9
10
// DefaultConfig holds the default settings for the windows_exporter integration.
11
var DefaultConfig = Config{
12
// NOTE(rfratto): there is an init function in config_windows.go that
13
// populates defaults for collectors based on the exporter defaults.
14
EnabledCollectors: "cpu,cs,logical_disk,net,os,service,system",
15
16
Dfsr: DfsrConfig{
17
SourcesEnabled: "",
18
},
19
Exchange: ExchangeConfig{
20
EnabledList: "",
21
},
22
IIS: IISConfig{
23
AppBlackList: "",
24
AppWhiteList: "",
25
SiteBlackList: "",
26
SiteWhiteList: "",
27
AppInclude: "",
28
AppExclude: "",
29
SiteInclude: "",
30
SiteExclude: "",
31
},
32
LogicalDisk: LogicalDiskConfig{
33
BlackList: "",
34
WhiteList: "",
35
Include: "",
36
Exclude: "",
37
},
38
MSMQ: MSMQConfig{
39
Where: "",
40
},
41
MSSQL: MSSQLConfig{
42
EnabledClasses: "",
43
},
44
Network: NetworkConfig{
45
BlackList: "",
46
WhiteList: "",
47
Include: "",
48
Exclude: "",
49
},
50
Process: ProcessConfig{
51
BlackList: "",
52
WhiteList: "",
53
Include: "",
54
Exclude: "",
55
},
56
ScheduledTask: ScheduledTaskConfig{
57
Include: "",
58
Exclude: "",
59
},
60
Service: ServiceConfig{
61
UseApi: "",
62
Where: "",
63
},
64
SMTP: SMTPConfig{
65
BlackList: "",
66
WhiteList: "",
67
Include: "",
68
Exclude: "",
69
},
70
TextFile: TextFileConfig{
71
TextFileDirectory: "",
72
},
73
}
74
75
func init() {
76
integrations.RegisterIntegration(&Config{})
77
integrations_v2.RegisterLegacy(&Config{}, integrations_v2.TypeSingleton, metricsutils.NewNamedShim("windows"))
78
}
79
80
// Config controls the windows_exporter integration.
81
// All of these and their child fields are pointers, so we can determine if the value was set or not.
82
type Config struct {
83
EnabledCollectors string `yaml:"enabled_collectors"`
84
85
Dfsr DfsrConfig `yaml:"dfsr,omitempty"`
86
Exchange ExchangeConfig `yaml:"exchange,omitempty"`
87
IIS IISConfig `yaml:"iis,omitempty"`
88
TextFile TextFileConfig `yaml:"text_file,omitempty"`
89
SMTP SMTPConfig `yaml:"smtp,omitempty"`
90
Service ServiceConfig `yaml:"service,omitempty"`
91
Process ProcessConfig `yaml:"process,omitempty"`
92
Network NetworkConfig `yaml:"network,omitempty"`
93
MSSQL MSSQLConfig `yaml:"mssql,omitempty"`
94
MSMQ MSMQConfig `yaml:"msmq,omitempty"`
95
LogicalDisk LogicalDiskConfig `yaml:"logical_disk,omitempty"`
96
ScheduledTask ScheduledTaskConfig `yaml:"scheduled_task,omitempty"`
97
}
98
99
// UnmarshalYAML implements yaml.Unmarshaler for Config.
100
func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
101
*c = DefaultConfig
102
103
type plain Config
104
return unmarshal((*plain)(c))
105
}
106
107
// Name returns the name used, "windows_explorer"
108
func (c *Config) Name() string {
109
return "windows_exporter"
110
}
111
112
// InstanceKey returns the hostname:port of the agent.
113
func (c *Config) InstanceKey(agentKey string) (string, error) {
114
return agentKey, nil
115
}
116
117
// NewIntegration creates an integration based on the given configuration
118
func (c *Config) NewIntegration(l log.Logger) (integrations.Integration, error) {
119
return New(l, c)
120
}
121
122
// DfsrConfig handles settings for the windows_exporter dfsr collector
123
type DfsrConfig struct {
124
SourcesEnabled string `yaml:"sources_enabled,omitempty"`
125
}
126
127
// ExchangeConfig handles settings for the windows_exporter Exchange collector
128
type ExchangeConfig struct {
129
EnabledList string `yaml:"enabled_list,omitempty"`
130
}
131
132
// IISConfig handles settings for the windows_exporter IIS collector
133
type IISConfig struct {
134
SiteWhiteList string `yaml:"site_whitelist,omitempty"`
135
SiteBlackList string `yaml:"site_blacklist,omitempty"`
136
AppWhiteList string `yaml:"app_whitelist,omitempty"`
137
AppBlackList string `yaml:"app_blacklist,omitempty"`
138
SiteInclude string `yaml:"site_include,omitempty"`
139
SiteExclude string `yaml:"site_exclude,omitempty"`
140
AppInclude string `yaml:"app_include,omitempty"`
141
AppExclude string `yaml:"app_exclude,omitempty"`
142
}
143
144
// TextFileConfig handles settings for the windows_exporter Text File collector
145
type TextFileConfig struct {
146
TextFileDirectory string `yaml:"text_file_directory,omitempty"`
147
}
148
149
// SMTPConfig handles settings for the windows_exporter SMTP collector
150
type SMTPConfig struct {
151
BlackList string `yaml:"blacklist,omitempty"`
152
WhiteList string `yaml:"whitelist,omitempty"`
153
Include string `yaml:"include,omitempty"`
154
Exclude string `yaml:"exclude,omitempty"`
155
}
156
157
// ServiceConfig handles settings for the windows_exporter service collector
158
type ServiceConfig struct {
159
UseApi string `yaml:"use_api,omitempty"`
160
Where string `yaml:"where_clause,omitempty"`
161
}
162
163
// ProcessConfig handles settings for the windows_exporter process collector
164
type ProcessConfig struct {
165
BlackList string `yaml:"blacklist,omitempty"`
166
WhiteList string `yaml:"whitelist,omitempty"`
167
Include string `yaml:"include,omitempty"`
168
Exclude string `yaml:"exclude,omitempty"`
169
}
170
171
// NetworkConfig handles settings for the windows_exporter network collector
172
type NetworkConfig struct {
173
BlackList string `yaml:"blacklist,omitempty"`
174
WhiteList string `yaml:"whitelist,omitempty"`
175
Include string `yaml:"include,omitempty"`
176
Exclude string `yaml:"exclude,omitempty"`
177
}
178
179
// MSSQLConfig handles settings for the windows_exporter SQL server collector
180
type MSSQLConfig struct {
181
EnabledClasses string `yaml:"enabled_classes,omitempty"`
182
}
183
184
// MSMQConfig handles settings for the windows_exporter MSMQ collector
185
type MSMQConfig struct {
186
Where string `yaml:"where_clause,omitempty"`
187
}
188
189
// LogicalDiskConfig handles settings for the windows_exporter logical disk collector
190
type LogicalDiskConfig struct {
191
BlackList string `yaml:"blacklist,omitempty"`
192
WhiteList string `yaml:"whitelist,omitempty"`
193
Include string `yaml:"include,omitempty"`
194
Exclude string `yaml:"exclude,omitempty"`
195
}
196
197
// ScheduledTaskConfig handles settings for the windows_exporter scheduled_task collector
198
type ScheduledTaskConfig struct {
199
Include string `yaml:"include,omitempty"`
200
Exclude string `yaml:"exclude,omitempty"`
201
}
202
203