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 ¶
- func Enabled(crm *CRMMon) bool
- func NodeState(crm *CRMMon) (map[string]string, error)
- func XMLString(exec commandlineexecutor.Execute, crmAvailable bool) *string
- type CRMMon
- type CRMNode
- type CRMNodeHistory
- type CRMResource
- type CRMResourceHistory
- type CRMResourceNode
- type CRMResources
- type Resource
- type ResourceFailCount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶
Enabled checks if the current instance is part of a Linux pacemaker cluster. Returns a bool indicating whether pacemaker cluster is enabled.
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.
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 ¶
ResourceState returns a list of Resource structs with one entry per pacemaker resource. Returns an error in case of failures.
type ResourceFailCount ¶
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.