workloadmanager

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: 31 Imported by: 0

Documentation

Overview

Package workloadmanager collects workload manager metrics and sends them to Cloud Monitoring

Index

Constants

View Source
const OSReleaseFilePath = "/etc/os-release"

OSReleaseFilePath lists the location of the os-release file in the Linux system.

Variables

This section is empty.

Functions

func CollectCorosyncMetrics

func CollectCorosyncMetrics(params Parameters, wm chan<- WorkloadMetrics, csConfig string)

CollectCorosyncMetrics collects Corosync metrics for Workload Manager sends them to the wm channel

func CollectHanaMetrics

func CollectHanaMetrics(params Parameters, wm chan<- WorkloadMetrics)

CollectHanaMetrics collects SAP HANA metrics for the Workload Manager and sends them to the wm channel.

func CollectMetricsToJSON

func CollectMetricsToJSON(ctx context.Context, params Parameters) string

CollectMetricsToJSON will collect all of the workload manager metrics and return the JSON representation of them, this is only called on remote instances for metric collection only called through the google_cloud_sap_agent binary using remote mode

func CollectNetWeaverMetrics

func CollectNetWeaverMetrics(params Parameters, wm chan<- WorkloadMetrics)

CollectNetWeaverMetrics collects NetWeaver metrics for Workload Manager and sends them to the wm channel.

func CollectPacemakerMetrics

func CollectPacemakerMetrics(ctx context.Context, params Parameters, wm chan<- WorkloadMetrics)

CollectPacemakerMetrics collects the pacemaker configuration and runtime metrics from the OS.

func CollectSystemMetrics

func CollectSystemMetrics(params Parameters, wm chan<- WorkloadMetrics)

CollectSystemMetrics will collect the systme metrics for Workload Manager and send them to the channel wm

This is a legacy collection method that can be removed from the codebase once configurable WLM metric collection is fully implemented.

func StartMetricsCollection

func StartMetricsCollection(ctx context.Context, params Parameters) bool

StartMetricsCollection continuously collects Workload Manager metrics for SAP workloads. Returns true if the collection goroutine is started, and false otherwise.

Types

type CIB

type CIB struct {
	CRMFeatureSet  string         `xml:"crm_feature_set,attr"`
	ValidateWith   string         `xml:"validate-with,attr"`
	Epoch          int            `xml:"epoch,attr"`
	NumUpdates     int            `xml:"num_updates,attr"`
	AdminEpoch     int            `xml:"admin_epoch,attr"`
	CIBLastWritten string         `xml:"cib-last-written,attr"`
	UpdateOrigin   string         `xml:"update-origin,attr"`
	UpdateClient   string         `xml:"update-client,attr"`
	UpdateUser     string         `xml:"update-user,attr"`
	HaveQuorum     int            `xml:"have-quorum,attr"`
	DCUUID         int            `xml:"dc-uuid,attr"`
	Configuration  Configuration  `xml:"configuration"`
	Status         []CIBNodeState `xml:"status>node_state"`
}

CIB (Cluster Information Base) stores metadata defining a pacemaker XML CIB object cluster.

func ParseXML

func ParseXML(xmlVal []byte) (*CIB, error)

ParseXML uses XML unmarshal to parse an ASCII byte array into a CIB structure for pacemaker metric processing.

type CIBNode

type CIBNode struct {
	ID                 string             `xml:"id,attr"`
	Uname              string             `xml:"uname,attr"`
	InstanceAttributes ClusterPropertySet `xml:"instance_attributes"`
}

CIBNode stores the properties and attributes of an individual CIB configuration node (see Configuration struct).

type CIBNodeState

type CIBNodeState struct {
	ID                  string              `xml:"id,attr"`
	Uname               string              `xml:"uname,attr"`
	InCCM               bool                `xml:"in_ccm,attr"`
	CRMD                string              `xml:"crmd,attr"`
	CRMDebugOrigin      string              `xml:"crm-debug-origin,attr"`
	Join                string              `xml:"join,attr"`
	Expected            string              `xml:"expected,attr"`
	TransientAttributes TransientAttributes `xml:"transient_attributes"`
	LRM                 LRM                 `xml:"lrm"`
}

CIBNodeState stores the statuses of individual CIB Nodes (see Configuration struct).

type CRMConfig

type CRMConfig struct {
	ClusterPropertySets []ClusterPropertySet `xml:"cluster_property_set"`
}

CRMConfig stores the cluster properties that apply to the current CRM node.

type Clone

type Clone struct {
	ID         string             `xml:"id,attr"`
	Attributes ClusterPropertySet `xml:"meta_attributes"`
	Primitives []PrimitiveClass   `xml:"primitive"`
}

Clone stores overall data defining a group of cloned nodes and their metadata (also used to define a node master/clone relation).

type ClusterPropertySet

type ClusterPropertySet struct {
	ID      string   `xml:"id,attr"`
	NVPairs []NVPair `xml:"nvpair"`
}

ClusterPropertySet defines a set of identifiable name/value pairs

