server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client for communicating with remote Watchdog agents.

func NewClient

func NewClient(baseURL, token string, insecureSkipVerify bool) *Client

NewClient creates a new remote Watchdog agent client.

func (*Client) FetchAlerts

func (c *Client) FetchAlerts(ctx context.Context) ([]model.AlertEvent, error)

FetchAlerts fetches active alerts from the remote agent.

func (*Client) FetchDiagnostics

func (c *Client) FetchDiagnostics(ctx context.Context) (*model.DiagnosticReport, error)

FetchDiagnostics fetches the latest DiagnosticReport from the remote agent.

func (*Client) FetchSnapshot

func (c *Client) FetchSnapshot(ctx context.Context) (*model.SystemSnapshot, error)

FetchSnapshot fetches a live SystemSnapshot from the remote agent.

func (*Client) GetHealth

func (c *Client) GetHealth(ctx context.Context) (map[string]interface{}, error)

GetHealth checks remote agent health status.

type PrometheusExporter

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

PrometheusExporter generates Prometheus-compatible metrics from snapshots and reports.

func NewPrometheusExporter

func NewPrometheusExporter() *PrometheusExporter

NewPrometheusExporter creates a new exporter instance.

func (*PrometheusExporter) Handler

func (e *PrometheusExporter) Handler() http.HandlerFunc

Handler returns an HTTP handler for serving Prometheus metrics.

func (*PrometheusExporter) RenderMetrics

func (e *PrometheusExporter) RenderMetrics() string

RenderMetrics renders the Prometheus text exposition format.

func (*PrometheusExporter) Update

func (e *PrometheusExporter) Update(
	snap *model.SystemSnapshot,
	diag *model.DiagnosticReport,
	alerts []model.AlertEvent,
	anomalies *model.AnomalyReport,
)

Update updates the exporter with the latest system data.

type Server

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

Server represents the Watchdog HTTP API server / remote agent.

func NewServer

func NewServer(
	cfg *config.Config,
	col *collector.Manager,
	store storage.Storage,
	diagEng *diagnostics.Engine,
	alertEng *alerts.Engine,
	anomDet *anomaly.Detector,
) *Server

NewServer initializes a new Server.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start runs the HTTP server and background collection worker until ctx is cancelled.

Jump to

Keyboard shortcuts

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