devops

package
v0.98.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package devops implements the multi-provider devops capability aggregator.

Index

Constants

View Source
const (
	OpHealth                  = "health"
	OpStatus                  = "status"
	OpBeszelListSystems       = "beszel_list_systems"
	OpBeszelGetSystem         = "beszel_get_system"
	OpUptimekumaHealth        = "uptimekuma_health"
	OpUptimekumaMetrics       = "uptimekuma_metrics"
	OpTraefikOverview         = "traefik_overview"
	OpTraefikListRouters      = "traefik_list_routers"
	OpTraefikListServices     = "traefik_list_services"
	OpGrafanaHealth           = "grafana_health"
	OpGrafanaListDatasources  = "grafana_list_datasources"
	OpGrafanaSearchDashboards = "grafana_search_dashboards"
	OpGrafanaQuery            = "grafana_query"
	OpWakapiSummary           = "wakapi_summary"
	OpWakapiListProjects      = "wakapi_list_projects"
	OpDozzleHealth            = "dozzle_health"
	OpNetalertxHealth         = "netalertx_health"
	OpNetalertxListDevices    = "netalertx_list_devices"
	OpNetalertxTotals         = "netalertx_totals"
	OpNetalertxSearchDevices  = "netalertx_search_devices"
)

Variables

This section is empty.

Functions

func Register

func Register(app string, svc Service) error

Register registers the devops capability with hub and invoker registry. When svc is nil no devops provider is configured and registration is skipped.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter implements Service using optional provider clients.

func (*Adapter) BeszelGetSystem

func (a *Adapter) BeszelGetSystem(ctx context.Context, in GetSystemInput) (*capability.DevopsSystem, error)

BeszelGetSystem returns one Beszel system.

func (*Adapter) BeszelListSystems

func (a *Adapter) BeszelListSystems(ctx context.Context) (*capability.ListResult[capability.DevopsSystem], error)

BeszelListSystems lists Beszel systems.

func (*Adapter) DozzleHealth

func (a *Adapter) DozzleHealth(ctx context.Context) (*capability.DevopsDozzleInfo, error)

DozzleHealth checks Dozzle and returns version when available.

func (*Adapter) GrafanaHealth

func (a *Adapter) GrafanaHealth(ctx context.Context) (*capability.DevopsGrafanaHealth, error)

GrafanaHealth returns Grafana health.

func (*Adapter) GrafanaListDatasources

func (a *Adapter) GrafanaListDatasources(ctx context.Context) (*capability.ListResult[capability.DevopsDatasource], error)

GrafanaListDatasources lists Grafana datasources.

func (*Adapter) GrafanaQuery

GrafanaQuery runs a query against prometheus/alloy/loki/tempo/pyroscope via Grafana.

func (*Adapter) GrafanaSearchDashboards

GrafanaSearchDashboards searches Grafana dashboards.

func (*Adapter) HealthCheck

func (a *Adapter) HealthCheck(ctx context.Context) (bool, error)

HealthCheck probes configured backends that expose a health endpoint. Returns true when at least one such backend is configured and all of them succeed.

func (*Adapter) NetalertxHealth

func (a *Adapter) NetalertxHealth(ctx context.Context) error

NetalertxHealth checks NetAlertX reachability.

func (*Adapter) NetalertxListDevices

NetalertxListDevices lists NetAlertX devices.

func (*Adapter) NetalertxSearchDevices

NetalertxSearchDevices searches NetAlertX devices.

func (*Adapter) NetalertxTotals

func (a *Adapter) NetalertxTotals(ctx context.Context) (*capability.DevopsNetalertxTotals, error)

NetalertxTotals returns NetAlertX device category counts.

func (*Adapter) Status

func (a *Adapter) Status(ctx context.Context) (*capability.DevopsStatus, error)

Status reports which backends are configured.

func (*Adapter) TraefikListRouters

func (a *Adapter) TraefikListRouters(ctx context.Context) (*capability.ListResult[capability.DevopsRouter], error)

TraefikListRouters lists Traefik HTTP routers.

func (*Adapter) TraefikListServices

func (a *Adapter) TraefikListServices(ctx context.Context) (*capability.ListResult[capability.DevopsService], error)

TraefikListServices lists Traefik HTTP services.

func (*Adapter) TraefikOverview

