pacemaker

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package pacemaker implements Linux Pacemaker cluster related functions. The package implements functions to detect of Pacemeaker HA cluster on the machine running sap-agent. Package supports both SUSE and RHEL based images. The goal of the package is to interact with pacemaker via commands and enable sap-agent with this data for WLM metrics and linux cluster related process metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enabled

func Enabled(crm *CRMMon) bool

Enabled checks if the current instance is part of a Linux pacemaker cluster. Returns a bool indicating whether pacemaker cluster is enabled.

func NodeState

func NodeState(crm *CRMMon) (map[string]string, error)

NodeState returns a map with key as node name in the pacemaker cluster, and value as the state string. Returns an error in case of failures.

func XMLString

func XMLString(exec commandlineexecutor.Execute, crmAvailable bool) *string

XMLString obtains a string of encoded XML data describing the pacemaker metrics.

Types

type CRMMon

type CRMMon struct {
	XMLName     xml.Name         `xml:"crm_mon"`
	Nodes       []CRMNode        `xml:"nodes>node"`
	Resources   CRMResources     `xml:"resources"`
	NodeHistory []CRMNodeHistory `xml:"node_history>node"`
}

CRMMon stores unmarshalled XML output from the crm_mon command.

func Data

func Data() (*CRMMon, error)

Data gets the crm_mon data and parses it into the CRMMon struct.

type CRMNode

type CRMNode struct {
	Name             string `xml:"name,attr"`
	ID               int    `xml:"id,attr"`
	Online           bool   `xml:"online,attr"`
	Standby          bool   `xml:"standby,attr"`
	StandbyOnfail    bool   `xml:"standby_onfail,attr"`
	Maintenance      bool   `xml:"maintenance,attr"`
	Pending          bool   `xml:"pending,attr"`
	Unclean          bool   `xml:"unclean,attr"`
	Shutdown         bool   `xml:"shutdown,attr"`
	ExpectedUp       bool   `xml:"expected_up,attr"`
	IsDC             bool   `xml:"is_dc,attr"`
	ResourcesRunning int    `xml:"resources_running,attr"`
	NodeType         string `xml:"type,attr"`
}

CRMNode stores unmarshalled CRMNode metadata and properties.

type CRMNodeHistory

type CRMNodeHistory struct {
	Name            string               `xml:"name,attr"`
	ResourceHistory []CRMResourceHistory `xml:"resource_history"`
}

CRMNodeHistory stores unmarshalled crm_node cluster node history.

type CRMResource

type CRMResource struct {
	ID    string          `xml:"id,attr"`
	Agent string          `xml:"resource_agent,attr"`
	Role  string          `xml:"role,attr"`
	Node  CRMResourceNode `xml:"node"`
}

CRMResource stores an unmarshalled crm resource metadata and a corresponding crm resource node.

type CRMResourceHistory

type CRMResourceHistory struct {
	ID                 string `xml:"id,attr"`
	Orphan             bool   `xml:"orphan,attr"`
	MigrationThreshold string `xml:"migration-threshold,attr"`
	FailCount          int    `xml:"fail-count,attr"`
}

CRMResourceHistory stores unmarshalled crm_node cluster resource history.

type CRMResourceNode

type CRMResourceNode struct {
	Name string `xml:"name,attr"`
}

CRMResourceNode stores a basic, unmarshalled crm resource node.

type CRMResources

type CRMResources struct {
	General []CRMResource `xml:"resource"`
	Group   []CRMResource `xml:"group>resource"`
	Clone   []CRMResource `xml:"clone>resource"`
}

CRMResources stores unmarshalled general, group, and clone CRMResource slices.

type Resource

type Resource struct {
	Name, Role, Node string
}

Resource struct has pacemaker resource details.

func ResourceState

func ResourceState(crm *CRMMon) ([]Resource, error)

ResourceState returns a list of Resource structs with one entry per pacemaker resource. Returns an error in case of failures.

type ResourceFailCount

type ResourceFailCount struct {
	ResourceName, Node string
	FailCount          int
}

ResourceFailCount has pacemaker resource fail-count details.

func FailCount

func FailCount(crm *CRMMon) ([]ResourceFailCount, error)

FailCount returns a list of ResourceFailCount structs with one entry per pacemaker resource that has a non-zero fail-count. Returns (nil, nil) if none of the resources have fail-count field set. Returns a (nil, error) in case of failures.

Jump to

Keyboard shortcuts

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