modgearman

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelInfo   = 0
	LogLevelDebug  = 1
	LogLevelTrace  = 2
	LogLevelTrace2 = 3
)

define the available log level

View Source
const (
	// DefaultConnectionTimeout sets the default connection timeout for tcp connections
	DefaultConnectionTimeout = 30

	// UtilizationWatermarkLow sets the lower mark when deciding if worker should be reduced
	UtilizationWatermarkLow = 90
)
View Source
const (
	// VERSION contains the actual lmd version
	VERSION = "1.5.2"

	// ExitCodeError is used for erroneous exits
	ExitCodeError = 2

	// ExitCodeUnknown is used for unknown exits
	ExitCodeUnknown = 3

	// ConnectionRetryInterval sets the number seconds in between connection retries
	ConnectionRetryInterval = 3

	// OpenFilesBase sets the approximate number of open files excluded open files from worker
	OpenFilesBase = 50

	// OpenFilesPerWorker sets the expected number of file handles per worker
	// (1 gearman connection, 2 fifo pipes for stderr/stdout, one on /dev/null, one sparse)
	OpenFilesPerWorker = 5

	// OpenFilesExtraPercent adds 30% safety level when calculating required open files
	OpenFilesExtraPercent = 1.2

	// ResultServerWorker sets the number of result worker
	ResultServerWorker = 10

	// ResultServerQueueSize sets the queue size for results
	ResultServerQueueSize = 1000

	// BlockProfileRateInterval sets the profiling interval when started with -profile
	BlockProfileRateInterval = 10
)
View Source
const EncryptionBlockSize = 16
View Source
const (
	// EncryptionKeySize defines the exact size of the encryption key
	EncryptionKeySize = 32
)
View Source
const NegateDefaultTimeout = 11

NegateDefaultTimeout sets the default timeout if negate is used

View Source
const ServiceAnswerSize = 4

Variables

View Source
var LogFormat string

LogFormat sets the log format

Functions

func BenchmarkParseCommandI

func BenchmarkParseCommandI(b *testing.B)

func BenchmarkParseCommandII

func BenchmarkParseCommandII(b *testing.B)

func BenchmarkReadAndExecuteExec

func BenchmarkReadAndExecuteExec(b *testing.B)

func BenchmarkReadAndExecuteShell

func BenchmarkReadAndExecuteShell(b *testing.B)

func CheckGearman

func CheckGearman(build string)

func GearmanTop

func GearmanTop(build string)

func ParseNegate

func ParseNegate(com *command)

func Sendgearman

func Sendgearman(build string)

Sendgearman starts the mod_gearman_worker program

func TestExecuteCommandArgListTooLongError

func TestExecuteCommandArgListTooLongError(t *testing.T)

func TestExecuteCommandFunnyQuotes

func TestExecuteCommandFunnyQuotes(t *testing.T)

func TestExecuteCommandOutOfFilesError

func TestExecuteCommandOutOfFilesError(t *testing.T)

func TestExecuteCommandWithTimeout

func TestExecuteCommandWithTimeout(t *testing.T)

func TestGetCommandBasename

func TestGetCommandBasename(t *testing.T)

func TestReadAndExecute

func TestReadAndExecute(t *testing.T)

func Worker

func Worker(build string)

Worker starts the mod_gearman_worker program

Types

type CommandExecType

type CommandExecType int

CommandExecType is used to set the execution path

const (
	// Shell uses /bin/sh
	Shell CommandExecType = iota

	// Exec uses exec without a shell
	Exec

	// EPN is the embedded perl interpreter
	EPN

	// Internal is for internal checks
	Internal
)

type EPNCacheItem

type EPNCacheItem struct {
	Mtime int64
	EPN   bool
}

type EPNDaemon

type EPNDaemon struct {
	Lock   sync.RWMutex
	Cmd    *exec.Cmd
	Socket string
	Pid    int
}

func (*EPNDaemon) Stop

func (d *EPNDaemon) Stop(gracefulSeconds int64)

type InternalCheck

type InternalCheck interface {
	Check(ctx context.Context, output *bytes.Buffer, args []string) int
}

type InternalCheckDummy

type InternalCheckDummy struct{}

func (*InternalCheckDummy) Check

func (chk *InternalCheckDummy) Check(_ context.Context, output *bytes.Buffer, args []string) (rc int)

type InternalCheckNSCWeb

type InternalCheckNSCWeb struct{}

func (*InternalCheckNSCWeb) Check

func (chk *InternalCheckNSCWeb) Check(ctx context.Context, output *bytes.Buffer, args []string) int

type MainStateType

type MainStateType int

MainStateType is used to set different states of the main loop

const (
	// Reload flag if used after a sighup
	Reload MainStateType = iota

	// Shutdown is used when sigint received
	Shutdown

	// ShutdownGraceFully is used when sigterm received
	ShutdownGraceFully

	// Resume is used when signal does not change main state
	Resume
)

type Negate

type Negate struct {
	Timeout        int
	TimeoutResult  string
	OKStatus       string
	WarningStatus  string
	CriticalStatus string
	UnknownStatus  string
	Substitute     bool
}

func NewNegate

func NewNegate() *Negate

func (*Negate) Apply

func (n *Negate) Apply(result *answer)

func (*Negate) ApplyNewCode

func (n *Negate) ApplyNewCode(result *answer, from, target string)

func (*Negate) ConvertStatusNumber

func (n *Negate) ConvertStatusNumber(arg string) string

func (*Negate) DefineFlags

func (n *Negate) DefineFlags(flags *flag.FlagSet)

func (*Negate) Parse

func (n *Negate) Parse(args []string) error

func (*Negate) SetTimeoutReturnCode

func (n *Negate) SetTimeoutReturnCode(result *answer)

func (*Negate) Status2Int

func (n *Negate) Status2Int(status string) int

Jump to

Keyboard shortcuts

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