Documentation ¶
Index ¶
- Constants
- Variables
- type ArchFingerprint
- type CPUFingerprint
- type ConsulFingerprint
- type DefaultNetworkInterfaceDetector
- type EnvAWSFingerprint
- type EnvGCEFingerprint
- type Factory
- type Fingerprint
- func NewArchFingerprint(logger *log.Logger) Fingerprint
- func NewCPUFingerprint(logger *log.Logger) Fingerprint
- func NewConsulFingerprint(logger *log.Logger) Fingerprint
- func NewEnvAWSFingerprint(logger *log.Logger) Fingerprint
- func NewEnvGCEFingerprint(logger *log.Logger) Fingerprint
- func NewFingerprint(name string, logger *log.Logger) (Fingerprint, error)
- func NewHostFingerprint(logger *log.Logger) Fingerprint
- func NewMemoryFingerprint(logger *log.Logger) Fingerprint
- func NewNetworkFingerprinter(logger *log.Logger) Fingerprint
- func NewStorageFingerprint(logger *log.Logger) Fingerprint
- type GCEMetadataNetworkInterface
- type HostFingerprint
- type MemoryFingerprint
- type NetworkFingerprint
- type NetworkInterfaceDetector
- type ReqError
- type StaticFingerprinter
- type StorageFingerprint
Constants ¶
const DEFAULT_AWS_URL = "http://169.254.169.254/latest/meta-data/"
This is where the AWS metadata server normally resides. We hardcode the "instance" path as well since it's the only one we access here.
const DEFAULT_GCE_URL = "http://169.254.169.254/computeMetadata/v1/instance/"
This is where the GCE metadata server normally resides. We hardcode the "instance" path as well since it's the only one we access here.
const EmptyDuration = time.Duration(0)
EmptyDuration is to be used by fingerprinters that are not periodic.
Variables ¶
var BuiltinFingerprints = []string{
"arch",
"consul",
"cpu",
"env_aws",
"env_gce",
"host",
"memory",
"network",
"storage",
}
BuiltinFingerprints is a slice containing the key names of all regestered fingerprints available, to provided an ordered iteration
Functions ¶
This section is empty.
Types ¶
type ArchFingerprint ¶
type ArchFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
ArchFingerprint is used to fingerprint the architecture
func (*ArchFingerprint) Fingerprint ¶
type CPUFingerprint ¶
type CPUFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
CPUFingerprint is used to fingerprint the CPU
func (*CPUFingerprint) Fingerprint ¶
type ConsulFingerprint ¶
type ConsulFingerprint struct {
// contains filtered or unexported fields
}
ConsulFingerprint is used to fingerprint the architecture
func (*ConsulFingerprint) Fingerprint ¶
type DefaultNetworkInterfaceDetector ¶ added in v0.2.0
type DefaultNetworkInterfaceDetector struct { }
Implements the interface detector which calls net directly
func (*DefaultNetworkInterfaceDetector) InterfaceByName ¶ added in v0.2.0
func (b *DefaultNetworkInterfaceDetector) InterfaceByName(name string) (*net.Interface, error)
func (*DefaultNetworkInterfaceDetector) Interfaces ¶ added in v0.2.0
func (b *DefaultNetworkInterfaceDetector) Interfaces() ([]net.Interface, error)
type EnvAWSFingerprint ¶
type EnvAWSFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
EnvAWSFingerprint is used to fingerprint AWS metadata
func (*EnvAWSFingerprint) Fingerprint ¶
type EnvGCEFingerprint ¶ added in v0.2.0
type EnvGCEFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
EnvGCEFingerprint is used to fingerprint GCE metadata
func (*EnvGCEFingerprint) Fingerprint ¶ added in v0.2.0
type Factory ¶
type Factory func(*log.Logger) Fingerprint
Factory is used to instantiate a new Fingerprint
type Fingerprint ¶
type Fingerprint interface { // Fingerprint is used to update properties of the Node, // and returns if the fingerprint was applicable and a potential error. Fingerprint(*config.Config, *structs.Node) (bool, error) // Periodic is a mechanism for the fingerprinter to indicate that it should // be run periodically. The return value is a boolean indicating if it // should be periodic, and if true, a duration. Periodic() (bool, time.Duration) }
Fingerprint is used for doing "fingerprinting" of the host to automatically determine attributes, resources, and metadata about it. Each of these is a heuristic, and many of them can be applied on a particular host.
func NewArchFingerprint ¶
func NewArchFingerprint(logger *log.Logger) Fingerprint
NewArchFingerprint is used to create an OS fingerprint
func NewCPUFingerprint ¶
func NewCPUFingerprint(logger *log.Logger) Fingerprint
NewCPUFingerprint is used to create a CPU fingerprint
func NewConsulFingerprint ¶
func NewConsulFingerprint(logger *log.Logger) Fingerprint
NewConsulFingerprint is used to create an OS fingerprint
func NewEnvAWSFingerprint ¶
func NewEnvAWSFingerprint(logger *log.Logger) Fingerprint
NewEnvAWSFingerprint is used to create a fingerprint from AWS metadata
func NewEnvGCEFingerprint ¶ added in v0.2.0
func NewEnvGCEFingerprint(logger *log.Logger) Fingerprint
NewEnvGCEFingerprint is used to create a fingerprint from GCE metadata
func NewFingerprint ¶
func NewFingerprint(name string, logger *log.Logger) (Fingerprint, error)
NewFingerprint is used to instantiate and return a new fingerprint given the name and a logger
func NewHostFingerprint ¶
func NewHostFingerprint(logger *log.Logger) Fingerprint
NewHostFingerprint is used to create a Host fingerprint
func NewMemoryFingerprint ¶
func NewMemoryFingerprint(logger *log.Logger) Fingerprint
NewMemoryFingerprint is used to create a Memory fingerprint
func NewNetworkFingerprinter ¶
func NewNetworkFingerprinter(logger *log.Logger) Fingerprint
NewNetworkFingerprinter returns a new NetworkFingerprinter with the given logger
func NewStorageFingerprint ¶
func NewStorageFingerprint(logger *log.Logger) Fingerprint
type GCEMetadataNetworkInterface ¶ added in v0.2.0
type HostFingerprint ¶
type HostFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
HostFingerprint is used to fingerprint the host
func (*HostFingerprint) Fingerprint ¶
type MemoryFingerprint ¶
type MemoryFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
MemoryFingerprint is used to fingerprint the available memory on the node
func (*MemoryFingerprint) Fingerprint ¶
type NetworkFingerprint ¶
type NetworkFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
NetworkFingerprint is used to fingerprint the Network capabilities of a node
func (*NetworkFingerprint) Fingerprint ¶
type NetworkInterfaceDetector ¶ added in v0.2.0
type NetworkInterfaceDetector interface { Interfaces() ([]net.Interface, error) InterfaceByName(name string) (*net.Interface, error) Addrs(intf *net.Interface) ([]net.Addr, error) }
An interface to isolate calls to various api in net package This facilitates testing where we can implement fake interfaces and addresses to test varios code paths
type StaticFingerprinter ¶ added in v0.2.0
type StaticFingerprinter struct{}
StaticFingerprinter can be embeded in a struct that has a Fingerprint method to make it non-periodic.
type StorageFingerprint ¶
type StorageFingerprint struct { StaticFingerprinter // contains filtered or unexported fields }
StorageFingerprint is used to measure the amount of storage free for applications that the Nomad agent will run on this machine.