Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPluginName ¶
func GetPluginName(myvar interface{}) string
GetPluginName is a helper function to return the class name nicely formatted for use in the Name function
func OneShotReport ¶
func OneShotReport(p Plugin, facts chan<- ReportedFact)
OneShotReport is a wrapper for getting facts and wrapping them in a reported fact usually called in a plugin from the Report function
func PollingReport ¶
func PollingReport(p Plugin, facts chan<- ReportedFact)
PollingReport is a helper function for providing polling report data TODO - make poll time an option
Types ¶
type Plugin ¶
type Plugin interface { // Name returns the plugin name, as a string // commonly used as the reference on the cli or in config files Name() string // Return a map of facts, keyed by string // This can be called independently of Report Facts() (common.FactList, error) // The report function will be called in a goroutine and is expected to pass a ReportedFact to the channel // If your report is a one off event and should not wait or poll the data will be persisted to the facts data for the duration of the run // Usually Report is a wrapper for Fact, creating an object it can write to a channel // A standard implementation of this would be // func (p *MyPlugin)Report(facts chan<- plugin.ReportedFact){ // plugin.PollingReport(p,facts) // } Report(facts chan<- ReportedFact) }
Plugin interface represents a set of facts grouped under a common name
type ReportedFact ¶
type ReportedFact struct { // Top level key associated with this fact. Usually Plugin.Name() Parent string // A list of facts to be reported Facts common.FactList }
ReportedFact represents a fact value Because the reported fact is decoupled from its (potential) parent you need to specify the parent key in the fact report The interface type returned must match the interface type returned by the plugin Facts() method
type Version ¶
type Version struct{}
The Version plugin provides information about the factd version number
func (*Version) Name ¶
Name returns the plugin printable name, also used as the map key in the master fact list
func (*Version) Report ¶
func (p *Version) Report(facts chan<- ReportedFact)
Report writes a set (or subset) of facts to a channel