mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 02:09:28 +08:00
add agent.debug and comments
This commit is contained in:
@@ -27,17 +27,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Agent struct {
|
type Agent struct {
|
||||||
addr string
|
addr string // Adress that the ssh server listens on
|
||||||
pubKey []byte
|
pubKey []byte // Public key for ssh server
|
||||||
sem chan struct{}
|
sem chan struct{} // Semaphore to limit concurrent access to docker api
|
||||||
containerStatsMap map[string]*container.PrevContainerStats
|
containerStatsMap map[string]*container.PrevContainerStats // Keeps track of container stats
|
||||||
containerStatsMutex *sync.Mutex
|
containerStatsMutex *sync.Mutex // Mutex to prevent concurrent access to containerStatsMap
|
||||||
fsNames []string
|
fsNames []string // List of filesystem device names being monitored
|
||||||
fsStats map[string]*system.FsStats
|
fsStats map[string]*system.FsStats // Keeps track of disk stats for each filesystem
|
||||||
netInterfaces map[string]struct{}
|
netInterfaces map[string]struct{} // Stores all valid network interfaces
|
||||||
netIoStats *system.NetIoStats
|
netIoStats *system.NetIoStats // Keeps track of bandwidth usage
|
||||||
dockerClient *http.Client
|
dockerClient *http.Client // HTTP client to query docker api
|
||||||
sensorsContext context.Context
|
sensorsContext context.Context // Sensors context to override sys location
|
||||||
|
debug bool // true if LOG_LEVEL is set to debug
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAgent(pubKey []byte, addr string) *Agent {
|
func NewAgent(pubKey []byte, addr string) *Agent {
|
||||||
@@ -378,6 +379,7 @@ func (a *Agent) Run() {
|
|||||||
if logLevelStr, exists := os.LookupEnv("LOG_LEVEL"); exists {
|
if logLevelStr, exists := os.LookupEnv("LOG_LEVEL"); exists {
|
||||||
switch strings.ToLower(logLevelStr) {
|
switch strings.ToLower(logLevelStr) {
|
||||||
case "debug":
|
case "debug":
|
||||||
|
a.debug = true
|
||||||
slog.SetLogLoggerLevel(slog.LevelDebug)
|
slog.SetLogLoggerLevel(slog.LevelDebug)
|
||||||
case "warn":
|
case "warn":
|
||||||
slog.SetLogLoggerLevel(slog.LevelWarn)
|
slog.SetLogLoggerLevel(slog.LevelWarn)
|
||||||
|
Reference in New Issue
Block a user