type ConfigFileReader

type ConfigFileReader func(string) (io.ReadCloser, error)

ConfigFileReader abstracts loading and reading files into an io.ReadCloser object. ConfigFileReader Example usage:

ConfigFileReader(func(path string) (io.ReadCloser, error) {
		file, err := os.Open(path)
		var f io.ReadCloser = file
		return f, err
	})

type Configuration

type Configuration struct {
	Nodes       []CIBNode          `xml:"nodes>node"`
	CRMConfig   CRMConfig          `xml:"crm_config"`
	Resources   Resources          `xml:"resources"`
	Constraints Constraints        `xml:"constraints"`
	RSCDefaults ClusterPropertySet `xml:"rsc_defaults>meta_attributes"`
	OPDefaults  ClusterPropertySet `xml:"op_defaults>meta_attributes"`
}

Configuration store CIB object configuration metadata.

type Constraints

type Constraints struct {
	RSCLocations  []RSCLocation `xml:"rsc_location"`
	RSCColocation RSCColocation `xml:"rsc_colocation"`
	RSCOrder      RSCOrder      `xml:"rsc_order"`
}

Constraints store data defining resource constraints applicable to the current CIB node.

type DefaultTokenGetter

type DefaultTokenGetter func(context.Context, ...string) (oauth2.TokenSource, error)

DefaultTokenGetter obtains a "default" oauth2 token source within the getDefaultBearerToken function.

type Group

type Group struct {
	ID         string           `xml:"id,attr"`
	Primitives []PrimitiveClass `xml:"primitive"`
}

Group defines a specific and identifiable collection of CIB primitive objects.

type InterfaceAddrsGetter

type InterfaceAddrsGetter func() ([]net.Addr, error)

InterfaceAddrsGetter satisfies the function signature for net.InterfaceAddrs().

type JSONCredentialsGetter

type JSONCredentialsGetter func(context.Context, []byte, ...string) (*google.Credentials, error)

JSONCredentialsGetter obtains a JSON oauth2 google credentials within the getJSONBearerToken function.

type LRM

type LRM struct {
	ID           string        `xml:"id,attr"`
	LRMResources []LRMResource `xml:"lrm_resources>lrm_resource"`
}

LRM (Local Resource Manager) stores the collective LRM status information with an additional ID value.

type LRMRSCOp

type LRMRSCOp struct {
	ID              string `xml:"id,attr"`
	OperationKey    string `xml:"operation_key,attr"`
	Operation       string `xml:"operation,attr"`
	CRMDebugOrigin  string `xml:"crm-debug-origin,attr"`
	CRMFeatureSet   string `xml:"crm_feature_set,attr"`
	TransitionKey   string `xml:"transition-key,attr"`
	TransitionMagic string `xml:"transition-magic,attr"`
	ExitReason      string `xml:"exit-reason,attr"`
	OnNode          string `xml:"on_node,attr"`
	CallID          string `xml:"call-id,attr"`
	RCCode          int    `xml:"rc-code,attr"`
	OpStatus        int    `xml:"op-status,attr"`
	Interval        int    `xml:"interval,attr"`
	LastRun         int64  `xml:"last-run,attr"`
	LastRCChange    int64  `xml:"last-rc-change,attr"`
	ExecTime        int    `xml:"exec-time,attr"`
	QueueTime       int    `xml:"queue-time,attr"`
	OpDigest        string `xml:"op-digest,attr"`
	OpForceRestart  string `xml:"op-force-restart,attr"`
	OpRestartDigest string `xml:"op-restart-digest,attr"`
}

LRMRSCOp stores the state of an individual LRM resource operation.

type LRMResource

type LRMResource struct {
	ID            string     `xml:"id,attr"`
	ResourceType  string     `xml:"type,attr"`
	ResrouceClass string     `xml:"class,attr"`
	Provider      string     `xml:"provider,attr"`
	LRMRscOps     []LRMRSCOp `xml:"lrm_rsc_op"`
}

LRMResource stores the status information of an individual LRM CIB resource.

type NVPair

