Documentation ¶
Index ¶
- Variables
- func Available() []string
- type BuilderWithFlags
- type Collector
- type Config
- type Map
- type MetricCollectors
- func (c *MetricCollectors) Build(logger *slog.Logger) error
- func (c *MetricCollectors) Close(logger *slog.Logger) error
- func (c *MetricCollectors) Enable(enabledCollectors []string)
- func (c *MetricCollectors) NewPrometheusCollector(timeout time.Duration, logger *slog.Logger) *Prometheus
- func (c *MetricCollectors) PrepareScrapeContext() (*types.ScrapeContext, error)
- func (c *MetricCollectors) SetPerfCounterQuery(logger *slog.Logger) error
- type Prometheus
Constants ¶
This section is empty.
Variables ¶
var BuildersWithFlags = map[string]BuilderWithFlags[Collector]{ ad.Name: NewBuilderWithFlags(ad.NewWithFlags), adcs.Name: NewBuilderWithFlags(adcs.NewWithFlags), adfs.Name: NewBuilderWithFlags(adfs.NewWithFlags), cache.Name: NewBuilderWithFlags(cache.NewWithFlags), container.Name: NewBuilderWithFlags(container.NewWithFlags), cpu.Name: NewBuilderWithFlags(cpu.NewWithFlags), cpu_info.Name: NewBuilderWithFlags(cpu_info.NewWithFlags), cs.Name: NewBuilderWithFlags(cs.NewWithFlags), dfsr.Name: NewBuilderWithFlags(dfsr.NewWithFlags), dhcp.Name: NewBuilderWithFlags(dhcp.NewWithFlags), diskdrive.Name: NewBuilderWithFlags(diskdrive.NewWithFlags), dns.Name: NewBuilderWithFlags(dns.NewWithFlags), exchange.Name: NewBuilderWithFlags(exchange.NewWithFlags), fsrmquota.Name: NewBuilderWithFlags(fsrmquota.NewWithFlags), hyperv.Name: NewBuilderWithFlags(hyperv.NewWithFlags), iis.Name: NewBuilderWithFlags(iis.NewWithFlags), license.Name: NewBuilderWithFlags(license.NewWithFlags), logical_disk.Name: NewBuilderWithFlags(logical_disk.NewWithFlags), logon.Name: NewBuilderWithFlags(logon.NewWithFlags), memory.Name: NewBuilderWithFlags(memory.NewWithFlags), mscluster.Name: NewBuilderWithFlags(mscluster.NewWithFlags), msmq.Name: NewBuilderWithFlags(msmq.NewWithFlags), mssql.Name: NewBuilderWithFlags(mssql.NewWithFlags), net.Name: NewBuilderWithFlags(net.NewWithFlags), netframework.Name: NewBuilderWithFlags(netframework.NewWithFlags), nps.Name: NewBuilderWithFlags(nps.NewWithFlags), os.Name: NewBuilderWithFlags(os.NewWithFlags), perfdata.Name: NewBuilderWithFlags(perfdata.NewWithFlags), physical_disk.Name: NewBuilderWithFlags(physical_disk.NewWithFlags), printer.Name: NewBuilderWithFlags(printer.NewWithFlags), process.Name: NewBuilderWithFlags(process.NewWithFlags), remote_fx.Name: NewBuilderWithFlags(remote_fx.NewWithFlags), scheduled_task.Name: NewBuilderWithFlags(scheduled_task.NewWithFlags), service.Name: NewBuilderWithFlags(service.NewWithFlags), smb.Name: NewBuilderWithFlags(smb.NewWithFlags), smbclient.Name: NewBuilderWithFlags(smbclient.NewWithFlags), smtp.Name: NewBuilderWithFlags(smtp.NewWithFlags), system.Name: NewBuilderWithFlags(system.NewWithFlags), teradici_pcoip.Name: NewBuilderWithFlags(teradici_pcoip.NewWithFlags), tcp.Name: NewBuilderWithFlags(tcp.NewWithFlags), terminal_services.Name: NewBuilderWithFlags(terminal_services.NewWithFlags), textfile.Name: NewBuilderWithFlags(textfile.NewWithFlags), thermalzone.Name: NewBuilderWithFlags(thermalzone.NewWithFlags), time.Name: NewBuilderWithFlags(time.NewWithFlags), vmware.Name: NewBuilderWithFlags(vmware.NewWithFlags), vmware_blast.Name: NewBuilderWithFlags(vmware_blast.NewWithFlags), }
var ConfigDefaults = Config{ AD: ad.ConfigDefaults, ADCS: adcs.ConfigDefaults, ADFS: adfs.ConfigDefaults, Cache: cache.ConfigDefaults, Container: container.ConfigDefaults, CPU: cpu.ConfigDefaults, CPUInfo: cpu_info.ConfigDefaults, Cs: cs.ConfigDefaults, DFSR: dfsr.ConfigDefaults, Dhcp: dhcp.ConfigDefaults, DiskDrive: diskdrive.ConfigDefaults, DNS: dns.ConfigDefaults, Exchange: exchange.ConfigDefaults, Fsrmquota: fsrmquota.ConfigDefaults, Hyperv: hyperv.ConfigDefaults, IIS: iis.ConfigDefaults, License: license.ConfigDefaults, LogicalDisk: logical_disk.ConfigDefaults, Logon: logon.ConfigDefaults, Memory: memory.ConfigDefaults, Mscluster: mscluster.ConfigDefaults, Msmq: msmq.ConfigDefaults, Mssql: mssql.ConfigDefaults, Net: net.ConfigDefaults, NetFramework: netframework.ConfigDefaults, Nps: nps.ConfigDefaults, Os: os.ConfigDefaults, PerfData: perfdata.ConfigDefaults, PhysicalDisk: physical_disk.ConfigDefaults, Printer: printer.ConfigDefaults, Process: process.ConfigDefaults, RemoteFx: remote_fx.ConfigDefaults, ScheduledTask: scheduled_task.ConfigDefaults, Service: service.ConfigDefaults, SMB: smb.ConfigDefaults, SMBClient: smbclient.ConfigDefaults, SMTP: smtp.ConfigDefaults, System: system.ConfigDefaults, TeradiciPcoip: teradici_pcoip.ConfigDefaults, TCP: tcp.ConfigDefaults, TerminalServices: terminal_services.ConfigDefaults, Textfile: textfile.ConfigDefaults, Thermalzone: thermalzone.ConfigDefaults, Time: time.ConfigDefaults, Vmware: vmware.ConfigDefaults, VmwareBlast: vmware_blast.ConfigDefaults, }
ConfigDefaults Is an interface to be used by the external libraries. It holds all ConfigDefaults form all collectors
Functions ¶
Types ¶
type BuilderWithFlags ¶ added in v0.27.0
type BuilderWithFlags[C Collector] func(*kingpin.Application) C
func NewBuilderWithFlags ¶ added in v0.27.0
func NewBuilderWithFlags[C Collector](fn BuilderWithFlags[C]) BuilderWithFlags[Collector]
type Collector ¶ added in v0.27.0
type Collector interface { Build(logger *slog.Logger, wmiClient *wmi.Client) error // Close closes the collector Close(logger *slog.Logger) error // GetName get the name of the collector GetName() string // GetPerfCounter returns the perf counter required by the collector GetPerfCounter(logger *slog.Logger) ([]string, error) // Collect Get new metrics and expose them via prometheus registry. Collect(ctx *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) (err error) }
Collector interface that a collector has to implement.
type Config ¶
type Config struct { AD ad.Config `yaml:"ad"` ADCS adcs.Config `yaml:"adcs"` ADFS adfs.Config `yaml:"adfs"` Cache cache.Config `yaml:"cache"` Container container.Config `yaml:"container"` CPU cpu.Config `yaml:"cpu"` CPUInfo cpu_info.Config `yaml:"cpu_info"` Cs cs.Config `yaml:"cs"` DFSR dfsr.Config `yaml:"dfsr"` Dhcp dhcp.Config `yaml:"dhcp"` DiskDrive diskdrive.Config `yaml:"diskdrive"` //nolint:tagliatelle DNS dns.Config `yaml:"dns"` Exchange exchange.Config `yaml:"exchange"` Fsrmquota fsrmquota.Config `yaml:"fsrmquota"` Hyperv hyperv.Config `yaml:"hyperv"` IIS iis.Config `yaml:"iis"` License license.Config `yaml:"license"` LogicalDisk logical_disk.Config `yaml:"logical_disk"` Logon logon.Config `yaml:"logon"` Memory memory.Config `yaml:"memory"` Mscluster mscluster.Config `yaml:"mscluster"` Msmq msmq.Config `yaml:"msmq"` Mssql mssql.Config `yaml:"mssql"` Net net.Config `yaml:"net"` NetFramework netframework.Config `yaml:"net_framework"` Nps nps.Config `yaml:"nps"` Os os.Config `yaml:"os"` PerfData perfdata.Config `yaml:"perf_data"` PhysicalDisk physical_disk.Config `yaml:"physical_disk"` Printer printer.Config `yaml:"printer"` Process process.Config `yaml:"process"` RemoteFx remote_fx.Config `yaml:"remote_fx"` ScheduledTask scheduled_task.Config `yaml:"scheduled_task"` Service service.Config `yaml:"service"` SMB smb.Config `yaml:"smb"` SMBClient smbclient.Config `yaml:"smbclient"` //nolint:tagliatelle SMTP smtp.Config `yaml:"smtp"` System system.Config `yaml:"system"` TeradiciPcoip teradici_pcoip.Config `yaml:"teradici_pcoip"` TCP tcp.Config `yaml:"tcp"` TerminalServices terminal_services.Config `yaml:"terminal_services"` Textfile textfile.Config `yaml:"textfile"` Thermalzone thermalzone.Config `yaml:"thermalzone"` Time time.Config `yaml:"time"` Vmware vmware.Config `yaml:"vmware"` VmwareBlast vmware_blast.Config `yaml:"vmware_blast"` }
type MetricCollectors ¶ added in v0.29.0
func New ¶
func New(collectors Map) *MetricCollectors
New To be called by the external libraries for collector initialization.
func NewWithConfig ¶
func NewWithConfig(config Config) *MetricCollectors
NewWithConfig To be called by the external libraries for collector initialization without running kingpin.Parse
func NewWithFlags ¶
func NewWithFlags(app *kingpin.Application) *MetricCollectors
NewWithFlags To be called by the exporter for collector initialization before running kingpin.Parse.
func (*MetricCollectors) Build ¶ added in v0.29.0
func (c *MetricCollectors) Build(logger *slog.Logger) error
Build To be called by the exporter for collector initialization.
func (*MetricCollectors) Close ¶ added in v0.29.0
func (c *MetricCollectors) Close(logger *slog.Logger) error
Close To be called by the exporter for collector cleanup.
func (*MetricCollectors) Enable ¶ added in v0.29.0
func (c *MetricCollectors) Enable(enabledCollectors []string)
Enable removes all collectors that not enabledCollectors.
func (*MetricCollectors) NewPrometheusCollector ¶ added in v0.29.0
func (c *MetricCollectors) NewPrometheusCollector(timeout time.Duration, logger *slog.Logger) *Prometheus
NewPrometheusCollector returns a new Prometheus where the set of MetricCollectors must return metrics within the given timeout.
func (*MetricCollectors) PrepareScrapeContext ¶ added in v0.29.0
func (c *MetricCollectors) PrepareScrapeContext() (*types.ScrapeContext, error)
PrepareScrapeContext creates a ScrapeContext to be used during a single scrape.
func (*MetricCollectors) SetPerfCounterQuery ¶ added in v0.29.0
func (c *MetricCollectors) SetPerfCounterQuery(logger *slog.Logger) error
type Prometheus ¶
type Prometheus struct {
// contains filtered or unexported fields
}
Prometheus implements prometheus.Collector for a set of Windows MetricCollectors.
func (*Prometheus) Collect ¶
func (p *Prometheus) Collect(ch chan<- prometheus.Metric)
Collect sends the collected metrics from each of the MetricCollectors to prometheus.
func (*Prometheus) Describe ¶
func (p *Prometheus) Describe(_ chan<- *prometheus.Desc)