systemd

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package systemd tracks the systemd state and unit files.

Index

Constants

View Source
const (
	StateNameSystemd       = "systemd"
	StateKeySystemdVersion = "version"

	StateNameUnit               = "unit"
	StateKeyUnitName            = "name"
	StateKeyUnitActive          = "active"
	StateKeyUnitUptimeSeconds   = "uptime_seconds"
	StateKeyUnitUptimeHumanized = "uptime_humanized"
)
View Source
const Name = "systemd"

Variables

This section is empty.

Functions

func CloseDefaultDbusConn

func CloseDefaultDbusConn()

func ConnectDbus

func ConnectDbus() error

func CreateGet

func CreateGet(cfg Config) query.GetFunc

func GetDefaultDbusConn

func GetDefaultDbusConn() *systemd.DbusConn

func New

Types

type Config

type Config struct {
	Query query_config.Config `json:"query"`
	Units []string            `json:"units"`
}

func DefaultConfig

func DefaultConfig() Config

func ParseConfig

func ParseConfig(b any, db *sql.DB) (*Config, error)

func (Config) Validate

func (cfg Config) Validate() error

type Output

type Output struct {
	SystemdVersion string `json:"systemd_version"`
	Units          []Unit `json:"units"`
}

func ParseOutputJSON

func ParseOutputJSON(data []byte) (*Output, error)

func ParseStateSystemd

func ParseStateSystemd(m map[string]string) (*Output, error)

func ParseStatesToOutput

func ParseStatesToOutput(states ...components.State) (*Output, error)

func (*Output) JSON

func (o *Output) JSON() ([]byte, error)

func (*Output) States

func (o *Output) States() ([]components.State, error)

type Unit

type Unit struct {
	Name            string `json:"name"`
	Active          bool   `json:"active"`
	UptimeSeconds   int64  `json:"uptime_seconds"`
	UptimeHumanized string `json:"uptime_humanized"`
}

func ParseStateUnit

func ParseStateUnit(m map[string]string) (Unit, error)

Jump to

Keyboard shortcuts

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