|
@@ -30,32 +30,23 @@ func (daemon *Daemon) SystemInfo() *types.Info {
|
|
|
defer metrics.StartTimer(hostInfoFunctions.WithValues("system_info"))()
|
|
|
|
|
|
sysInfo := daemon.RawSysInfo()
|
|
|
- cRunning, cPaused, cStopped := stateCtr.get()
|
|
|
|
|
|
v := &types.Info{
|
|
|
- ID: daemon.ID,
|
|
|
- Containers: cRunning + cPaused + cStopped,
|
|
|
- ContainersRunning: cRunning,
|
|
|
- ContainersPaused: cPaused,
|
|
|
- ContainersStopped: cStopped,
|
|
|
+ ID: daemon.id,
|
|
|
Images: daemon.imageService.CountImages(),
|
|
|
IPv4Forwarding: !sysInfo.IPv4ForwardingDisabled,
|
|
|
BridgeNfIptables: !sysInfo.BridgeNFCallIPTablesDisabled,
|
|
|
BridgeNfIP6tables: !sysInfo.BridgeNFCallIP6TablesDisabled,
|
|
|
- Debug: debug.IsEnabled(),
|
|
|
Name: hostName(),
|
|
|
- NFd: fileutils.GetTotalUsedFds(),
|
|
|
- NGoroutines: runtime.NumGoroutine(),
|
|
|
SystemTime: time.Now().Format(time.RFC3339Nano),
|
|
|
LoggingDriver: daemon.defaultLogConfig.Type,
|
|
|
- NEventsListener: daemon.EventsService.SubscribersCount(),
|
|
|
KernelVersion: kernelVersion(),
|
|
|
OperatingSystem: operatingSystem(),
|
|
|
OSVersion: osVersion(),
|
|
|
IndexServerAddress: registry.IndexServer,
|
|
|
OSType: platform.OSType,
|
|
|
Architecture: platform.Architecture,
|
|
|
- RegistryConfig: daemon.RegistryService.ServiceConfig(),
|
|
|
+ RegistryConfig: daemon.registryService.ServiceConfig(),
|
|
|
NCPU: sysinfo.NumCPU(),
|
|
|
MemTotal: memInfo().MemTotal,
|
|
|
GenericResources: daemon.genericResources,
|
|
@@ -70,6 +61,8 @@ func (daemon *Daemon) SystemInfo() *types.Info {
|
|
|
Isolation: daemon.defaultIsolation,
|
|
|
}
|
|
|
|
|
|
+ daemon.fillContainerStates(v)
|
|
|
+ daemon.fillDebugInfo(v)
|
|
|
daemon.fillAPIInfo(v)
|
|
|
// Retrieve platform specific info
|
|
|
daemon.fillPlatformInfo(v, sysInfo)
|
|
@@ -181,6 +174,29 @@ func (daemon *Daemon) fillSecurityOptions(v *types.Info, sysInfo *sysinfo.SysInf
|
|
|
v.SecurityOptions = securityOptions
|
|
|
}
|
|
|
|
|
|
+func (daemon *Daemon) fillContainerStates(v *types.Info) {
|
|
|
+ cRunning, cPaused, cStopped := stateCtr.get()
|
|
|
+ v.Containers = cRunning + cPaused + cStopped
|
|
|
+ v.ContainersPaused = cPaused
|
|
|
+ v.ContainersRunning = cRunning
|
|
|
+ v.ContainersStopped = cStopped
|
|
|
+}
|
|
|
+
|
|
|
+// fillDebugInfo sets the current debugging state of the daemon, and additional
|
|
|
+// debugging information, such as the number of Go-routines, and file descriptors.
|
|
|
+//
|
|
|
+// Note that this currently always collects the information, but the CLI only
|
|
|
+// prints it if the daemon has debug enabled. We should consider to either make
|
|
|
+// this information optional (cli to request "with debugging information"), or
|
|
|
+// only collect it if the daemon has debug enabled. For the CLI code, see
|
|
|
+// https://github.com/docker/cli/blob/v20.10.12/cli/command/system/info.go#L239-L244
|
|
|
+func (daemon *Daemon) fillDebugInfo(v *types.Info) {
|
|
|
+ v.Debug = debug.IsEnabled()
|
|
|
+ v.NFd = fileutils.GetTotalUsedFds()
|
|
|
+ v.NGoroutines = runtime.NumGoroutine()
|
|
|
+ v.NEventsListener = daemon.EventsService.SubscribersCount()
|
|
|
+}
|
|
|
+
|
|
|
func (daemon *Daemon) fillAPIInfo(v *types.Info) {
|
|
|
const warn string = `
|
|
|
Access to the remote API is equivalent to root access on the host. Refer
|