diff --git a/collector/mssql.go b/collector/mssql.go index 2504c745..d83faf4c 100644 --- a/collector/mssql.go +++ b/collector/mssql.go @@ -37,7 +37,7 @@ var ( mssqlEnabledCollectors = kingpin.Flag( "collectors.mssql.classes-enabled", "Comma-separated list of mssql WMI classes to use."). - Default(mssqlFilterAvailableClassCollectors()).String() + Default(mssqlAvailableClassCollectors()).String() mssqlPrintCollectors = kingpin.Flag( "collectors.mssql.class-print", @@ -80,10 +80,24 @@ func getMSSQLInstances() mssqlInstancesType { type mssqlCollectorsMap map[string]mssqlCollectorFunc -func mssqlFilterAvailableClassCollectors() string { +func mssqlAvailableClassCollectors() string { return "availreplica,bufman,databases,dbreplica,genstats,locks,memmgr,sqlstats" } +func (c *MSSQLCollector) getMSSQLCollectors() mssqlCollectorsMap { + mssqlCollectors := make(mssqlCollectorsMap) + mssqlCollectors["availreplica"] = c.collectAvailabilityReplica + mssqlCollectors["bufman"] = c.collectBufferManager + mssqlCollectors["databases"] = c.collectDatabases + mssqlCollectors["dbreplica"] = c.collectDatabaseReplica + mssqlCollectors["genstats"] = c.collectGeneralStatistics + mssqlCollectors["locks"] = c.collectLocks + mssqlCollectors["memmgr"] = c.collectMemoryManager + mssqlCollectors["sqlstats"] = c.collectSQLStats + + return mssqlCollectors +} + func mssqlExpandEnabledCollectors(enabled string) []string { separated := strings.Split(enabled, ",") unique := map[string]bool{} @@ -99,20 +113,6 @@ func mssqlExpandEnabledCollectors(enabled string) []string { return result } -func (c *MSSQLCollector) getMSSQLCollectors() mssqlCollectorsMap { - mssqlCollectors := make(mssqlCollectorsMap) - mssqlCollectors["availreplica"] = c.collectAvailabilityReplica - mssqlCollectors["bufman"] = c.collectBufferManager - mssqlCollectors["databases"] = c.collectDatabases - mssqlCollectors["dbreplica"] = c.collectDatabaseReplica - mssqlCollectors["genstats"] = c.collectGeneralStatistics - mssqlCollectors["locks"] = c.collectLocks - mssqlCollectors["memmgr"] = c.collectMemoryManager - mssqlCollectors["sqlstats"] = c.collectSQLStats - - return mssqlCollectors -} - func init() { Factories["mssql"] = NewMSSQLCollector }