sapcontrol

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

Documentation

Overview

Package sapcontrol implements generic sapcontrol functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnqLock

type EnqLock struct {
	LockName, LockArg, LockMode, Owner, OwnerVB string
	UserCountOwner, UserCountOwnerVB            int64
	Client, User, Transaction, Object, Backup   string
}

EnqLock has the attributes returned by sapcontrol's EnqGetLockTable function.

type ProcessStatus

type ProcessStatus struct {
	Name          string
	DisplayStatus string
	IsGreen       bool
	PID           string
}

ProcessStatus has the sap process status.

type Properties

type Properties struct {
	Instance *sapb.SAPInstance
}

Properties is a receiver for sapcontrol functions.

func (*Properties) EnqGetLockTable

func (p *Properties) EnqGetLockTable(exec commandlineexecutor.Execute, params commandlineexecutor.Params) (EnqLocks []*EnqLock, err error)

EnqGetLockTable parses the output of sapcontrol function EnqGetLockTable. Returns:

  • A slice of EnqLock structs containing lock details.
  • Error if sapcontrol fails, nil otherwise.

func (*Properties) ParseABAPGetWPTable

func (p *Properties) ParseABAPGetWPTable(exec commandlineexecutor.Execute, params commandlineexecutor.Params) (processes, busyProcesses map[string]int, processNameToPID map[string]string, err error)

ParseABAPGetWPTable runs and parses the output of sapcontrol function ABAPGetWPTable. Returns:

  • processes - A map with key->worker_process_type and value->total_process_count.
  • busyProcesses - A map with key->worker_process_type and value->busy_process_count.

func (*Properties) ParseQueueStats

func (p *Properties) ParseQueueStats(exec commandlineexecutor.Execute, params commandlineexecutor.Params) (currentQueueUsage, peakQueueUsage map[string]int, err error)

ParseQueueStats runs and parses the output of sapcontrol function GetQueueStatistic. Returns:

  • currentQueueUsage - A map with key->queue_type and value->current_queue_usage.
  • peakQueueUsage - A map with key->queue_type and value->peak_queue_usage.

func (*Properties) ProcessList

ProcessList uses the SapControl command to build a map describing the statuses of all SAP processes. Parameters are a commandlineexecutor.Execute and commandlineexecutor.Params Example Usage:

params := commandlineexecutor.Params{
	User:        "hdbadm",
	Executable:  "/usr/sap/HDB/HDB00/exe/sapcontrol",
	ArgsToSplit: "-nr 00 -function GetProcessList -format script",
	Env:         []string{"LD_LIBRARY_PATH=/usr/sap/HDB/HDB00/exe/ld_library"},
}
sc := &sapcontrol.Properties{&sapb.SAPInstance{}}
procs, code, err := sc.ProcessList(commandlineexecutor.ExecuteCommand, params)

Returns:

  • A map[int]*ProcessStatus where key is the process index as listed by sapcontrol, and the value is an ProcessStatus struct containing process status details.
  • The exit status returned by sapcontrol command as int.
  • Error if process detection fails, nil otherwise.

Jump to

Keyboard shortcuts

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