mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
Add HostProcess Container Configuration for k8s
Co-authored-by: Brian Redmond <brianisrunning@gmail.com> Signed-off-by: Brian Redmond <brianisrunning@gmail.com> Signed-off-by: James Sturtevant <jstur@microsoft.com>
This commit is contained in:
committed by
James Sturtevant
parent
e07b2053af
commit
b450a50103
11
exporter.go
11
exporter.go
@@ -9,6 +9,7 @@ import (
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"os"
|
||||
"os/user"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -345,6 +346,16 @@ func main() {
|
||||
log.Fatalf("Couldn't load collectors: %s", err)
|
||||
}
|
||||
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
log.Fatalf(err.Error())
|
||||
}
|
||||
|
||||
log.Infof("Running as %v", u.Username)
|
||||
if strings.Contains(u.Username, "ContainerAdministrator") || strings.Contains(u.Username, "ContainerUser") {
|
||||
log.Warnf("Running as a preconfigured Windows Container user. This may mean you do not have Windows HostProcess containers configured correctly and some functionality will not work as expected.")
|
||||
}
|
||||
|
||||
log.Infof("Enabled collectors: %v", strings.Join(keys(collectors), ", "))
|
||||
|
||||
h := &metricsHandler{
|
||||
|
||||
Reference in New Issue
Block a user