f5

package
v2.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HealthStatusOnline    = "ONLINE"
	HealthStatusDegraded  = "DEGRADED"
	HealthStatusOffline   = "OFFLINE"
	HealthStatusUnchecked = "UNCHECKED"
)

Health status constants matching the API enum

Variables

This section is empty.

Functions

func ComputePoolHealthStatus

func ComputePoolHealthStatus(stats *bigip.PoolMemberStatsResponse) string

ComputePoolHealthStatus computes the aggregate health status from pool member stats. Returns ONLINE if all members are up, OFFLINE if all are down, DEGRADED if mixed, and UNCHECKED if no members or status unknown.

func ComputeServiceHealth

func ComputeServiceHealth(portStatuses []string) string

ComputeServiceHealth aggregates health across all port statuses using "worst wins" strategy. Priority: OFFLINE > DEGRADED > UNCHECKED > ONLINE

Types

type Agent

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

func NewAgent

func NewAgent() *Agent

func (*Agent) CleanupL2

func (a *Agent) CleanupL2(ctx context.Context, segmentID int) error

CleanupL2 cleans up L2 configuration on BIG-IP(s) and VCMP(s) for the given segmentID.

func (*Agent) CleanupSelfIPs

func (a *Agent) CleanupSelfIPs(ctx context.Context, subnetID string) error

func (*Agent) EnsureL2

func (a *Agent) EnsureL2(ctx context.Context, segmentID int, parentSegmentID *int, mtu int) error

EnsureL2 ensures that L2 configuration exists on BIG-IP Guest(s) and Host(s) for the given segmentID.

func (*Agent) EnsureSelfIPs

func (a *Agent) EnsureSelfIPs(ctx context.Context, subnetID string, dryRun bool) error

EnsureSelfIPs ensures that a SelfIPs exists on the BIG-IP(s) for a given subnet.

func (*Agent) GetPool

func (a *Agent) GetPool() db.PgxIface

func (*Agent) GetScheduler

func (a *Agent) GetScheduler() gocron.Scheduler

func (*Agent) HealthScrapeLoop

func (a *Agent) HealthScrapeLoop() error

HealthScrapeLoop is the main loop that scrapes health status for all available services. It distributes individual service scrapes evenly within the scrape interval.

func (*Agent) PendingSyncLoop

func (a *Agent) PendingSyncLoop() error

func (*Agent) ProcessEndpoint

func (a *Agent) ProcessEndpoint(ctx context.Context, endpointID strfmt.UUID) error

func (*Agent) ProcessServices

func (a *Agent) ProcessServices(ctx context.Context) error

func (*Agent) Run

func (a *Agent) Run()

func (*Agent) ScrapeServiceHealth

func (a *Agent) ScrapeServiceHealth(ctx context.Context, service *models.Service) string

ScrapeServiceHealth queries the F5 device for all pools of a service and computes aggregate health.

func (*Agent) ScrapeServiceHealthPrometheus

func (a *Agent) ScrapeServiceHealthPrometheus(ctx context.Context, service *models.Service) string

ScrapeServiceHealthPrometheus queries Prometheus for pool health status using SNMP metrics.

func (*Agent) UpdateHeartbeat

func (a *Agent) UpdateHeartbeat()

UpdateHeartbeat updates the agent's heartbeat in the database.

func (*Agent) UpdateServiceHealthStatus

func (a *Agent) UpdateServiceHealthStatus(ctx context.Context, serviceID strfmt.UUID, status string) error

UpdateServiceHealthStatus updates the health_status column for a service in the database.

type F5Device

type F5Device interface {
	// PostAS3 posts AS3 configuration to the device.
	PostAS3(as3 *as3.AS3, tenant string) error

	// GetDeviceType returns the type of the F5 device (e.g., "bigip", "f5os").
	GetDeviceType() string

	// GetHostname returns the hostname of the F5 device.
	GetHostname() string

	// GetFailoverState returns the failover state of the device.
	// It should return a string indicating the state, such as "active", "standby", or "unknown".
	GetFailoverState() string

	// GetPartitions returns a list of partitions on the F5 device.
	GetPartitions() ([]string, error)

	// GetVLANs returns a list of VLANs on the F5 device.
	GetVLANs() ([]string, error)

	// GetRouteDomains returns a list of route domains on the F5 device.
	GetRouteDomains() ([]string, error)

	// GetSelfIPs returns a list of self IPs on the F5 device.
	GetSelfIPs() ([]string, error)

	// EnsureVLAN ensures that a VLAN with the given segment ID and MTU exists on the device.
	EnsureVLAN(segmentId int, mtu int) error

	// EnsureInterfaceVlan ensures that the interface VLAN for the given segment ID exists on the device.
	EnsureInterfaceVlan(segmentId int) error

	// EnsureGuestVlan ensures that the guest VLAN for the given segment ID exists on the device.
	EnsureGuestVlan(segmentId int) error

	// EnsureRouteDomain ensures that a route domain with the given segment ID and
	// optional parent segment ID exists on the device.
	EnsureRouteDomain(segmentId int, parentSegmentID *int) error

	// EnsureBigIPSelfIP ensures that a self IP with the given name, address and segment ID exists on the device.
	EnsureBigIPSelfIP(name, address string, segmentId int) error

	// SyncGuestVLANs syncs the guest VLANs based on the provided used segments.
	SyncGuestVLANs(usedSegments map[int]string) error

	// DeleteVLAN deletes a VLAN with the given segment id from the F5 device.
	DeleteVLAN(segmentId int) error

	// DeleteSelfIP cleans up the self IP with the given name on the device.
	DeleteSelfIP(name string) error

	// DeleteGuestVLAN cleans up the guest VLAN for the given segment ID.
	DeleteGuestVLAN(segmentId int) error

	// DeleteRouteDomain cleans up the route domain for the given segment ID.
	DeleteRouteDomain(segmentId int) error
}

F5Device defines the interface for interacting with F5 appliances.

func GetF5DeviceSession

func GetF5DeviceSession(rawURL string) (F5Device, error)

type PrometheusQueryResponse

type PrometheusQueryResponse struct {
	Status string `json:"status"`
	Data   struct {
		ResultType string `json:"resultType"`
		Result     []struct {
			Metric map[string]string `json:"metric"`
			Value  []any             `json:"value"` // [timestamp, value]
		} `json:"result"`
	} `json:"data"`
}

PrometheusQueryResponse represents the response from Prometheus /api/v1/query

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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