func (a *Adapter) TraefikOverview(ctx context.Context) (*capability.DevopsTraefikOverview, error)

TraefikOverview returns Traefik overview counts.

func (*Adapter) UptimekumaHealth

func (a *Adapter) UptimekumaHealth(ctx context.Context) error

UptimekumaHealth checks Uptime Kuma metrics reachability.

func (*Adapter) UptimekumaMetrics

UptimekumaMetrics returns summarized Prometheus metric families.

func (*Adapter) WakapiListProjects

WakapiListProjects lists Wakapi projects.

func (*Adapter) WakapiSummary

func (a *Adapter) WakapiSummary(ctx context.Context, in SummaryInput) (*capability.DevopsWakapiSummary, error)

WakapiSummary returns a coding-stats summary.

type Clients

type Clients struct {
	Beszel     beszelClient
	Uptimekuma uptimekumaClient
	Traefik    traefikClient
	Grafana    grafanaClient
	Wakapi     wakapiClient
	Dozzle     dozzleClient
	Netalertx  netalertxClient
}

Clients holds optional provider clients for constructing an Adapter in tests.

type GetSystemInput

type GetSystemInput struct {
	ID string
}

GetSystemInput holds parameters for fetching a Beszel system.

type GrafanaQueryInput

type GrafanaQueryInput struct {
	Backend       string
	Expr          string
	DatasourceUID string
	From          string
	To            string
	MaxLines      int
}

GrafanaQueryInput holds parameters for a Grafana observability backend query.

type SearchDashboardsInput

type SearchDashboardsInput struct {
	Query string
}

SearchDashboardsInput holds parameters for Grafana dashboard search.

type SearchDevicesInput

type SearchDevicesInput struct {
	Query string
}

SearchDevicesInput holds parameters for NetAlertX device search.

type Service

type Service interface {
	HealthCheck(ctx context.Context) (bool, error)
	Status(ctx context.Context) (*capability.DevopsStatus, error)

	BeszelListSystems(ctx context.Context) (*capability.ListResult[capability.DevopsSystem], error)
	BeszelGetSystem(ctx context.Context, in GetSystemInput) (*capability.DevopsSystem, error)

	UptimekumaHealth(ctx context.Context) error
	UptimekumaMetrics(ctx context.Context) (*capability.ListResult[capability.DevopsMetricFamily], error)

	TraefikOverview(ctx context.Context) (*capability.DevopsTraefikOverview, error)
	TraefikListRouters(ctx context.Context) (*capability.ListResult[capability.DevopsRouter], error)
	TraefikListServices(ctx context.Context) (*capability.ListResult[capability.DevopsService], error)

	GrafanaHealth(ctx context.Context) (*capability.DevopsGrafanaHealth, error)
	GrafanaListDatasources(ctx context.Context) (*capability.ListResult[capability.DevopsDatasource], error)
	GrafanaSearchDashboards(ctx context.Context, in SearchDashboardsInput) (*capability.ListResult[capability.DevopsDashboard], error)
	GrafanaQuery(ctx context.Context, in GrafanaQueryInput) (*capability.DevopsGrafanaQueryResult, error)

	WakapiSummary(ctx context.Context, in SummaryInput) (*capability.DevopsWakapiSummary, error)
	WakapiListProjects(ctx context.Context) (*capability.ListResult[capability.DevopsWakapiProject], error)

	DozzleHealth(ctx context.Context) (*capability.DevopsDozzleInfo, error)

	NetalertxHealth(ctx context.Context) error
	NetalertxListDevices(ctx context.Context) (*capability.ListResult[capability.DevopsNetalertxDevice], error)
	NetalertxTotals(ctx context.Context) (*capability.DevopsNetalertxTotals, error)
	NetalertxSearchDevices(ctx context.Context, in SearchDevicesInput) (*capability.ListResult[capability.DevopsNetalertxDevice], error)
}

Service defines the devops aggregator capability contract.

func New

func New() Service

New creates an Adapter from configured providers. Returns nil when no devops provider is configured.

func NewWithClients

func NewWithClients(c Clients) Service

NewWithClients creates an Adapter from explicit clients (for tests). Returns nil when every client is nil.

type SummaryInput

type SummaryInput struct {
	Interval string
}

SummaryInput holds parameters for Wakapi summary.

Jump to

Keyboard shortcuts

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