Documentation ¶
Overview ¶
Package ostent is the library part of ostent cmd.
Index ¶
- Constants
- Variables
- func AddAssetPathContextFunc(path string) func(http.Handler) http.Handler
- func AddBackground(j backgroundHandler)
- func AssetInfoFunc(infofunc func(string) (os.FileInfo, error)) func(string) (TimeInfo, error)
- func AssetReadFunc(readfunc func(string) ([]byte, error)) func(string) ([]byte, error)
- func CollectLoop()
- func ContextParams(r *http.Request) (httprouter.Params, error)
- func Distrib() (string, error)
- func Fetch(keys *params.FetchKeys) error
- func FetchExtract(jdata *gabs.Container, keys []string) (*gabs.Container, interface{})
- func FetchOne(k params.FetchKey, keys []string) error
- func FormatCPU(label string, mc *system.MetricCPU) system.CPUData
- func FormatDF(md *system.MetricDF) system.DFData
- func FormatIF(mi *system.MetricIF) system.IFData
- func FormatIF1000(diff *system.GaugeDiff, info1, info2 *string)
- func FormatIF1024(diff *system.GaugeDiff, info1, info2 *string)
- func HandleFunc(hf http.HandlerFunc) httprouter.Handle
- func HandleThen(then func(http.Handler) http.Handler) func(http.HandlerFunc) httprouter.Handle
- func HardwareIF(name string) bool
- func LSBID(platform string) string
- func LogHandler(logRequests bool, h http.Handler) http.Handler
- func NextSecond() time.Time
- func NextSecondDelta() (time.Time, time.Duration)
- func ParamsFunc(then func(http.Handler) http.Handler) func(http.HandlerFunc) httprouter.Handle
- func ProcName(_ int, procName string) string
- func RunBackground()
- func ServerHandler(logRequests bool, h http.Handler) http.Handler
- type CPUSlice
- type ContextID
- type DFSlice
- type DFSort
- type ExportingList
- type ExportingListing
- type IFSlice
- type IndexData
- type IndexRegistry
- func (ir *IndexRegistry) GetCPU(para *params.Params) []system.CPUData
- func (ir *IndexRegistry) GetDF(para *params.Params) []system.DFData
- func (ir *IndexRegistry) GetIF(para *params.Params) []system.IFData
- func (ir *IndexRegistry) GetOrRegisterPrivateCPU(coreno int) *system.MetricCPU
- func (ir *IndexRegistry) GetOrRegisterPrivateDF(part disk.PartitionStat) *system.MetricDF
- func (ir *IndexRegistry) GetOrRegisterPrivateIF(name string) *system.MetricIF
- func (ir *IndexRegistry) ListPrivateCPU() (cs CPUSlice)
- func (ir *IndexRegistry) ListPrivateDF() (dfs DFSlice)
- func (ir *IndexRegistry) ListPrivateIF() (is IFSlice)
- func (ir *IndexRegistry) UpdateCPU(agg cpu.TimesStat, list []cpu.TimesStat)
- func (ir *IndexRegistry) UpdateDF(part disk.PartitionStat, usage *disk.UsageStat)
- func (ir *IndexRegistry) UpdateIF(ifaddr system.IfAddress)
- func (ir *IndexRegistry) UpdateLA(stat load.AvgStat)
- func (ir *IndexRegistry) UpdateMEM(ram *mem.VirtualMemoryStat, swap *mem.SwapMemoryStat)
- type NetIO
- func (io NetIO) BytesIn() uint
- func (io NetIO) BytesOut() uint
- func (io NetIO) DropsIn() uint
- func (io NetIO) DropsOut() uint
- func (io NetIO) ErrorsIn() uint
- func (io NetIO) ErrorsOut() uint
- func (io NetIO) GetIP() string
- func (io NetIO) GetName() string
- func (io NetIO) PacketsIn() uint
- func (io NetIO) PacketsOut() uint
- type PS
- type PSSlice
- type PSSort
- type SSE
- type ServeAssets
- type ServeIndex
- type ServeSSE
- type ServeWS
- type TimeInfo
- type UpgradeInfo
Constants ¶
const VERSION = "0.6.2"
VERSION of the latest known release. Unused in non-bin mode. Compared with in github.com/ostrost/ostent/main.go MUST BE semver compatible: no two digits ("X.Y") allowed.
Variables ¶
var ( RXlo = regexp.MustCompile(`^lo\d*$`) RXvbr = regexp.MustCompile(`^virbr\d+$`) RXvbrnic = regexp.MustCompile(`^virbr\d+-nic$`) RXbridge = regexp.MustCompile(`^bridge\d+$`) RXvboxnet = regexp.MustCompile(`^vboxnet\d+$`) RXfw = regexp.MustCompile(`^fw\d+$`) RXgif = regexp.MustCompile(`^gif\d+$`) RXstf = regexp.MustCompile(`^stf\d+$`) RXwdl = regexp.MustCompile(`^awdl\d+$`) RXairdrop = regexp.MustCompile(`^p2p\d+$`) )
These are regexps to match network interfaces.
Functions ¶
func AddAssetPathContextFunc ¶
func AddBackground ¶
func AddBackground(j backgroundHandler)
func AssetInfoFunc ¶
AssetInfoFunc wraps bindata's AssetInfo func. Returns typecasted infofunc.
func AssetReadFunc ¶
AssetReadFunc wraps bindata's Asset func. Returns readfunc itself.
func ContextParams ¶ added in v0.6.2
func ContextParams(r *http.Request) (httprouter.Params, error)
func FetchExtract ¶ added in v0.6.1
func FormatIF1000 ¶
func FormatIF1024 ¶
func HandleFunc ¶ added in v0.6.2
func HandleFunc(hf http.HandlerFunc) httprouter.Handle
HandleFunc wraps hf into handle.
func HandleThen ¶ added in v0.6.2
func HandleThen(then func(http.Handler) http.Handler) func(http.HandlerFunc) httprouter.Handle
HandleThen wraps then(hf) into handle.
func HardwareIF ¶
HardwareIF returns false for known virtual/software network interface name.
func NextSecondDelta ¶
NextSecondDelta returns precisely next second in Time and Duration.
func ParamsFunc ¶ added in v0.6.2
func ParamsFunc(then func(http.Handler) http.Handler) func(http.HandlerFunc) httprouter.Handle
ParamsFunc wraps then(hf) into handle with context setting by handleParamSetContext.
func RunBackground ¶
func RunBackground()
Types ¶
type ExportingList ¶ added in v0.6.1
type ExportingList []struct{ Name, Endpoint string }
ExportingList is a list to be sorted by .Name: - Entries come from CLI flags which may be specified in any order - That order not preserved since parsing anyway
var ( // Connections is of unexported conns type to hold active ws connections. Connections = conns{/* contains filtered or unexported fields */} // Exporting has "exporting to" list (after init) Exporting ExportingList )
func (ExportingList) Len ¶ added in v0.6.1
func (el ExportingList) Len() int
func (ExportingList) Less ¶ added in v0.6.1
func (el ExportingList) Less(i, j int) bool
func (ExportingList) Swap ¶ added in v0.6.1
func (el ExportingList) Swap(i, j int)
type ExportingListing ¶ added in v0.6.1
type ExportingListing struct { RWMutex sync.RWMutex ExportingList }
ExportingListing keeps "exporting to" list.
func (*ExportingListing) AddExporter ¶ added in v0.6.1
func (el *ExportingListing) AddExporter(name string, stringer fmt.Stringer)
type IndexData ¶
type IndexData map[string]interface{}
IndexData is a data map for templates and marshalling. Keys (even abbrevs eg CPU) intentionally start with lowercase.
type IndexRegistry ¶
type IndexRegistry struct { Registry metrics.Registry PrivateCPUAll *system.MetricCPU /// metrics.Registry PrivateCPURegistry metrics.Registry // set of MetricCPUs is handled as a metric in this registry PrivateIFRegistry metrics.Registry // set of system.MetricIFs is handled as a metric in this registry PrivateDFRegistry metrics.Registry // set of system.MetricDFs is handled as a metric in this registry PrivateMutex sync.Mutex RAM *system.MetricRAM Swap system.MetricSwap Load *system.MetricLoad Mutex sync.Mutex }
var ( OstentUpgrade = new(UpgradeInfo) Reg1s *IndexRegistry )
func (*IndexRegistry) GetCPU ¶
func (ir *IndexRegistry) GetCPU(para *params.Params) []system.CPUData
func (*IndexRegistry) GetOrRegisterPrivateCPU ¶
func (ir *IndexRegistry) GetOrRegisterPrivateCPU(coreno int) *system.MetricCPU
GetOrRegisterPrivateCPU produces a registered in PrivateCPURegistry MetricCPU.
func (*IndexRegistry) GetOrRegisterPrivateDF ¶
func (ir *IndexRegistry) GetOrRegisterPrivateDF(part disk.PartitionStat) *system.MetricDF
func (*IndexRegistry) GetOrRegisterPrivateIF ¶
func (ir *IndexRegistry) GetOrRegisterPrivateIF(name string) *system.MetricIF
GetOrRegisterPrivateIF produces a registered in PrivateIFRegistry system.MetricIF.
func (*IndexRegistry) ListPrivateCPU ¶
func (ir *IndexRegistry) ListPrivateCPU() (cs CPUSlice)
ListPrivateCPU returns list of system.MetricCPU's by traversing the PrivateCPURegistry.
func (*IndexRegistry) ListPrivateDF ¶
func (ir *IndexRegistry) ListPrivateDF() (dfs DFSlice)
ListPrivateDF returns list of system.MetricDF's by traversing the PrivateDFRegistry.
func (*IndexRegistry) ListPrivateIF ¶
func (ir *IndexRegistry) ListPrivateIF() (is IFSlice)
ListPrivateIF returns list of MetricIF's by traversing the PrivateIFRegistry.
func (*IndexRegistry) UpdateCPU ¶
func (ir *IndexRegistry) UpdateCPU(agg cpu.TimesStat, list []cpu.TimesStat)
func (*IndexRegistry) UpdateDF ¶
func (ir *IndexRegistry) UpdateDF(part disk.PartitionStat, usage *disk.UsageStat)
func (*IndexRegistry) UpdateIF ¶
func (ir *IndexRegistry) UpdateIF(ifaddr system.IfAddress)
func (*IndexRegistry) UpdateLA ¶
func (ir *IndexRegistry) UpdateLA(stat load.AvgStat)
func (*IndexRegistry) UpdateMEM ¶ added in v0.6.2
func (ir *IndexRegistry) UpdateMEM(ram *mem.VirtualMemoryStat, swap *mem.SwapMemoryStat)
UpdateMEM reads stat and updates ir.RAM and ir.Swap
type NetIO ¶ added in v0.6.1
type NetIO struct { psnet.IOCountersStat IP string }
func (NetIO) PacketsOut ¶ added in v0.6.1
type SSE ¶
type SSE struct { Writer http.ResponseWriter // points to the writer Params *params.Params SentHeaders bool Errord bool }
type ServeAssets ¶
type ServeAssets struct { ReadFunc func(string) ([]byte, error) InfoFunc func(string) (os.FileInfo, error) AltModTimeFunc func() time.Time // may be nil }
func (ServeAssets) Serve ¶
func (sa ServeAssets) Serve(w http.ResponseWriter, r *http.Request)
Serve does http.ServeContent with asset content and info.
type ServeIndex ¶
type ServeIndex struct { ServeWS TaggedBin bool IndexTemplate *templateutil.LazyTemplate }
func NewServeIndex ¶
func NewServeIndex(sw ServeWS, taggedbin bool, template *templateutil.LazyTemplate) ServeIndex
func (ServeIndex) Index ¶
func (si ServeIndex) Index(w http.ResponseWriter, r *http.Request)
Index renders index page.
type ServeSSE ¶
type ServeSSE struct { flags.DelayBounds // contains filtered or unexported fields }
func NewServeSSE ¶
func NewServeSSE(logRequests bool, dbounds flags.DelayBounds) ServeSSE
type UpgradeInfo ¶ added in v0.6.1
func (*UpgradeInfo) Get ¶ added in v0.6.1
func (ui *UpgradeInfo) Get() string
func (*UpgradeInfo) Set ¶ added in v0.6.1
func (ui *UpgradeInfo) Set(lv string)