Documentation
¶
Index ¶
- func GetBasicBootTime() string
- func GetBasicDateTime() string
- func GetBasicDeviceModel() string
- func GetBasicTimestamp() string
- func GetBasicUpTime() string
- func GetBasicUpTimeDHM(uptime string) (day, hour, min string)
- func GetCPUArch() (arch, archModel string)
- func GetCPUInfo() (hardware, modelName, model, rev, serial string, cores int)
- func GetCPULoadAvg(cores int) (load1, load5, load15 string)
- func GetCPUSysTemp() string
- func GetCPUTemperatureC() float64
- func GetCPUTemperatureF() float64
- func GetDrivesFileSystem() (total, used, free, usedPercent string)
- func GetMemoryInfo() (memTotal, memFree, memAvail, buff, cache, swapTotal, swapFree string)
- func GetMemorySimple() (memTotal, memAvail, swapTotal, swapFree string)
- func GetNetworkIFDetails(ipCmd, interfaceName string) []string
- func GetNetworkIFNames(ipCmd string) []string
- func GetNetworkIPs() []model.NetworkInfo
- func GetOSCodeName() string
- func GetOSDistro() string
- func GetOSHostName(defDomain string) (hostName, fqdn string)
- func GetOSKernel() string
- func LoadNetworkIFDetailLines(detailLines []string) (ipAddr, macAddr string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBasicDateTime ¶
func GetBasicDateTime() string
GetBasicDateTime Get the current time of the system
func GetBasicDeviceModel ¶
func GetBasicDeviceModel() string
GetBasicDeviceModel Get the system device model
func GetBasicTimestamp ¶
func GetBasicTimestamp() string
func GetBasicUpTime ¶
func GetBasicUpTime() string
GetBasicUpTime 30 days, 14 hours, 3 mins - [linux - Bash format uptime to show days, hours, minutes - Stack Overflow](https://stackoverflow.com/questions/28353409/bash-format-uptime-to-show-days-hours-minutes)
func GetBasicUpTimeDHM ¶
GetBasicUpTimeDHM 30 days, 14 hours, 3 mins ==> 30 14 3
func GetCPUArch ¶
func GetCPUArch() (arch, archModel string)
GetCPUArch
➜ /usr/bin/lscpu | /bin/egrep -i 'architecture|vendor|model' Architecture: armv7l Vendor ID: ARM Model: 4 Model name: Cortex-A53
func GetCPUInfo ¶
GetCPUInfo
➜ cat /proc/cpuinfo | /bin/egrep -i 'processor|model|hardware|revision|serial' | sort | uniq CPU revision : 4 Hardware : BCM2835 model name : ARMv7 Processor rev 4 (v7l) Model : Raspberry Pi 3 Model B Plus Rev 1.3 processor : 0 processor : 1 processor : 2 processor : 3 Revision : a020d3 Serial : 000000007a867fb6
func GetCPULoadAvg ¶
GetCPULoadAvg percent
func GetDrivesFileSystem ¶
func GetDrivesFileSystem() (total, used, free, usedPercent string)
GetDrivesFileSystem
➜ df -h / | tail -n 1 | awk '{print $2,$3,$4,$5}' 15G 5.7G 8.1G 42%
func GetMemoryInfo ¶
func GetMemoryInfo() (memTotal, memFree, memAvail, buff, cache, swapTotal, swapFree string)
GetMemoryInfo
➜ /bin/cat /proc/meminfo | /bin/egrep -i "mem[tfa]|swap[tf]|buffers|cached" MemTotal: 946392 kB MemFree: 96268 kB MemAvailable: 407268 kB Buffers: 53128 kB Cached: 288424 kB SwapCached: 4264 kB SwapTotal: 102396 kB SwapFree: 2612 kB
func GetMemorySimple ¶
func GetMemorySimple() (memTotal, memAvail, swapTotal, swapFree string)
GetMemorySimple
➜ /bin/cat /proc/meminfo | /bin/egrep -i "mem[ta]|swap[tf]" MemTotal: 946392 kB MemAvailable: 366148 kB SwapTotal: 102396 kB SwapFree: 56 kB
func GetNetworkIFDetails ¶
GetNetworkIFDetails
➜ ip addr show eth0 | egrep "Link|flags|inet |ether | eth0" | /bin/egrep -v -i "lo:|loopback|inet6|\:\:1|127\.0\.0\.1" 2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether b8:27:eb:86:7f:b6 brd ff:ff:ff:ff:ff:ff
func GetNetworkIFNames ¶
GetNetworkIFNames
➜ ip link show | /bin/egrep -v 'link' | /bin/egrep ' eth| wlan' 2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
returns [eht0 wlan0]
func GetOSHostName ¶
GetOSHostName Get hostname and FQDN, support for custom domain name
func LoadNetworkIFDetailLines ¶
LoadNetworkIFDetailLines
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.