fix: correct minor typos in disk usage statistic
This commit is contained in:
		
							parent
							
								
									b4e6bc2ac8
								
							
						
					
					
						commit
						aebc257444
					
				@ -35,7 +35,13 @@ func GetHost() *model.Host {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	mv, _ := mem.VirtualMemory()
 | 
						mv, _ := mem.VirtualMemory()
 | 
				
			||||||
	ms, _ := mem.SwapMemory()
 | 
						ms, _ := mem.SwapMemory()
 | 
				
			||||||
	u, _ := disk.Usage("/")
 | 
						u, _ := disk.Partitions(false)
 | 
				
			||||||
 | 
						var total uint64 = 0
 | 
				
			||||||
 | 
						for _, dev := range u {
 | 
				
			||||||
 | 
							usage, _ := disk.Usage(dev.Mountpoint)
 | 
				
			||||||
 | 
							total += usage.Total
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						fmt.Println(total)
 | 
				
			||||||
	var ip ipDotSbGeoIP
 | 
						var ip ipDotSbGeoIP
 | 
				
			||||||
	resp, err := http.Get("https://api-ipv4.ip.sb/geoip")
 | 
						resp, err := http.Get("https://api-ipv4.ip.sb/geoip")
 | 
				
			||||||
	if err == nil {
 | 
						if err == nil {
 | 
				
			||||||
@ -54,7 +60,7 @@ func GetHost() *model.Host {
 | 
				
			|||||||
		PlatformVersion: hi.PlatformVersion,
 | 
							PlatformVersion: hi.PlatformVersion,
 | 
				
			||||||
		CPU:             cpus,
 | 
							CPU:             cpus,
 | 
				
			||||||
		MemTotal:        mv.Total,
 | 
							MemTotal:        mv.Total,
 | 
				
			||||||
		DiskTotal:       u.Total,
 | 
							DiskTotal:       total,
 | 
				
			||||||
		SwapTotal:       ms.Total,
 | 
							SwapTotal:       ms.Total,
 | 
				
			||||||
		Arch:            hi.KernelArch,
 | 
							Arch:            hi.KernelArch,
 | 
				
			||||||
		Virtualization:  hi.VirtualizationSystem,
 | 
							Virtualization:  hi.VirtualizationSystem,
 | 
				
			||||||
@ -77,13 +83,18 @@ func GetState(delay int64) *model.HostState {
 | 
				
			|||||||
		cpuPercent = cp[0]
 | 
							cpuPercent = cp[0]
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Disk
 | 
						// Disk
 | 
				
			||||||
	u, _ := disk.Usage("/")
 | 
						u, _ := disk.Partitions(false)
 | 
				
			||||||
 | 
						var used uint64 = 0
 | 
				
			||||||
 | 
						for _, dev := range u {
 | 
				
			||||||
 | 
							usage, _ := disk.Usage(dev.Mountpoint)
 | 
				
			||||||
 | 
							used += usage.Used
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &model.HostState{
 | 
						return &model.HostState{
 | 
				
			||||||
		CPU:            cpuPercent,
 | 
							CPU:            cpuPercent,
 | 
				
			||||||
		MemUsed:        mv.Used,
 | 
							MemUsed:        mv.Used,
 | 
				
			||||||
		SwapUsed:       ms.Used,
 | 
							SwapUsed:       ms.Used,
 | 
				
			||||||
		DiskUsed:       u.Used,
 | 
							DiskUsed:       used,
 | 
				
			||||||
		NetInTransfer:  atomic.LoadUint64(&netInTransfer),
 | 
							NetInTransfer:  atomic.LoadUint64(&netInTransfer),
 | 
				
			||||||
		NetOutTransfer: atomic.LoadUint64(&netOutTransfer),
 | 
							NetOutTransfer: atomic.LoadUint64(&netOutTransfer),
 | 
				
			||||||
		NetInSpeed:     atomic.LoadUint64(&netInSpeed),
 | 
							NetInSpeed:     atomic.LoadUint64(&netInSpeed),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user