Documentation ¶
Overview ¶
Package sysinfo implements functions for gathering system information via the https://github.com/shirou/gopsutil/ package.
Index ¶
- func GetAPIRoutes(c *fiber.Ctx) ([]string, error)
- func GetCPUInfo(debug bool) ([]cpu.InfoStat, error)
- func GetHostInfo(debug bool) (*host.InfoStat, error)
- func GetLoadInfo(debug bool) (*load.AvgStat, error)
- func GetMemInfo(debug bool) (*mem.VirtualMemoryStat, error)
- func GetNetInfo(debug bool) ([]net.InterfaceStat, error)
- func TestTLS() (errors int)
- func TestTZ() (errors int)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAPIRoutes ¶
GetAPIRoutes collects active Fiber routes, parses them, and returns the data or as JSON or error.
Returned data example:
{ "apiRoutes": [ "/", "/api/v1", "/api/v1/docs", "/api/v1/metrics", "/api/v1/resource/", "/api/v1/resource/all", "/api/v1/resource/cpu", "/api/v1/resource/host", "/api/v1/resource/load", "/api/v1/resource/memory", "/api/v1/resource/network" ] }
func GetCPUInfo ¶
GetCPUInfo collects local system cpu info, parses it, and returns the data as JSON or an error.
Returned data example (truncated ...):
{ cpuInfo: { [ { "cpu": 0, "vendorId": "GenuineIntel", "family": "6", "model": "76", "stepping": 4, "physicalId": "0", "coreId": "0", "cores": 1, "modelName": "Intel(R) Pentium(R) CPU N3710 @ 1.60GHz", "mhz": 2560, "cacheSize": 1024, "flags": [ "fpu", "vme", "de", ... ], } ] } }
func GetHostInfo ¶
GetHostInfo collects local system host info, parses it, and returns the data as JSON or an error.
Returned data example:
{ hostInfo: { uptime: 1386790, bootTime: 1669484114, procs: 193, os: "linux", platform: "ubuntu", platformFamily: "debian", platformVersion: "20.04", kernelVersion: "5.4.0-110-generic", kernelArch: "x86_64", virtualizationSystem: "kvm", virtualizationRole: "host", hostId: "3a114467-105a-48a5-9419-32654a9b2076" } }
func GetLoadInfo ¶
GetLoadInfo collects local system load info, parses it, and returns the data as JSON or an error.
Returned data example:
{ loadInfo: { load1: 0.58, load5: 0.87, load15: 0.9 } }
func GetMemInfo ¶
func GetMemInfo(debug bool) (*mem.VirtualMemoryStat, error)
GetMemInfo collects local system memory info, parses it, and returns the data as JSON or an error.
Returned data example (truncated ...):
{ memInfo: { total: 8247103488, available: 5860028416, used: 2075901952, usedPercent: 25.171285349099282, ... } }
func GetNetInfo ¶
func GetNetInfo(debug bool) ([]net.InterfaceStat, error)
GetNetInfo collects local system network info, parses it, and returns the data as JSON or an error.
Returned data example (truncated ...):
{ netInfo: [ { index: 1, mtu: 65536, name: "lo", hardwareAddr: "", flags: [ "up", "loopback" ], addrs: [ { addr: "127.0.0.1/8" }, { addr: "::1/128" } ] }, ... ] }
func TestTLS ¶
func TestTLS() (errors int)
TestTLS checks to see if the certificates were properly included in the docker multi-stage build.
This is only executed when 'debug' is set to 'true' in 'config/appConfig.yml'.
Example ¶
package main import ( "github.com/mwiater/golangdocker/sysinfo" ) func main() { sysinfo.TestTLS() }
Output: [ ✓ SUCCESS ] Successfully established https connection to: https://google.com
func TestTZ ¶
func TestTZ() (errors int)
TestTZ checks to see if the timezone data was properly included in the docker multi-stage build.
This is only executed when 'debug' is set to 'true' in 'config/appConfig.yml'.
Example ¶
package main import ( "github.com/mwiater/golangdocker/sysinfo" ) func main() { sysinfo.TestTZ() }
Output: [ ✓ SUCCESS ] Successfully loaded: America/Los_Angeles
Types ¶
This section is empty.