Documentation ¶
Overview ¶
Package libsysd is a simple wrapper on top of go-systemd module
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // EventsOut is a channel where systemd events are being pushed EventsOut = make(chan *SystemDEvent) // ErrCh is a channel where any errors are pushed ErrCh = make(chan error) )
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface { ListUnitsByPattern(states, patterns []string) ([]dbus.UnitStatus, error) GetPropertiesForUnit(unit string) (map[string]interface{}, error) GetPropertiesForAUnitType(unit, unitType string) (map[string]interface{}, error) GetPropertyForService(unitName, propertyName string) (*dbus.Property, error) RestartService(serviceName string) (*dbus.UnitStatus, error) StartService(serviceName string) error StopService(serviceName string) error ReloadService(serviceName string) error SubscribeToUnitProperties(sysEventCh chan *dbus.PropertiesUpdate, errCh chan error) error GetVersion() (int, error) ReloadDaemon() error Close() }
Adapter implements a systemd adapter
func NewSystemDAdapter ¶
func NewSystemDAdapter() Adapter
NewSystemDAdapter provides a new systemd adapter
type SystemDEvent ¶
type SystemDEvent struct { Timestamp int64 // Timestamp of when did we receive the event PropertyUpdate map[string]interface{} // Property systemd property name:value/systemd property values map UnitName string // UnitName of the systemd service Hostname string // Hostname of the current machine }
SystemDEvent represents a single systemd service event
type Watcher ¶
type Watcher interface { // Poll method will poll for the systemd properties at a certain interval Poll(opts ...WatcherOps) // Sub method is an event based method. // If and only if there is an event occurred in the systemd managed services these will be captured by this method Sub(opts ...WatcherOps) }
Watcher implements a watch mechanism with poll and sub functions
type WatcherOps ¶
type WatcherOps func(*watcher)
WatcherOps sets optional parameters to a watcher
func WithHostNameMethod ¶
func WithHostNameMethod(method string) WatcherOps
WithHostNameMethod sets the hostname method used to get the machine hostname Valid methods are "RFQDN", "FQDN", "OS" and "CMD" Uses: github.com/acceldata-io/goutils/netutils
func WithMetricsBufferLimit ¶
func WithMetricsBufferLimit(limit int64) WatcherOps
WithMetricsBufferLimit set buffer limit for the number of systemd events
func WithPollInterval ¶
func WithPollInterval(interval int64) WatcherOps
WithPollInterval sets poll interval
Click to show internal directories.
Click to hide internal directories.