lbcluster

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const OID string = ".1.3.6.1.4.1.96.255.1"

OID snmp object to get

View Source
const TIMEOUT int = 10

TIMEOUT snmp timeout

View Source
const WorstValue int = 99999

WorstValue worst possible load

Variables

This section is empty.

Functions

func NewTimeoutClient

func NewTimeoutClient(connectTimeout time.Duration, readWriteTimeout time.Duration) *http.Client

NewTimeoutClient checks the timeout

The following functions are for the roger state and its timeout

func Shuffle

func Shuffle(n int, swap func(i, j int))

Shuffle pseudo-randomizes the order of elements. n is the number of elements. Shuffle panics if n < 0. swap swaps the elements with indexes i and j.

Types

type LBCluster

type LBCluster struct {
	Cluster_name            string
	Loadbalancing_username  string
	Loadbalancing_password  string
	Host_metric_table       map[string]Node
	Parameters              Params
	Time_of_last_evaluation time.Time
	Current_best_ips        []net.IP
	Previous_best_ips_dns   []net.IP
	Current_index           int
	Slog                    *Log
}

LBCluster struct of an lbcluster alias

func (*LBCluster) ApplyMetric added in v0.2.1

func (lbc *LBCluster) ApplyMetric(hosts_to_check map[string]lbhost.LBHost) bool

ApplyMetric This is the core of the lbcluster: based on the metrics, select the best hosts

func (*LBCluster) EvaluateHosts added in v0.2.1

func (lbc *LBCluster) EvaluateHosts(hostsToCheck map[string]lbhost.LBHost)

EvaluateHosts gets the load from the all the nodes

func (*LBCluster) FindBestHosts added in v0.2.1

func (lbc *LBCluster) FindBestHosts(hosts_to_check map[string]lbhost.LBHost) bool

Find_best_hosts Looks for the best hosts for a cluster

func (*LBCluster) GetStateDNS added in v0.2.1

func (lbc *LBCluster) GetStateDNS(dnsManager string) error

func (*LBCluster) Get_list_hosts added in v0.1.14

func (lbc *LBCluster) Get_list_hosts(current_list map[string]lbhost.LBHost)

Get_list_hosts Get the hosts for an alias

func (*LBCluster) ReEvaluateHostsForMinimum added in v0.2.9

func (lbc *LBCluster) ReEvaluateHostsForMinimum(hostsToCheck map[string]lbhost.LBHost)

ReEvaluateHostsForMinimum gets the load from the all the nodes for Minimum metric policy

func (*LBCluster) RefreshDNS added in v0.2.1

func (lbc *LBCluster) RefreshDNS(dnsManager, keyPrefix, internalKey, externalKey string)

RefreshDNS This is the only public function here. It retrieves the current ips behind the dns, and then updates it with the new best ips (if they are different)

func (*LBCluster) Time_to_refresh

func (lbc *LBCluster) Time_to_refresh() bool

Time_to_refresh Checks if the cluster needs refreshing

func (*LBCluster) Write_to_log

func (lbc *LBCluster) Write_to_log(level string, msg string) error

Write_to_log put something in the log file

type Log

type Log struct {
	Writer     syslog.Writer
	Syslog     bool
	Stdout     bool
	Debugflag  bool
	TofilePath string
	// contains filtered or unexported fields
}

Log struct for the log

func (*Log) Debug

func (l *Log) Debug(s string) error

Debug write as Debug

func (*Log) Error

func (l *Log) Error(s string) error

Error write as Error

func (*Log) Info

func (l *Log) Info(s string) error

Info write as Info

func (*Log) Warning

func (l *Log) Warning(s string) error

Warning write as Warning

type Logger

type Logger interface {
	Info(s string) error
	Warning(s string) error
	Debug(s string) error
	Error(s string) error
}

Logger struct for the Logger interface

type Node added in v0.2.1

type Node struct {
	Load int
	IPs  []net.IP
}

Node Struct to keep the ips and load of a node for an alias

type NodeList added in v0.2.1

type NodeList []Node

NodeList struct for the list

func (NodeList) Len added in v0.2.1

func (p NodeList) Len() int

func (NodeList) Less added in v0.2.1

func (p NodeList) Less(i, j int) bool

func (NodeList) Swap added in v0.2.1

func (p NodeList) Swap(i, j int)

type Params

type Params struct {
	Behaviour        string
	Best_hosts       int
	External         bool
	Metric           string
	Polling_interval int
	Statistics       string
	Ttl              int
}

Params of the alias

Jump to

Keyboard shortcuts

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