Documentation ¶
Index ¶
- Constants
- func DefaultEnv(ctx context.Context, input []types.Value) (types.Value, error)
- func Env(ctx context.Context, input []types.Value) (types.Value, error)
- func GetEnv(ctx context.Context, input []types.Value) (types.Value, error)
- func HasEnv(ctx context.Context, input []types.Value) (types.Value, error)
- type CPUCountFact
- type HostnameFact
- type LoadFact
- type UptimeFact
Constants ¶
const ( // CPUCountFuncName is the name this fact is registered as. It's still a // Func Name because this is the name space the fact is actually using. CPUCountFuncName = "cpu_count" )
const ( // HostnameFuncName is the name this fact is registered as. It's still a // Func Name because this is the name space the fact is actually using. HostnameFuncName = "hostname" )
const ( // LoadFuncName is the name this fact is registered as. It's still a // Func Name because this is the name space the fact is actually using. LoadFuncName = "load" )
const ( // LoadScale factor scales the output from sysinfo to the correct float // value. LoadScale = 65536 // XXX: is this correct or should it be 65535? )
const (
// ModuleName is the prefix given to all the functions in this module.
ModuleName = "sys"
)
const ( // UptimeFuncName is the name this fact is registered as. It's still a // Func Name because this is the name space the fact is actually using. UptimeFuncName = "uptime" )
Variables ¶
This section is empty.
Functions ¶
func DefaultEnv ¶
DefaultEnv gets environment variable by name or returns default if non existing.
Types ¶
type CPUCountFact ¶
type CPUCountFact struct {
// contains filtered or unexported fields
}
CPUCountFact is a fact that returns the current CPU count.
func (*CPUCountFact) Info ¶
func (obj *CPUCountFact) Info() *facts.Info
Info returns static typing info about what the fact returns.
func (*CPUCountFact) Init ¶
func (obj *CPUCountFact) Init(init *facts.Init) error
Init runs startup code for this fact and sets the facts.Init variable.
func (CPUCountFact) Stream ¶
func (obj CPUCountFact) Stream(ctx context.Context) error
Stream returns the changing values that this fact has over time. It will first poll sysfs to get the initial cpu count, and then receives UEvents from the kernel as CPUs are added/removed.
func (*CPUCountFact) String ¶
func (obj *CPUCountFact) String() string
String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.
type HostnameFact ¶
type HostnameFact struct {
// contains filtered or unexported fields
}
HostnameFact is a function that returns the hostname. TODO: support hostnames that change in the future.
func (*HostnameFact) Info ¶
func (obj *HostnameFact) Info() *facts.Info
Info returns some static info about itself.
func (*HostnameFact) Init ¶
func (obj *HostnameFact) Init(init *facts.Init) error
Init runs some startup code for this fact.
func (*HostnameFact) Stream ¶
func (obj *HostnameFact) Stream(ctx context.Context) error
Stream returns the single value that this fact has, and then closes.
func (*HostnameFact) String ¶
func (obj *HostnameFact) String() string
String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.
type LoadFact ¶
type LoadFact struct {
// contains filtered or unexported fields
}
LoadFact is a fact which returns the current system load.
type UptimeFact ¶
type UptimeFact struct {
// contains filtered or unexported fields
}
UptimeFact is a fact which returns the current uptime of your system.
func (*UptimeFact) Info ¶
func (obj *UptimeFact) Info() *facts.Info
Info returns some static info about itself.
func (*UptimeFact) Init ¶
func (obj *UptimeFact) Init(init *facts.Init) error
Init runs some startup code for this fact.
func (*UptimeFact) Stream ¶
func (obj *UptimeFact) Stream(ctx context.Context) error
Stream returns the changing values that this fact has over time.
func (*UptimeFact) String ¶
func (obj *UptimeFact) String() string
String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.