type NVPair struct {
	ID    string `xml:"id,attr"`
	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

NVPair stores a generic, individual mapping of name/value pairs with an additional ID value.

type OSStatReader

type OSStatReader func(string) (os.FileInfo, error)

OSStatReader abstracts os.FileInfo reading. OSStatReader Example usage:

OSStatReader(func(f string) (os.FileInfo, error) {
	return os.Stat(f)
})

type Op

type Op struct {
	ID       string `xml:"id,attr"`
	Interval string `xml:"interval,attr"`
	Name     string `xml:"name,attr"`
	Timeout  string `xml:"timeout,attr"`
}

Op defines an operation entry.

type Parameters

type Parameters struct {
	Config                *cnfpb.Configuration
	WorkloadConfig        *wlmpb.WorkloadValidation
	Remote                bool
	ConfigFileReader      ConfigFileReader
	OSStatReader          OSStatReader
	Execute               commandlineexecutor.Execute
	Exists                commandlineexecutor.Exists
	InstanceInfoReader    instanceinfo.Reader
	TimeSeriesCreator     cloudmonitoring.TimeSeriesCreator
	DefaultTokenGetter    DefaultTokenGetter
	JSONCredentialsGetter JSONCredentialsGetter
	OSType                string
	BackOffs              *cloudmonitoring.BackOffIntervals
	HeartbeatSpec         *heartbeat.Spec
	InterfaceAddrsGetter  InterfaceAddrsGetter
	OSReleaseFilePath     string
	// contains filtered or unexported fields
}

Parameters holds the parameters for all of the Collect* function calls.

func (*Parameters) SetOSReleaseInfo

func (p *Parameters) SetOSReleaseInfo()

SetOSReleaseInfo parses the OS release file and sets the values for the osVendorID and osVersion fields in the Parameters struct.

type PrimitiveClass

type PrimitiveClass struct {
	Class              string             `xml:"class,attr"`
	ID                 string             `xml:"id,attr"`
	ClassType          string             `xml:"type,attr"`
	Provider           string             `xml:"provider,attr"`
	InstanceAttributes ClusterPropertySet `xml:"instance_attributes"`
	Operations         []Op               `xml:"operations>op"`
}

PrimitiveClass defines a primitive node instance, its individual properties, and a list of operations it can perform.

type RSCColocation

type RSCColocation struct {
	ID          string `xml:"id,attr"`
	Score       string `xml:"score,attr"`
	RSC         string `xml:"rsc,attr"`
	RSCRole     string `xml:"rsc-role,attr"`
	WithRSC     string `xml:"with-rsc,attr"`
	WithRSCRole string `xml:"with-rsc-role,attr"`
}

RSCColocation defines the co-locations (two or more nodes located together) of resources (typically used for master/clone nodes).

type RSCLocation

type RSCLocation struct {
	ID    string `xml:"id,attr"`
	RSC   string `xml:"rsc,attr"`
	Score string `xml:"score,attr"`
	Node  string `xml:"node,attr"`
}

RSCLocation defines a constraint's resource node location.

type RSCOrder

type RSCOrder struct {
	ID    string `xml:"id,attr"`
	Kind  string `xml:"kind,attr"`
	First string `xml:"first,attr"`
	Then  string `xml:"then,attr"`
}

RSCOrder defines the order in which resource constraints apply

type Resources

type Resources struct {
	Primitives []PrimitiveClass `xml:"primitive"`
	Group      Group            `xml:"group"`
	Clone      Clone            `xml:"clone"`
	Master     Clone            `xml:"master"`
}

Resources stores metadata defining the node structure of the current CIB object (nodes, groups, etc).

type TransientAttributes

type TransientAttributes struct {
	ID                 string             `xml:"id,attr"`
	InstanceAttributes ClusterPropertySet `xml:"instance_attributes"`
}

TransientAttributes store an additional layer of ID's cluster attributes used by a CIB node state struct

type WorkloadMetrics

type WorkloadMetrics struct {
	Metrics []*monitoringresourcespb.TimeSeries
}

WorkloadMetrics is a container for monitoring TimeSeries metrics.

func CollectCorosyncMetricsFromConfig

func CollectCorosyncMetricsFromConfig(params Parameters) WorkloadMetrics

CollectCorosyncMetricsFromConfig collects the corosync metrics as specified by the WorkloadValidation config and formats the results as a time series to be uploaded to a Collection Storage mechanism.

func CollectCustomMetricsFromConfig

func CollectCustomMetricsFromConfig(params Parameters) WorkloadMetrics

CollectCustomMetricsFromConfig collects any custom metrics as specified by the WorkloadValidation config and formats the results as a time series to be uploaded to a Collection Storage mechanism.

func CollectHANAMetricsFromConfig

func CollectHANAMetricsFromConfig(params Parameters) WorkloadMetrics

CollectHANAMetricsFromConfig collects the HANA metrics as specified by the WorkloadValidation config and formats the results as a time series to be uploaded to a Collection Storage mechanism.

func CollectNetWeaverMetricsFromConfig

func CollectNetWeaverMetricsFromConfig(params Parameters) WorkloadMetrics

CollectNetWeaverMetricsFromConfig collects the netweaver metrics as specified by the WorkloadValidation config and formats the results as a time series to be uploaded to a Collection Storage mechanism.

func CollectPacemakerMetricsFromConfig

func CollectPacemakerMetricsFromConfig(ctx context.Context, params Parameters) WorkloadMetrics

CollectPacemakerMetricsFromConfig collects the pacemaker metrics as specified by the WorkloadValidation config and formats the results as a time series to be uploaded to a Collection Storage mechanism.

func CollectSystemMetricsFromConfig

func CollectSystemMetricsFromConfig(params Parameters) WorkloadMetrics

CollectSystemMetricsFromConfig collects the system metrics specified by the WorkloadValidation config and formats the results as a time series to be uploaded to a Collection Storage mechanism.

Jump to

Keyboard shortcuts

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