Documentation ¶
Index ¶
- Constants
- Variables
- func AddGap(writer io.Writer)
- func BlockDeviceIsDisk(dev string) bool
- func CalledFrom() string
- func CheckForPattern(file, pattern string) bool
- func CheckRpmVers(vers1, vers2 string) int
- func ChkCliSyntax() bool
- func ChkForSysctlDoubles(param string) string
- func ChkMD5Pair(srcFile, destFile string) bool
- func CleanUpRun()
- func CliArg(i int) string
- func CliArgs(i int) []string
- func CmdIsAvailable(cmdName string) bool
- func CmpRpmVers(vers1, vers2 string) bool
- func CmpServiceStates(actStates, expStates string) bool
- func CollectBlockDeviceInfo() []string
- func CollectGlobalSysctls(excludeDirs []string)
- func CopyFile(srcFile, destFile string) error
- func DebugLog(txt string, stuff ...interface{})
- func EditAndCheckFile(srcFileName, destFileName, defName, defType string) (bool, error)
- func EditFile(srcFile, destFile string) error
- func ErrLog(txt string, stuff ...interface{})
- func ErrorExit(template string, stuff ...interface{})
- func ErrorLog(txt string, stuff ...interface{}) error
- func FileIsEmpty(fileName string) bool
- func GetAvailBlockInfo(info, tag string) []string
- func GetAvailServices() map[string]string
- func GetBackupValue(fileName string) string
- func GetCSP() string
- func GetCurrentLogins() []string
- func GetDmiID(file string) (string, error)
- func GetFLInfo() (string, string, bool)
- func GetFiles(dir string) map[string]string
- func GetFlagVal(flag string) string
- func GetGovernor() map[string]string
- func GetHWIdentity(info string) (string, error)
- func GetMD5Hash(file string) (string, error)
- func GetMainMemSizeMB() uint64
- func GetMountOpts(mustExist bool, fstype, fsopt string) ([]string, []string)
- func GetNrTags(key string) (int, string, string)
- func GetOsName() string
- func GetOsVers() string
- func GetPerfBias() string
- func GetRpmVers(rpm string) string
- func GetSemaphoreLimits() (msl, mns, opm, mni uint64)
- func GetServiceName(service string) string
- func GetSolutionSelector() string
- func GetSysChoice(parameter string) (string, error)
- func GetSysInt(parameter string) (int, error)
- func GetSysSearchParam(syskey string) (string, string)
- func GetSysString(parameter string) (string, error)
- func GetSysctlInt(parameter string) (int, error)
- func GetSysctlString(parameter string) (string, error)
- func GetSysctlUint64(parameter string) (uint64, error)
- func GetSysctlUint64Field(param string, field int) (uint64, error)
- func GetSystemState() (string, error)
- func GetTasksMax(userID string) string
- func GetTotalMemSizeMB() uint64
- func GetTotalMemSizePages() uint64
- func GetTunedAdmProfile() string
- func GetTunedProfile() string
- func GetVirtStatus() string
- func GetdmaLatency() string
- func InfoLog(txt string, stuff ...interface{})
- func InitOut(logSwitch map[string]string)
- func IsFlagSet(flag string) bool
- func IsPagecacheAvailable() bool
- func IsSLE12() bool
- func IsSLE15() bool
- func IsSapconfActive(sapconf string) bool
- func IsServiceAvailable(service string) bool
- func IsSystemRunning() (bool, error)
- func IsUserRoot() bool
- func JInvalid(exitStatus int)
- func Jcollect(data interface{})
- func JnotSupportedYet()
- func ListDir(dirPath, logMsg string) (dirNames, fileNames []string)
- func LogInit(logFile string, logSwitch map[string]string)
- func MaxI(values ...int) int
- func MaxI64(values ...int64) int64
- func MaxU64(values ...uint64) uint64
- func MinU64(values ...uint64) uint64
- func NoticeLog(txt string, stuff ...interface{})
- func OutIsTerm(writer *os.File) bool
- func ParseCliArgs() ([]string, map[string]string)
- func ParseCmdline(fileName, option string) string
- func ParseMeminfo() (infoMap map[string]uint64)
- func ReadConfigFile(fileName string, autoCreate bool) ([]byte, error)
- func ReleaseSaptuneLock()
- func RemountSHM(newSizeMB uint64) error
- func RereadArgs()
- func SaptuneLock()
- func SecureBootEnabled() bool
- func SetForceLatency(value, savedStates, info string, revert bool) error
- func SetGovernor(value, info string) error
- func SetPerfBias(value string) error
- func SetSysInt(parameter string, value int) error
- func SetSysString(parameter, value string) error
- func SetSysctlInt(parameter string, value int) error
- func SetSysctlString(parameter, value string) error
- func SetSysctlUint64(parameter string, value uint64) error
- func SetSysctlUint64Field(param string, field int, value uint64) error
- func SetTasksMax(userID, limit string) error
- func StripComment(str, commentChars string) string
- func SwitchOffLogging()
- func SwitchOffOut() (*os.File, *os.File)
- func SwitchOnOut(stdout *os.File, stderr *os.File)
- func SystemctlDisable(thing string) error
- func SystemctlDisableStop(thing string) error
- func SystemctlEnable(thing string) error
- func SystemctlEnableStart(thing string) error
- func SystemctlIsActive(thing string) (string, error)
- func SystemctlIsEnabled(thing string) (bool, error)
- func SystemctlIsRunning(thing string) (bool, error)
- func SystemctlIsStarting() bool
- func SystemctlReloadTryRestart(thing string) error
- func SystemctlResetFailed() error
- func SystemctlRestart(thing string) error
- func SystemctlStart(thing string) error
- func SystemctlStatus(thing string) error
- func SystemctlStop(thing string) error
- func SystemdDetectVirt(opt string) (bool, string, error)
- func TestSysString(parameter, value string) error
- func TunedAdmOff() error
- func TunedAdmProfile(profileName string) error
- func WarningLog(txt string, stuff ...interface{})
- func Watch() string
- func WrapTxt(text string, width int) (folded []string)
- func WriteBackupValue(value, fileName string)
- func WriteTunedAdmProfile(profileName string) error
- type BlockDev
- type JAppliedSol
- type JEntry
- type JFootNotes
- type JMessages
- type JMsg
- type JNoteList
- type JNoteListEntry
- type JObj
- type JPNotes
- type JPNotesLine
- type JPNotesRemind
- type JResult
- type JSol
- type JSolList
- type JSolListEntry
- type JStatus
- type JStatusServs
- type JStatusStaging
- type MountPoint
- type MountPoints
- type SecLimits
- func (limits *SecLimits) Apply() error
- func (limits *SecLimits) ApplyDropIn(lim []string, noteID string) error
- func (limits *SecLimits) Get(domain, typeName, item string) (string, bool)
- func (limits *SecLimits) GetOr0(domain, typeName, item string) SecurityLimitInt
- func (limits *SecLimits) Set(domain, typeName, item, value string)
- func (limits *SecLimits) ToDropIn(lim []string, noteID, fileName string) string
- func (limits *SecLimits) ToText() string
- type SecLimitsEntry
- type SecurityLimitInt
Constants ¶
const ( // Cloud Service Provider short and long names // microsoft-azure CSPAzure = "azure" CSPAzureLong = "Microsoft Azure" // amazon-web-services CSPAWS = "aws" CSPAWSLong = "Amazon Web Services" // GoogleCloud CSPGoogle = "google" CSPGoogleLong = "Google Cloud Platform" // OracleCloud CSPOVM = "ovm" CSPOVMLong = "Oracle Cloud" // Alibaba Cloud CSPAlibaba = "alibaba" CSPAlibabaLong = "Alibaba Cloud" )
constant definitions
const ( MemMainTotalKey = "MemTotal" MemSwapTotalKey = "SwapTotal" )
string definitions for parsing /proc/meminfo output
const ( SysctlPagecacheLimitMB = "vm.pagecache_limit_mb" SysctlPagecacheLimitIgnoreDirty = "vm.pagecache_limit_ignore_dirty" SysctlDirtyRatio = "vm.dirty_ratio" SysctlDirtyBackgroundRatio = "vm.dirty_background_ratio" SysKernelTHPEnabled = "kernel.mm.transparent_hugepage.enabled" SysKSMRun = "kernel.mm.ksm.run" )
mapping of system parameter names to configuration names
const SaptuneSectionDir = "/run/saptune/sections"
SaptuneSectionDir defines saptunes saved state directory
const SecurityLimitUnlimitedValue = SecurityLimitInt(-1)
SecurityLimitUnlimitedValue is the constant integer value that represents unrestricted limit.
Variables ¶
var DmiID = "/sys/class/dmi/id"
DmiID is the path to the dmidecode representation in the /sys filesystem
var ErrExitOut = errExitOut
ErrExitOut defines the output function, which should be used in case of colored output
var ErrorExitOut = ErrorLog
ErrorExitOut defines, which exit output function should be used
var InfoOut = InfoLog
InfoOut defines, which log output function should be used
var IsMsect = regexp.MustCompile(`^MAX_SECTORS_KB_\w+\-?\d*$`)
IsMsect matches block device max_sectors_kb tag
var IsNrreq = regexp.MustCompile(`^NRREQ_\w+\-?\d*$`)
IsNrreq matches block device nrreq tag
var IsRahead = regexp.MustCompile(`^READ_AHEAD_KB_\w+\-?\d*$`)
IsRahead matches block device read_ahead_kb tag
var IsSched = regexp.MustCompile(`^IO_SCHEDULER_\w+\-?\d*$`)
IsSched matches block device scheduler tag
var IsXFSOption = regexp.MustCompile(`^xfsopt_\w+$`)
IsXFSOption matches xfs options
var OSExit = os.Exit
OSExit defines, which exit function should be used
var SecurityLimitUnlimitedString = []string{"unlimited", "infinity"}
SecurityLimitUnlimitedString are the string constants that represent unrestricted limit.
Functions ¶
func BlockDeviceIsDisk ¶
BlockDeviceIsDisk checks, if a block device is a disk /sys/block/*/device/type (TYPE_DISK / 0x00) does not work for virtio and nvme block devices, needs workaround
func CalledFrom ¶
func CalledFrom() string
CalledFrom returns the name and the line number of the calling source file
func CheckForPattern ¶
CheckForPattern returns true, if the file is available and contains the expected string
func CheckRpmVers ¶
CheckRpmVers compare versions of 2 RPMs (installed version, expected version) Return 0 (Equal), 1 (GreaterThan) or -1 (LessThan)
func ChkCliSyntax ¶
func ChkCliSyntax() bool
ChkCliSyntax checks, if command line parameter are in the right order only checking the right position of the 'options' aka 'flags' saptune globOpt realm realmOpt cmd cmdOpt param
func ChkForSysctlDoubles ¶
ChkForSysctlDoubles checks if the given sysctl parameter is additional set in a sysctl system configuration file
func ChkMD5Pair ¶
ChkMD5Pair checks, if the md5sum of 2 files are equal
func CliArg ¶
CliArg returns the i-th command line parameter, or empty string if it is not specified.
func CliArgs ¶
CliArgs returns all remaining command line parameters starting with i, or empty string if it is not specified.
func CmdIsAvailable ¶
CmdIsAvailable returns true, if the cmd is available.
func CmpRpmVers ¶
CmpRpmVers compare versions of 2 RPMs (installed version, expected version) Return true, if installed package version is equal or higher than expected Return false, if installed package version is less than expected
func CmpServiceStates ¶
CmpServiceStates compares the expected service states with the current active service states
func CollectBlockDeviceInfo ¶
func CollectBlockDeviceInfo() []string
CollectBlockDeviceInfo collects all needed information about block devices from /sys/block write info to /var/lib/saptune/sections/block.run
func CollectGlobalSysctls ¶
func CollectGlobalSysctls(excludeDirs []string)
CollectGlobalSysctls collects all sysctl parameters defined in all of the sysctl.conf related files
func DebugLog ¶
func DebugLog(txt string, stuff ...interface{})
DebugLog sents text to the debugLogger and stderr
func EditAndCheckFile ¶
EditAndCheckFile creates or modify note or solution definition files using an editor
func EditFile ¶
EditFile copies a source file to another name and opens this copy in an editor defined by environment variable "EDITOR" or in 'vim'
func ErrLog ¶
func ErrLog(txt string, stuff ...interface{})
ErrLog sents text only to the errorLogger
func ErrorExit ¶
func ErrorExit(template string, stuff ...interface{})
ErrorExit prints the message to stderr and exit 1.
func FileIsEmpty ¶
FileIsEmpty returns true, if the given file is empty or does not exist or false, if exist, but not empty
func GetAvailBlockInfo ¶
GetAvailBlockInfo returns a list of all block devices matching a special tag regarding block device info like VENDOR or MODEL
func GetAvailServices ¶
GetAvailServices returns a map of the available services of the system
func GetBackupValue ¶
GetBackupValue reads the value from the backup file currently used for the former start TasksMax value
func GetCSP ¶
func GetCSP() string
GetCSP returns the identifier of the cloud service provider of the current running system or an empty string, if the system does not belong to a CSP use files in /sys/class/dmi/id/ instead of dmidecode command
func GetCurrentLogins ¶
func GetCurrentLogins() []string
GetCurrentLogins returns the user ids of the currently logged in users
func GetDmiID ¶
GetDmiID return the content of /sys/devices/virtual/dmi/id/<file> or an empty string
func GetFLInfo ¶
GetFLInfo retrieve CPU latency configuration from the system and returns the current latency, the latency states of all CPUs to save latency states for 'revert', if cpu states differ return lat, savedStates, cpuStateDiffer
func GetFlagVal ¶
GetFlagVal returns the value of a saptune commandline flag
func GetGovernor ¶
GetGovernor retrieve performance configuration regarding to cpu frequency from the system
func GetHWIdentity ¶
GetHWIdentity returns the hardwar vendor or model of the system needs adaption, if the files to identify the hardware will change or if we need to look at different files for different vendors but the 'open' API GetDmiID exists for workarounds at customer side
func GetMD5Hash ¶
GetMD5Hash generate the md5sum of a file
func GetMainMemSizeMB ¶
func GetMainMemSizeMB() uint64
GetMainMemSizeMB return size of system main memory, excluding swap. Panic on error.
func GetMountOpts ¶
GetMountOpts checks if mount points with the given type exists and contain the needed/not needed option. Returns a list of mount point containing the option and a list of mount point NOT containing the option
func GetNrTags ¶
GetNrTags returns the value from /sys/block/<bdev>/mq/0/nr_tags and the related scheduler
func GetPerfBias ¶
func GetPerfBias() string
GetPerfBias retrieve CPU performance configuration from the system
func GetRpmVers ¶
GetRpmVers return the version of an installed RPM
func GetSemaphoreLimits ¶
func GetSemaphoreLimits() (msl, mns, opm, mni uint64)
GetSemaphoreLimits return kernel semaphore limits. Panic on error.
func GetServiceName ¶
GetServiceName returns the systemd service name for supported services
func GetSolutionSelector ¶
func GetSolutionSelector() string
GetSolutionSelector returns the architecture string needed to select the supported set os solutions
func GetSysChoice ¶
GetSysChoice read a /sys/ key that comes with current value and alternative choices, return the current choice or empty string.
func GetSysSearchParam ¶
GetSysSearchParam returns the search pattern for a given sys key and the conterpart section
func GetSysString ¶
GetSysString read a /sys/ key and return the string value.
func GetSysctlInt ¶
GetSysctlInt read an integer sysctl key.
func GetSysctlString ¶
GetSysctlString read a sysctl key and return the string value.
func GetSysctlUint64 ¶
GetSysctlUint64 read an uint64 sysctl key.
func GetSysctlUint64Field ¶
GetSysctlUint64Field extracts an uint64 value from a sysctl key of many fields.
func GetSystemState ¶
GetSystemState returns the output of 'systemctl is-system-running'
func GetTasksMax ¶
GetTasksMax returns the current limit of TasksMax for a given user id which is the value for UserTasksMax
func GetTotalMemSizeMB ¶
func GetTotalMemSizeMB() uint64
GetTotalMemSizeMB return size of system main memory plus swap. Panic on error.
func GetTotalMemSizePages ¶
func GetTotalMemSizePages() uint64
GetTotalMemSizePages return size of system main memory plus swap, in pages. Panic on error.
func GetTunedAdmProfile ¶
func GetTunedAdmProfile() string
GetTunedAdmProfile return the currently active tuned profile. Return empty string if it cannot be determined.
func GetTunedProfile ¶
func GetTunedProfile() string
GetTunedProfile returns the currently active tuned profile by reading the file /etc/tuned/active_profile may be unreliable in newer tuned versions, so better use 'tuned-adm active' Return empty string if it cannot be determined.
func GetVirtStatus ¶
func GetVirtStatus() string
GetVirtStatus gets the status of virtualization environment
func GetdmaLatency ¶
func GetdmaLatency() string
GetdmaLatency retrieve DMA latency configuration from the system
func InfoLog ¶
func InfoLog(txt string, stuff ...interface{})
InfoLog sents text only to the infoLogger
func InitOut ¶
InitOut initializes the various output methodes currently only json and screen are supported
func IsFlagSet ¶
IsFlagSet returns true, if the flag is available on the command line or false, if not
func IsPagecacheAvailable ¶
func IsPagecacheAvailable() bool
IsPagecacheAvailable check, if system supports pagecache limit
func IsSapconfActive ¶
IsSapconfActive checks, if sapconf is active
func IsServiceAvailable ¶
IsServiceAvailable checks, if a systemd service is available on the system
func IsSystemRunning ¶
IsSystemRunning returns true, if 'is-system-running' reports 'running' 'degraded' or 'starting'. In all other cases it returns false, which means: do not call 'start' or 'restart' to prevent 'Transaction is destructive' messages
func JInvalid ¶
func JInvalid(exitStatus int)
JInvalid is the answer of an invalid saptune call used in function action/PrintHelpAndExit
func JnotSupportedYet ¶
func JnotSupportedYet()
JnotSupportedYet is the answer of a command without json support yet used in function action/SelectAction
func ListDir ¶
ListDir list directory content and returns a slice for the directory names and a slice for the file names.
func MaxI ¶
MaxI returns the maximum among the input values. If there isn't any input value, return 0.
func MaxI64 ¶
MaxI64 returns the maximum among the input values. If there isn't any input value, return 0.
func MaxU64 ¶
MaxU64 returns the maximum among the input values. If there isn't any input value, return 0.
func MinU64 ¶
MinU64 returns the minimum among the input values. If there isn't any input value, return 0.
func NoticeLog ¶
func NoticeLog(txt string, stuff ...interface{})
NoticeLog sents text to the noticeLogger and stdout
func ParseCliArgs ¶
ParseCliArgs parses the command line to identify special flags and the 'normal' arguments returns a map of Flags (set/not set or value) and a slice containing the remaining arguments possible Flags - force, dryrun, help, version, show-non-compliant, format, colorscheme, non-compliance-check on command line - --force, --dry-run or --dryrun, --help, --version, --color-scheme, --format Some Flags (like 'format') can have a value (--format json or --format csv)
func ParseCmdline ¶
ParseCmdline parse /proc/cmdline into key(string) - value(string) pairs. return value for given boot option or 'NA', if not available
func ParseMeminfo ¶
ParseMeminfo parse /proc/meminfo into key(string) - value(int) pairs. Panic on error.
func ReadConfigFile ¶
ReadConfigFile read content of config file
func ReleaseSaptuneLock ¶
func ReleaseSaptuneLock()
ReleaseSaptuneLock removes the saptune lock file
func RemountSHM ¶
RemountSHM invoke mount command to resize /dev/shm to the specified value.
func SecureBootEnabled ¶
func SecureBootEnabled() bool
SecureBootEnabled checks, if the system is in lock-down mode
func SetForceLatency ¶
SetForceLatency set CPU latency configuration to the system
func SetGovernor ¶
SetGovernor set performance configuration regarding to cpu frequency to the system using 'cpupower' command
func SetPerfBias ¶
SetPerfBias set CPU performance configuration to the system using 'cpupower' command
func SetSysString ¶
SetSysString write a string /sys/ value.
func SetSysctlInt ¶
SetSysctlInt write an integer sysctl value.
func SetSysctlString ¶
SetSysctlString write a string sysctl value.
func SetSysctlUint64 ¶
SetSysctlUint64 write an integer sysctl value.
func SetSysctlUint64Field ¶
SetSysctlUint64Field write an integer sysctl value into the specified field pf the key.
func SetTasksMax ¶
SetTasksMax sets the limit of TasksMax for a given user id to 'limit'
func StripComment ¶
StripComment will strip everything right from the given comment character (including the comment character) and returns the resulting string comment characters can be '#' or ';' or something else or a regex like `\s#[^#]|"\s#[^#]`
func SwitchOffOut ¶
SwitchOffOut disables stdout and stderr
func SwitchOnOut ¶
SwitchOnOut restores stdout and stderr to the settings before SwitchOffOut was called
func SystemctlDisable ¶
SystemctlDisable call systemctl disable on thing.
func SystemctlDisableStop ¶
SystemctlDisableStop call systemctl disable and then systemctl stop on thing. Panic on error.
func SystemctlEnable ¶
SystemctlEnable call systemctl enable on thing.
func SystemctlEnableStart ¶
SystemctlEnableStart call systemctl enable and then systemctl start on thing.
func SystemctlIsActive ¶
SystemctlIsActive returns the output of 'systemctl is-active'
func SystemctlIsEnabled ¶
SystemctlIsEnabled return true only if systemctl suggests that the thing is enabled.
func SystemctlIsRunning ¶
SystemctlIsRunning return true only if systemctl suggests that the thing is running.
func SystemctlIsStarting ¶
func SystemctlIsStarting() bool
SystemctlIsStarting return true only if systemctl suggests that the system is starting.
func SystemctlReloadTryRestart ¶
SystemctlReloadTryRestart call systemctl reload on thing.
func SystemctlResetFailed ¶
func SystemctlResetFailed() error
SystemctlResetFailed calls systemctl reset-failed.
func SystemctlRestart ¶
SystemctlRestart call systemctl restart on thing.
func SystemctlStart ¶
SystemctlStart call systemctl start on thing.
func SystemctlStatus ¶
SystemctlStatus call systemctl status on thing.
func SystemctlStop ¶
SystemctlStop call systemctl stop on thing.
func SystemdDetectVirt ¶
SystemdDetectVirt calls systemd-detect-virt. option can be '-r' (chroot), -c (container), -v (vm) '-r' only returns 0 or 1 without any output
func TestSysString ¶
TestSysString Test writing a string /sys/ value.
func TunedAdmOff ¶
func TunedAdmOff() error
TunedAdmOff calls tuned-adm to switch off the active profile.
func TunedAdmProfile ¶
TunedAdmProfile calls tuned-adm to switch to the specified profile. newer versions of tuned seems to be reliable with this command and they changed the behaviour/handling of the file /etc/tuned/active_profile
func WarningLog ¶
func WarningLog(txt string, stuff ...interface{})
WarningLog sents text to the warningLogger and stderr
func WrapTxt ¶
WrapTxt implements something like 'fold' command A given text string will be wrapped at word borders into lines of a given width
func WriteBackupValue ¶
func WriteBackupValue(value, fileName string)
WriteBackupValue writes a value into the backup file currently used for the former start TasksMax value
func WriteTunedAdmProfile ¶
WriteTunedAdmProfile write new profile to tuned, used instead of sometimes unreliable 'tuned-adm' command
Types ¶
type BlockDev ¶
BlockDev contains all key-value pairs of current available block devices in /sys/block
func GetBlockDeviceInfo ¶
GetBlockDeviceInfo reads content of stored block device information. content stored in SaptuneSectionDir (/run/saptune/sections) as blockdev.run Return the content as BlockDev
type JAppliedSol ¶
type JAppliedSol struct { SolName string `json:"Solution ID,omitempty"` Partial *bool `json:"applied partially,omitempty"` }
JAppliedSol is for 'Solution applied' in 'saptune status' and 'saptune solution applied'
type JEntry ¶
type JEntry struct { // URI to the schema definition Schema string `json:"$schema"` // saptune timestamp of the time this JSON object was created Created string `json:"publish time"` // The entire saptune command as it was called CmdLine string `json:"argv"` // PID of the saptune process creating this object Pid int `json:"pid"` // The saptune command (classifier), which was execute // realm + command, no options, no parameter Cmd string `json:"command"` // The return code the saptune command terminated with CmdRet int `json:"exit code"` // The result (output) of the command. CmdResult JResult `json:"result"` //Contains all log messages normally printed on the screen in the // order they were created CmdMsg JMessages `json:"messages"` }
JEntry defines the global structure of our json object
type JFootNotes ¶
type JFootNotes struct { FNoteNumber int `json:"index,omitempty"` FNoteTxt string `json:"amendment,omitempty"` }
JFootNotes collects the footnotes per parameter
type JMessages ¶
type JMessages []JMsg
JMessages contains all log messages normally printed on the screen in the order they were created
type JMsg ¶
type JMsg struct { // Priority of the log messages as defined AT // https://confluence.suse.com/display/SAP/Logging+Guide" // "CRITICAL", "ERROR" ,"WARNING" ,"NOTICE" ,"INFO", "DEBUG" Prio string `json:"priority"` // The log message itself Txt string `json:"message"` }
JMsg is a single log message and it's severity/priority
type JNoteList ¶
type JNoteList struct { NotesList []JNoteListEntry `json:"Notes available"` NotesOrder []string `json:"Notes enabled"` Msg string `json:"remember message"` }
JNoteList is the whole 'saptune note list'
type JNoteListEntry ¶
type JNoteListEntry struct { NoteID string `json:"Note ID"` NoteDesc string `json:"Note description"` NoteRef JObj `json:"Note reference"` NoteVers string `json:"Note version"` NoteRdate string `json:"Note release date"` ManEnabled bool `json:"Note enabled manually"` SolEnabled bool `json:"Note enabled by Solution"` ManReverted bool `json:"Note reverted manually"` NoteOverride bool `json:"Note override exists"` CustomNote bool `json:"custom Note"` }
JNoteListEntry is one line of 'saptune note list'
func JNoteListEntryInit ¶
func JNoteListEntryInit() JNoteListEntry
JNoteListEntryInit initialises a JNoteListEntry variable used in NoteActionList
type JObj ¶
type JObj interface{}
JObj is a string, a string pointer or a bool for some parts in the result of the command.
type JPNotes ¶
type JPNotes struct { Verifications []JPNotesLine `json:"verifications"` Simulations []JPNotesLine `json:"simulations,omitempty"` Attentions []JPNotesRemind `json:"attentions"` NotesOrder []string `json:"Notes enabled"` SysCompliance *bool `json:"system compliance"` }
JPNotes is the whole 'PrintNoteFields' function if we need to differ between 'verify' and 'simulate' this can be done in PrintNoteFields' or in jcollect.
type JPNotesLine ¶
type JPNotesLine struct { NoteID string `json:"Note ID,omitempty"` NoteVers string `json:"Note version,omitempty"` Parameter string `json:"parameter"` Compliant *bool `json:"compliant,omitempty"` ExpValue string `json:"expected value,omitempty"` OverValue string `json:"override value,omitempty"` ActValue *string `json:"actual value,omitempty"` Comment string `json:"comment,omitempty"` Footnotes []JFootNotes `json:"amendments,omitempty"` }
JPNotesLine one row of 'saptune note verify|simulate' from PrintNoteFields
type JPNotesRemind ¶
type JPNotesRemind struct { NoteID string `json:"Note ID,omitempty"` NoteReminder string `json:"attention,omitempty"` }
JPNotesRemind is the reminder section
type JSolList ¶
type JSolList struct { SolsList []JSolListEntry `json:"Solutions available"` Msg string `json:"remember message"` }
JSolList is the whole 'saptune solution list'
type JSolListEntry ¶
type JSolListEntry struct { SolName string `json:"Solution ID"` NotesList []string `json:"Note list"` SolEnabled bool `json:"Solution enabled"` SolOverride bool `json:"Solution override exists"` CustomSol bool `json:"custom Solution"` DepSol bool `json:"Solution deprecated"` }
JSolListEntry is one line of 'saptune solution list'
type JStatus ¶
type JStatus struct { Services JStatusServs `json:"services"` SystemdSysState string `json:"systemd system state"` TuningState string `json:"tuning state"` VirtEnv string `json:"virtualization"` SaptuneVersion string `json:"configured version"` RPMVersion string `json:"package version"` ConfiguredSol []string `json:"Solution enabled"` ConfSolNotes []JSol `json:"Notes enabled by Solution"` AppliedSol []JAppliedSol `json:"Solution applied"` AppliedSolNotes []JSol `json:"Notes applied by Solution"` ConfiguredNotes []string `json:"Notes enabled additionally"` EnabledNotes []string `json:"Notes enabled"` AppliedNotes []string `json:"Notes applied"` Staging JStatusStaging `json:"staging"` Msg string `json:"remember message"` }
JStatus is the whole 'saptune status'
type JStatusServs ¶
type JStatusServs struct { SaptuneService JObj `json:"saptune"` SapconfService JObj `json:"sapconf"` TunedService JObj `json:"tuned"` TunedProfile *string `json:"tuned profile,omitempty"` }
JStatusServs are the mentioned systemd services in 'saptune status'
type JStatusStaging ¶
type JStatusStaging struct { StagingEnabled bool `json:"staging enabled"` StagedNotes []string `json:"Notes staged"` StagedSols []string `json:"Solutions staged"` }
JStatusStaging contains the staging infos for 'saptune status'
type MountPoint ¶
type MountPoint struct { Device string MountPoint string Type string Options []string Dump int Fsck int }
MountPoint Represent a mount point entry in /proc/mounts or /etc/fstab
func (MountPoint) Equals ¶
func (mount1 MountPoint) Equals(mount2 MountPoint) bool
Equals return true only if two mount points are identical in all attributes.
func (MountPoint) GetFileSystemSizeMB ¶
func (mount MountPoint) GetFileSystemSizeMB() uint64
GetFileSystemSizeMB return the total size of the file system in MegaBytes. Panic on error.
type MountPoints ¶
type MountPoints []MountPoint
MountPoints contains a list of mount points.
func ParseFstab ¶
func ParseFstab() MountPoints
ParseFstab return all mount points defined in /etc/fstab. Returns empty list of mount points
func ParseMounts ¶
func ParseMounts(txt string) (mounts MountPoints)
ParseMounts return all mount points defined in the input text. Skipping malformed entry.
func ParseMtab ¶
func ParseMtab(file string) MountPoints
ParseMtab return all mount points defined in a given file. Returns empty list of mount points on error
func ParseMtabMounts ¶
func ParseMtabMounts() MountPoints
ParseMtabMounts return all mount points appearing in /etc/mtab. Returns empty list of mount points
func ParseProcMounts ¶
func ParseProcMounts() MountPoints
ParseProcMounts return all mount points appearing in /proc/mounts. Returns empty list of mount points
func (MountPoints) GetByMountOption ¶
func (mounts MountPoints) GetByMountOption(fstype, mountOption, chkDflt string) ([]string, []string)
GetByMountOption find a mount point with special mount option. returns a list of mount points containing the option and a second list with mount points missing the option.
func (MountPoints) GetByMountPoint ¶
func (mounts MountPoints) GetByMountPoint(mountPoint string) (MountPoint, bool)
GetByMountPoint find a mount point by its path.
type SecLimits ¶
type SecLimits struct {
Entries []*SecLimitsEntry
}
SecLimits Entries of security/limits.conf file. It is able to convert back to original text in the original entry order.
func ParseSecLimits ¶
ParseSecLimits read limits.conf text and parse the text into memory structures.
func ParseSecLimitsFile ¶
ParseSecLimitsFile read limits.conf and parse the file content into memory structures.
func (*SecLimits) Apply ¶
Apply overwrite /etc/security/limits.conf with the content of this structure.
func (*SecLimits) ApplyDropIn ¶
ApplyDropIn overwrite file 'dropInFile' with the content of this structure.
func (*SecLimits) GetOr0 ¶
func (limits *SecLimits) GetOr0(domain, typeName, item string) SecurityLimitInt
GetOr0 retrieves an integer limit value and return. If the value is not specified or cannot be parsed correctly, 0 will be returned.
type SecLimitsEntry ¶
type SecLimitsEntry struct { LeadingComments []string // The comment lines leading to the key-value pair, including prefix '#', excluding end-of-line. Domain, Type, Item string Value string }
SecLimitsEntry is a single entry in security/limits.conf file.
type SecurityLimitInt ¶
type SecurityLimitInt int
SecurityLimitInt is an integer number where -1 represents unlimited value.
func ToSecurityLimitInt ¶
func ToSecurityLimitInt(in string) SecurityLimitInt
ToSecurityLimitInt interprets integer limit number from input string. If the input cannot be parsed successfully, it will return a default 0 value.
func (SecurityLimitInt) String ¶
func (limit SecurityLimitInt) String() string