mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 14:06:38 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb9da1ae22 | ||
|
|
7de316af9f | ||
|
|
263ab8c444 | ||
|
|
57449c4768 |
@@ -76,7 +76,10 @@ The prometheus metrics will be exposed on [localhost:9182](http://localhost:9182
|
||||
|
||||
.\wmi_exporter.exe --collectors.enabled "process" --collector.process.processes-where "Name LIKE 'firefox%'"
|
||||
|
||||
When there are multiple processes with the same name, WMI represents those after the first instance as `process-name#index`. So to get them all, rather than just the first one, the query needs to be a wildcard search.
|
||||
When there are multiple processes with the same name, WMI represents those after the first instance as `process-name#index`. So to get them all, rather than just the first one, the query needs to be a wildcard search using a `%` character.
|
||||
|
||||
Please note that in Windows batch scripts (and when using the `cmd` command prompt), the `%` character is reserved, so it has to be escaped with another `%`. For example, the wildcard syntax for searching for all firefox processes is `firefox%%`.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ func getMSSQLInstances() mssqlInstancesType {
|
||||
|
||||
instanceNames, err := k.ReadValueNames(0)
|
||||
if err != nil {
|
||||
log.Warn("Can't ReadSubKeyNames %#v", err)
|
||||
log.Warnf("Can't ReadSubKeyNames %#v", err)
|
||||
return sqlDefaultInstance
|
||||
}
|
||||
|
||||
@@ -87,7 +87,15 @@ func getMSSQLInstances() mssqlInstancesType {
|
||||
func mssqlBuildWMIInstanceClass(suffix string, instance string) string {
|
||||
instancePart := "MSSQLSERVER_SQLServer"
|
||||
if instance != "MSSQLSERVER" {
|
||||
instancePart = fmt.Sprintf("MSSQL%s_MSSQL%s", instance, instance)
|
||||
// Instance names can contain some special characters, which are not supported in the WMI class name.
|
||||
// We strip those out.
|
||||
cleanedName := strings.Map(func(r rune) rune {
|
||||
if r == '_' || r == '$' || r == '#' {
|
||||
return -1
|
||||
}
|
||||
return r
|
||||
}, instance)
|
||||
instancePart = fmt.Sprintf("MSSQL%s_MSSQL%s", cleanedName, cleanedName)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("Win32_PerfRawData_%s%s", instancePart, suffix)
|
||||
|
||||
Reference in New Issue
Block a user