Documentation
¶
Index ¶
- Constants
- func ComputePoolHealthStatus(stats *bigip.PoolMemberStatsResponse) string
- func ComputeServiceHealth(portStatuses []string) string
- type Agent
- func (a *Agent) CleanupL2(ctx context.Context, segmentID int) error
- func (a *Agent) CleanupSelfIPs(ctx context.Context, subnetID string) error
- func (a *Agent) EnsureL2(ctx context.Context, segmentID int, parentSegmentID *int, mtu int) error
- func (a *Agent) EnsureSelfIPs(ctx context.Context, subnetID string, dryRun bool) error
- func (a *Agent) GetPool() db.PgxIface
- func (a *Agent) GetScheduler() gocron.Scheduler
- func (a *Agent) HealthScrapeLoop() error
- func (a *Agent) PendingSyncLoop() error
- func (a *Agent) ProcessEndpoint(ctx context.Context, endpointID strfmt.UUID) error
- func (a *Agent) ProcessServices(ctx context.Context) error
- func (a *Agent) Run()
- func (a *Agent) ScrapeServiceHealth(ctx context.Context, service *models.Service) string
- func (a *Agent) ScrapeServiceHealthPrometheus(ctx context.Context, service *models.Service) string
- func (a *Agent) UpdateHeartbeat()
- func (a *Agent) UpdateServiceHealthStatus(ctx context.Context, serviceID strfmt.UUID, status string) error
- type F5Device
- type PrometheusQueryResponse
Constants ¶
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 ¶
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 (*Agent) CleanupL2 ¶
CleanupL2 cleans up L2 configuration on BIG-IP(s) and VCMP(s) for the given segmentID.
func (*Agent) CleanupSelfIPs ¶
func (*Agent) EnsureL2 ¶
EnsureL2 ensures that L2 configuration exists on BIG-IP Guest(s) and Host(s) for the given segmentID.
func (*Agent) EnsureSelfIPs ¶
EnsureSelfIPs ensures that a SelfIPs exists on the BIG-IP(s) for a given subnet.
func (*Agent) GetScheduler ¶
func (*Agent) HealthScrapeLoop ¶
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 (*Agent) ProcessEndpoint ¶
func (*Agent) ScrapeServiceHealth ¶
ScrapeServiceHealth queries the F5 device for all pools of a service and computes aggregate health.
func (*Agent) ScrapeServiceHealthPrometheus ¶
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.
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 ¶
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