collector

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// VRRPScriptStatuses contains VRRP Script statuses.
	VRRPScriptStatuses = []string{"BAD", "GOOD"}
	// VRRPScriptStates contains VRRP Script states.
	VRRPScriptStates = []string{"idle", "running", "requested termination", "forcing termination"}
	// VRRPStates contains VRRP states.
	VRRPStates = []string{"INIT", "BACKUP", "MASTER", "FAULT"}
)

Functions

func ParseStats

func ParseStats(i io.Reader) (map[string]*VRRPStats, error)

func ParseVIP

func ParseVIP(vip string) (string, string, bool)

func ParseVRRPData

func ParseVRRPData(i io.Reader) (map[string]*VRRPData, error)

Types

type Collector

type Collector interface {
	Refresh() error
	ScriptVrrps() ([]VRRPScript, error)
	DataVrrps() (map[string]*VRRPData, error)
	StatsVrrps() (map[string]*VRRPStats, error)
	JSONVrrps() ([]VRRP, error)
	HasVRRPScriptStateSupport() bool
}

type KeepalivedCollector

type KeepalivedCollector struct {
	sync.Mutex
	// contains filtered or unexported fields
}

KeepalivedCollector implements prometheus.Collector interface and stores required info to collect data.

func NewKeepalivedCollector

func NewKeepalivedCollector(useJSON bool, scriptPath string, collector Collector) *KeepalivedCollector

NewKeepalivedCollector is creating new instance of KeepalivedCollector.

func (*KeepalivedCollector) Collect

func (k *KeepalivedCollector) Collect(ch chan<- prometheus.Metric)

Collect get metrics and add to prometheus metric channel.

func (*KeepalivedCollector) Describe

func (k *KeepalivedCollector) Describe(ch chan<- *prometheus.Desc)

Describe outputs metrics descriptions.

type KeepalivedStats

type KeepalivedStats struct {
	VRRPs   []VRRP
	Scripts []VRRPScript
}

KeepalivedStats ties together VRRP and VRRPScript.

type VRRP

type VRRP struct {
	Data  VRRPData  `json:"data"`
	Stats VRRPStats `json:"stats"`
}

VRRP ties together VRRPData and VRRPStats.

func ParseJSON

func ParseJSON(i io.Reader) ([]VRRP, error)

type VRRPData

type VRRPData struct {
	IName        string   `json:"iname"`
	State        int      `json:"state"`
	WantState    int      `json:"wantstate"`
	Intf         string   `json:"ifp_ifname"`
	GArpDelay    int      `json:"garp_delay"`
	VRID         int      `json:"vrid"`
	VIPs         []string `json:"vips"`
	ExcludedVIPs []string `json:"excluded_vips"`
}

VRRPData represents Keepalived data about VRRP.

type VRRPScript

type VRRPScript struct {
	Name   string
	Status string
	State  string
}

VRRPScript represents Keepalived script about VRRP.

func ParseVRRPScript

func ParseVRRPScript(i io.Reader) []VRRPScript

type VRRPStats

type VRRPStats struct {
	AdvertRcvd        int `json:"advert_rcvd"`
	AdvertSent        int `json:"advert_sent"`
	BecomeMaster      int `json:"become_master"`
	ReleaseMaster     int `json:"release_master"`
	PacketLenErr      int `json:"packet_len_err"`
	AdvertIntervalErr int `json:"advert_interval_err"`
	IPTTLErr          int `json:"ip_ttl_err"`
	InvalidTypeRcvd   int `json:"invalid_type_rcvd"`
	AddrListErr       int `json:"addr_list_err"`
	InvalidAuthType   int `json:"invalid_authtype"`
	AuthTypeMismatch  int `json:"authtype_mismatch"`
	AuthFailure       int `json:"auth_failure"`
	PRIZeroRcvd       int `json:"pri_zero_rcvd"`
	PRIZeroSent       int `json:"pri_zero_sent"`
}

VRRPStats represents Keepalived stats about VRRP.

Jump to

Keyboard shortcuts

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