systemd

package
v0.0.0-...-ede35a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package systemd facilitates systemd status queries via dbus.

Index

Constants

View Source
const (
	ConditionNeutral = 0
	ConditionHealthy = 1
	ConditionBad     = 2
)

Condition values.

Variables

View Source
var ErrNotSupported = errors.New("not supported on systems without systemd")

ErrNotSupported is returned by calls on systems that don't support the systemd.

Functions

This section is empty.

Types

type Condition

type Condition int8

Condition indicates the health of a particular systemd state.

type UnitStatus

type UnitStatus struct {
	Name                   string
	Description            string
	LoadState              string
	ActiveState            string
	SubState               string
	InactiveExitTimestamp  time.Time
	ActiveEnterTimestamp   time.Time
	ActiveExitTimestamp    time.Time
	InactiveEnterTimestamp time.Time
}

UnitStatus describes the current status of a machina systemd unit.

func ListUnitStatuses

func ListUnitStatuses(ctx context.Context, units ...string) ([]UnitStatus, error)

ListUnitStatuses returns a slice of systemd unit status entries, one for each requested unit.

func (UnitStatus) ActiveStateCondition

func (s UnitStatus) ActiveStateCondition() Condition

ActiveStateCondition returns an evaluation of the unit's active state.

func (UnitStatus) Duration

func (s UnitStatus) Duration() time.Duration

Duration returns the duration of the current status condition.

func (UnitStatus) LoadStateCondition

func (s UnitStatus) LoadStateCondition() Condition

LoadStateCondition returns an evaluation of the unit's load state.

func (UnitStatus) State

func (s UnitStatus) State() string

State returns a string describing the state of the unit.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL