devops

package
v0.99.12 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: GPL-3.0 Imports: 16 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"
	OpWakapiHealth            = "wakapi_health"
	OpWakapiSummary           = "wakapi_summary"
	OpWakapiListProjects      = "wakapi_list_projects"
	OpWakapiAllTime           = "wakapi_all_time"
	OpDozzleHealth            = "dozzle_health"
	OpNetalertxHealth         = "netalertx_health"
	OpNetalertxListDevices    = "netalertx_list_devices"
	OpNetalertxTotals         = "netalertx_totals"
	OpNetalertxSearchDevices  = "netalertx_search_devices"
	OpScanopyHealth           = "scanopy_health"
	OpScanopyVersion          = "scanopy_version"
	OpScanopyListNetworks     = "scanopy_list_networks"
	OpScanopyListHosts        = "scanopy_list_hosts"
	OpScanopyGetHost          = "scanopy_get_host"
	OpScanopyListServices     = "scanopy_list_services"
	OpScanopyListDaemons      = "scanopy_list_daemons"
)

Variables

This section is empty.

Functions

func CatalogSpec added in v0.98.2

func CatalogSpec() capability.Spec

CatalogSpec returns capability metadata for documentation (handlers may close over a nil service and must not be invoked).

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 added in v0.97.0

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) ScanopyGetHost added in v0.99.9

ScanopyGetHost returns a Scanopy host by ID.

func (*Adapter) ScanopyHealth added in v0.99.9

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

ScanopyHealth checks Scanopy reachability.

func (*Adapter) ScanopyListDaemons added in v0.99.9

ScanopyListDaemons lists Scanopy daemons.

func (*Adapter) ScanopyListHosts added in v0.99.9

ScanopyListHosts lists Scanopy hosts.

func (*Adapter) ScanopyListNetworks added in v0.99.9

ScanopyListNetworks lists Scanopy networks.

func (*Adapter) ScanopyListServices added in v0.99.9

ScanopyListServices lists Scanopy services.

func (*Adapter) ScanopyVersion added in v0.99.9

func (a *Adapter) ScanopyVersion(ctx context.Context) (*capability.DevopsScanopyVersion, error)

ScanopyVersion returns Scanopy API and server versions.

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) WakapiAllTime added in v0.99.9

func (a *Adapter) WakapiAllTime(ctx context.Context) (*capability.DevopsWakapiAllTime, error)

WakapiAllTime returns cumulative coding time since account creation.

func (*Adapter) WakapiHealth added in v0.99.9

func (a *Adapter) WakapiHealth(ctx context.Context) (*capability.DevopsWakapiHealth, error)

WakapiHealth checks Wakapi application health.

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
	Scanopy    scanopyClient
}

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 ListProjectsInput added in v0.99.9

type ListProjectsInput struct {
	Query string
}

ListProjectsInput holds parameters for Wakapi project list.

type ScanopyGetHostInput added in v0.99.9

type ScanopyGetHostInput struct {
	ID string
}

ScanopyGetHostInput holds parameters for fetching a Scanopy host.

type ScanopyListInput added in v0.99.9

type ScanopyListInput struct {
	NetworkID string
	HostID    string
	Search    string
	Limit     int
	Cursor    string
}

ScanopyListInput holds shared Scanopy list filters.

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)

	WakapiHealth(ctx context.Context) (*capability.DevopsWakapiHealth, error)
	WakapiSummary(ctx context.Context, in SummaryInput) (*capability.DevopsWakapiSummary, error)
	WakapiAllTime(ctx context.Context) (*capability.DevopsWakapiAllTime, error)
	WakapiListProjects(ctx context.Context, in ListProjectsInput) (*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)

	ScanopyHealth(ctx context.Context) error
	ScanopyVersion(ctx context.Context) (*capability.DevopsScanopyVersion, error)
	ScanopyListNetworks(ctx context.Context, in ScanopyListInput) (*capability.ListResult[capability.DevopsScanopyNetwork], error)
	ScanopyListHosts(ctx context.Context, in ScanopyListInput) (*capability.ListResult[capability.DevopsScanopyHost], error)
	ScanopyGetHost(ctx context.Context, in ScanopyGetHostInput) (*capability.DevopsScanopyHost, error)
	ScanopyListServices(ctx context.Context, in ScanopyListInput) (*capability.ListResult[capability.DevopsScanopyService], error)
	ScanopyListDaemons(ctx context.Context, in ScanopyListInput) (*capability.ListResult[capability.DevopsScanopyDaemon], 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
	Project  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