Documentation
¶
Overview ¶
Package memory is the memory behavior: the memory of the host, in bytes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Behavior = behavior.Register(behavior.Define( "memory", "Get the memory usage of target hosts", behavior.Node, behavior.API, behavior.Area(area.Hardware), behavior.CLI, behavior.Platform(behavior.PlatformLinux, newReader), behavior.Platform(behavior.PlatformDarwin, newReader), behavior.RunsOnPlatform(behavior.PlatformDarwin, "sysctl", "vm_stat"), behavior.Read("get", Get). Describe("Get the memory usage of the host"). Explain("Reads the total, the free and the used memory, in bytes. Used is the "+ "total less what is available, which includes the cache, as free(1) "+ "reports it."). Example("A host with 8 GiB, 2 GiB of it free", GetInput{}, Entry{Memory: Usage{Total: 8589934592, Free: 2147483648, Used: 4294967296}}, behavior.Exists( "/proc/meminfo", "MemTotal: 8388608 kB\nMemFree: 2097152 kB\nMemAvailable: 4194304 kB\n", ), behavior.Prints("sysctl -n hw.memsize", "8589934592\n"), behavior.Prints("vm_stat", "Mach Virtual Memory Statistics: (page size of 4096 bytes)\n"+ "Pages free: 524288.\n"+ "Pages active: 786432.\n"+ "Pages inactive: 524288.\n"), ), ))
Behavior is the memory definition.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Memory Usage `json:"memory" doc:"The memory of the host"`
}
Entry is the host's memory.
type Usage ¶
type Usage struct {
Total int `json:"total" doc:"Total memory in bytes" render:"bytes"`
Free int `json:"free" doc:"Free memory in bytes" render:"bytes"`
Used int `json:"used" doc:"Used memory in bytes: the total less what is available" render:"bytes"`
}
Usage is the total, free and used memory, in bytes.
Click to show internal directories.
Click to hide internal directories.