mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 02:09:28 +08:00
add SENSORS env var
This commit is contained in:
@@ -30,6 +30,7 @@ type Agent struct {
|
||||
dockerClient *http.Client // HTTP client to query docker api
|
||||
apiContainerList *[]container.ApiInfo // List of containers from docker host
|
||||
sensorsContext context.Context // Sensors context to override sys location
|
||||
sensorsWhitelist map[string]struct{} // List of sensors to monitor
|
||||
}
|
||||
|
||||
func NewAgent() *Agent {
|
||||
@@ -64,6 +65,14 @@ func (a *Agent) Run(pubKey []byte, addr string) {
|
||||
)
|
||||
}
|
||||
|
||||
// Set sensors whitelist
|
||||
if sensors, exists := os.LookupEnv("SENSORS"); exists {
|
||||
a.sensorsWhitelist = make(map[string]struct{})
|
||||
for _, sensor := range strings.Split(sensors, ",") {
|
||||
a.sensorsWhitelist[sensor] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
a.initializeSystemInfo()
|
||||
a.initializeDiskInfo()
|
||||
a.initializeNetIoStats()
|
||||
|
Reference in New Issue
Block a user