request

package
v0.0.0-...-f2f35e6 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: BSD-2-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForTimeout

func CheckForTimeout(ctx context.Context, request Request) (context.Context, context.CancelFunc)

func GetCommunicator

func GetCommunicator(ctx context.Context, baseRequest BaseRequest) (communicator.Communicator, error)

GetCommunicator returns a NetworkDeviceCommunicator for the given device.

Types

type BaseRequest

type BaseRequest struct {
	// Date of the Device
	DeviceData DeviceData `json:"device_data" xml:"device_data"`

	// Timeout for the request (0 => no timeout)
	Timeout *int `json:"timeout" xml:"timeout"`
}

BaseRequest is a generic request that is processed by thola

func (*BaseRequest) GetDeviceData

func (r *BaseRequest) GetDeviceData() *DeviceData

GetDeviceData returns the device data of the request

func (*BaseRequest) HandlePreProcessError

func (r *BaseRequest) HandlePreProcessError(err error) (Response, error)

type BaseResponse

type BaseResponse struct {
}

BaseResponse

BaseResponse defines attributes every response has.

swagger:model

func (*BaseResponse) GetExitCode

func (b *BaseResponse) GetExitCode() int

GetExitCode returns the exit code of the response.

type CheckCPULoadRequest

type CheckCPULoadRequest struct {
	CheckDeviceRequest
	CPULoadThresholds monitoringplugin.Thresholds `json:"cpuLoadThresholds" xml:"cpuLoadThresholds"`
}

CheckCPULoadRequest

CheckCPULoadRequest is the request struct for the check cpu load request.

swagger:model

type CheckDeviceRequest

type CheckDeviceRequest struct {
	BaseRequest
	CheckRequest
}

CheckDeviceRequest

CheckDeviceRequest is the request struct for the check device request.

swagger:model

func (*CheckDeviceRequest) HandlePreProcessError

func (r *CheckDeviceRequest) HandlePreProcessError(err error) (Response, error)

type CheckDiskRequest

type CheckDiskRequest struct {
	CheckDeviceRequest
	DiskThresholds monitoringplugin.Thresholds `json:"diskThresholds" xml:"diskThresholds"`
}

CheckDiskRequest

CheckDiskRequest is the request struct for the check disk request.

swagger:model

type CheckHardwareHealthRequest

type CheckHardwareHealthRequest struct {
	CheckDeviceRequest
}

CheckHardwareHealthRequest

CheckHardwareHealthRequest is the request struct for the check hardware health request.

swagger:model

type CheckHighAvailabilityRequest

type CheckHighAvailabilityRequest struct {
	CheckDeviceRequest
	Role            *string                     `yaml:"role" json:"role" xml:"role"`
	NodesThresholds monitoringplugin.Thresholds `yaml:"nodes_thresholds" json:"nodes_thresholds" xml:"nodes_thresholds"`
}

CheckHighAvailabilityRequest

CheckHighAvailabilityRequest is the request struct for the check high-availability request.

swagger:model

type CheckIdentifyRequest

type CheckIdentifyRequest struct {
	CheckDeviceRequest
	Expectations device.Device `yaml:"expectations" json:"expectations" xml:"expectations"`

	OsDiffWarning           bool `yaml:"os_diff_warning" json:"os_diff_warning" xml:"os_diff_warning"`
	VendorDiffWarning       bool `yaml:"vendor_diff_warning" json:"vendor_diff_warning" xml:"vendor_diff_warning"`
	ModelDiffWarning        bool `yaml:"model_diff_warning" json:"model_diff_warning" xml:"model_diff_warning"`
	ModelSeriesDiffWarning  bool `yaml:"model_series_diff_warning" json:"model_series_diff_warning" xml:"model_series_diff_warning"`
	OsVersionDiffWarning    bool `yaml:"os_version_diff_warning" json:"os_version_diff_warning" xml:"os_version_diff_warning"`
	SerialNumberDiffWarning bool `yaml:"serial_number_diff_warning" json:"serial_number_diff_warning" xml:"serial_number_diff_warning"`
}

CheckIdentifyRequest

CheckIdentifyRequest is the request struct for the check identify request.

swagger:model

type CheckIdentifyResponse

type CheckIdentifyResponse struct {
	CheckResponse
	IdentifyResult     *device.Device                       `yaml:"identify_result" json:"identify_result" xml:"identify_result"`
	FailedExpectations map[string]IdentifyExpectationResult `yaml:"failed_expectations" json:"failed_expectations" xml:"failed_expectations"`
}

CheckIdentifyResponse

CheckIdentifyResponse is a response struct for the check identify request.

swagger:model

type CheckInterfaceMetricsRequest

type CheckInterfaceMetricsRequest struct {
	PrintInterfaces bool `yaml:"print_interfaces" json:"print_interfaces" xml:"print_interfaces"`
	InterfaceOptions
	CheckDeviceRequest
}

CheckInterfaceMetricsRequest

CheckInterfaceRequest is the request struct for the check interface metrics request.

swagger:model

type CheckMemoryUsageRequest

type CheckMemoryUsageRequest struct {
	CheckDeviceRequest
	MemoryUsageThresholds monitoringplugin.Thresholds `json:"memoryUsageThresholds" xml:"memoryUsageThresholds"`
}

CheckMemoryUsageRequest

CheckMemoryUsageRequest is the request struct for the check memory usage request.

swagger:model

type CheckRequest

type CheckRequest struct {
	PrintPerformanceData bool `yaml:"print_performance_data" json:"print_performance_data" xml:"print_performance_data"`
	JSONMetrics          bool `yaml:"json_metrics" json:"json_metrics" xml:"json_metrics"`
	// contains filtered or unexported fields
}

CheckRequest

CheckRequest is a generic response struct for the check request.

swagger:model

func (*CheckRequest) HandlePreProcessError

func (r *CheckRequest) HandlePreProcessError(err error) (Response, error)

type CheckResponse

type CheckResponse struct {
	monitoringplugin.ResponseInfo
}

CheckResponse

CheckResponse is a generic response struct for the check plugin format.

swagger:model

func (*CheckResponse) GetExitCode

func (c *CheckResponse) GetExitCode() int

GetExitCode returns the exit code of the response.

func (*CheckResponse) ToCheckPluginOutput

func (c *CheckResponse) ToCheckPluginOutput() ([]byte, error)

ToCheckPluginOutput returns the response in checkplugin format.

type CheckSBCRequest

type CheckSBCRequest struct {
	CheckDeviceRequest
	SystemHealthScoreThresholds monitoringplugin.Thresholds
}

CheckSBCRequest

CheckSBCRequest is the request struct for the check sbc request.

swagger:model

type CheckSNMPRequest

type CheckSNMPRequest struct {
	CheckDeviceRequest
}

CheckSNMPRequest

CheckSNMPRequest is the request struct for the check snmp request.

swagger:model

type CheckSNMPResponse

type CheckSNMPResponse struct {
	CheckResponse
	SuccessfulSnmpCredentials *network.SNMPCredentials `yaml:"successful_snmp_credentials" json:"successful_snmp_credentials" xml:"successful_snmp_credentials"`
}

CheckSNMPResponse

CheckSNMPResponse is a response struct for the check snmp request.

swagger:model

type CheckServerRequest

type CheckServerRequest struct {
	CheckDeviceRequest
	UsersThreshold monitoringplugin.Thresholds `json:"usersThreshold" xml:"usersThreshold"`
	ProcsThreshold monitoringplugin.Thresholds `json:"procsThreshold" xml:"procsThreshold"`
}

CheckServerRequest

CheckServerRequest is the request struct for the check server request.

swagger:model

type CheckTholaServerRequest

type CheckTholaServerRequest struct {
	CheckRequest
	Timeout *int `json:"timeout" xml:"timeout"`
}

CheckTholaServerRequest

CheckTholaServerRequest is the request struct for the check thola server request.

swagger:model

func (*CheckTholaServerRequest) GetDeviceData

func (r *CheckTholaServerRequest) GetDeviceData() *DeviceData

GetDeviceData returns the device data of the request.

type CheckUPSRequest

type CheckUPSRequest struct {
	CheckDeviceRequest
	BatteryCurrentThresholds     monitoringplugin.Thresholds `json:"batteryCurrentThresholds" xml:"batteryCurrentThresholds"`
	BatteryTemperatureThresholds monitoringplugin.Thresholds `json:"batteryTemperatureThresholds" xml:"batteryTemperatureThresholds"`
	CurrentLoadThresholds        monitoringplugin.Thresholds `json:"currentLoadThresholds" xml:"currentLoadThresholds"`
	RectifierCurrentThresholds   monitoringplugin.Thresholds `json:"rectifierCurrentThresholds" xml:"rectifierCurrentThresholds"`
	SystemVoltageThresholds      monitoringplugin.Thresholds `json:"systemVoltageThresholds" xml:"systemVoltageThresholds"`
}

CheckUPSRequest

CheckUPSRequest is the request struct for the check ups request.

swagger:model

type DeviceData

type DeviceData struct {
	// The IP of the device
	//
	// example: 203.0.113.195
	IPAddress string `json:"ip_address" xml:"ip_address"`
	// Data of the connection to the device
	ConnectionData network.ConnectionData `json:"connection_data" xml:"connection_data"`
}

DeviceData

DeviceData includes all data that can be used to contact a device

swagger:model

type IdentifyExpectationResult

type IdentifyExpectationResult struct {
	Expected string `yaml:"expected" json:"expected" xml:"expected"`
	Got      string `yaml:"got" json:"got" xml:"got"`
}

IdentifyExpectationResult is a response struct for the check identify request.

type IdentifyRequest

type IdentifyRequest struct {
	BaseRequest
}

IdentifyRequest

IdentifyRequest is the request struct for the identify request.

swagger:model

type IdentifyResponse

type IdentifyResponse struct {
	device.Device `yaml:",inline"`
	BaseResponse  `yaml:",inline"`
}

IdentifyResponse

IdentifyResponse is the response struct that is for identify requests.

swagger:model

type InterfaceOptions

type InterfaceOptions struct {
	// If you only want specific values of the interfaces you can specify them here.
	Values       []string `yaml:"values" json:"values" xml:"values"`
	IfDescrRegex string   `yaml:"ifDescr_regex" json:"ifDescr_regex" xml:"ifDescr_regex"`

	IfDescrRegexReplace   string   `yaml:"ifDescr_regex_replace" json:"ifDescr_regex_replace" xml:"ifDescr_regex_replace"`
	IfTypeFilter          []string `yaml:"ifType_filter" json:"ifType_filter" xml:"ifType_filter"`
	IfNameFilter          []string `yaml:"ifName_filter" json:"ifName_filter" xml:"ifName_filter"`
	IfDescrFilter         []string `yaml:"ifDescr_filter" json:"ifDescr_filter" xml:"ifDescr_filter"`
	IfDescrIncludeFilter  []string `yaml:"ifDescr_include_filter" json:"ifDescr_include_filter" xml:"ifDescr_include_filter"`
	SNMPGetsInsteadOfWalk bool     `yaml:"snmp_gets_instead_of_walk" json:"snmp_gets_instead_of_walk" xml:"snmp_gets_instead_of_walk"`
	// contains filtered or unexported fields
}

InterfaceOptions

InterfaceOptions is the request struct for the options of an interface request.

swagger:model

type ReadAvailableComponentsRequest

type ReadAvailableComponentsRequest struct {
	ReadRequest
}

ReadAvailableComponentsRequest

ReadAvailableComponentsRequest is the request struct for the read available-components request.

swagger:model

type ReadAvailableComponentsResponse

type ReadAvailableComponentsResponse struct {
	AvailableComponents []string `yaml:"availableComponents" json:"availableComponents" xml:"availableComponents"`
	ReadResponse
}

ReadAvailableComponentsResponse

ReadAvailableComponentsResponse is the response struct for the read available-components response.

swagger:model

type ReadCPULoadRequest

type ReadCPULoadRequest struct {
	ReadRequest
}

ReadCPULoadRequest

ReadCPULoadRequest is the request struct for the read cpu request.

swagger:model

type ReadCPULoadResponse

type ReadCPULoadResponse struct {
	CPUs []device.CPU `yaml:"cpus" json:"cpus" xml:"cpus"`
	ReadResponse
}

ReadCPULoadResponse

ReadCPULoadResponse is the response struct for the read cpu response.

swagger:model

type ReadCountInterfacesRequest

type ReadCountInterfacesRequest struct {
	ReadRequest
}

ReadCountInterfacesRequest

ReadCountInterfacesRequest is the request struct for the read count-interfaces request.

swagger:model

type ReadCountInterfacesResponse

type ReadCountInterfacesResponse struct {
	Count int `yaml:"count" json:"count" xml:"count"`
	ReadResponse
}

ReadCountInterfacesResponse

ReadCountInterfacesResponse is the response struct for the read count-interfaces response.

swagger:model

type ReadDiskRequest

type ReadDiskRequest struct {
	ReadRequest
}

ReadDiskRequest

ReadDiskRequest is the request struct for the read disk request.

swagger:model

type ReadDiskResponse

type ReadDiskResponse struct {
	Disk device.DiskComponent `yaml:"disk" json:"disk" xml:"disk"`
	ReadResponse
}

ReadDiskResponse

ReadDiskResponse is the response struct for the read disk response.

swagger:model

type ReadHardwareHealthRequest

type ReadHardwareHealthRequest struct {
	ReadRequest
}

ReadHardwareHealthRequest

ReadHardwareHealthRequest is the request struct for the read hardware health request.

swagger:model

type ReadHardwareHealthResponse

type ReadHardwareHealthResponse struct {
	HardwareHealth device.HardwareHealthComponent `yaml:"hardware_health" json:"hardware_health" xml:"hardware_health"`
	ReadResponse
}

ReadHardwareHealthResponse

ReadHardwareHealthResponse is the response struct for the read hardware health request.

swagger:model

type ReadHighAvailabilityRequest

type ReadHighAvailabilityRequest struct {
	ReadRequest
}

ReadHighAvailabilityRequest

ReadHighAvailabilityRequest is the request struct for the read high availability request.

swagger:model

type ReadHighAvailabilityResponse

type ReadHighAvailabilityResponse struct {
	HighAvailability device.HighAvailabilityComponent `yaml:"high_availability" json:"high_availability" xml:"high_availability"`
	ReadResponse
}

ReadHighAvailabilityResponse

ReadHighAvailabilityResponse is the response struct for the read high availability request.

swagger:model

type ReadInterfacesRequest

type ReadInterfacesRequest struct {
	InterfaceOptions
	ReadRequest
}

ReadInterfacesRequest

ReadInterfacesRequest is the request struct for the read interfaces request.

swagger:model

type ReadInterfacesResponse

type ReadInterfacesResponse struct {
	Interfaces []device.Interface `yaml:"interfaces" json:"interfaces" xml:"interfaces"`
	ReadResponse
}

ReadInterfacesResponse

ReadInterfacesResponse is the request struct for the read interfaces response.

swagger:model

type ReadMemoryUsageRequest

type ReadMemoryUsageRequest struct {
	ReadRequest
}

ReadMemoryUsageRequest

ReadMemoryUsageRequest is the request struct for the read memory usage request.

swagger:model

type ReadMemoryUsageResponse

type ReadMemoryUsageResponse struct {
	MemoryPools []device.MemoryPool `yaml:"memory_pools" json:"memory_pools" xml:"memory_pools"`
	ReadResponse
}

ReadMemoryUsageResponse

ReadMemoryUsageResponse is the response struct for the read memory usage request.

swagger:model

type ReadRequest

type ReadRequest struct {
	BaseRequest
}

ReadRequest

ReadRequest is the response struct that is for read requests.

swagger:model

type ReadResponse

type ReadResponse struct {
	BaseResponse
}

ReadResponse

ReadResponse is the response struct that is for read requests.

swagger:model

type ReadSBCRequest

type ReadSBCRequest struct {
	ReadRequest
}

ReadSBCRequest

ReadSBCRequest is the request struct for the read sbc request.

swagger:model

type ReadSBCResponse

type ReadSBCResponse struct {
	SBC device.SBCComponent `yaml:"sbc" json:"sbc" xml:"sbc"`
	ReadResponse
}

ReadSBCResponse

ReadSBCResponse is the response struct for the read sbc response.

swagger:model

type ReadServerRequest

type ReadServerRequest struct {
	ReadRequest
}

ReadServerRequest

ReadServerRequest is the request struct for the read server request.

swagger:model

type ReadServerResponse

type ReadServerResponse struct {
	Server device.ServerComponent `yaml:"server" json:"server" xml:"server"`
	ReadResponse
}

ReadServerResponse

ReadServerResponse is the response struct for the read server response.

swagger:model

type ReadUPSRequest

type ReadUPSRequest struct {
	ReadRequest
}

ReadUPSRequest

ReadUPSRequest is the request struct for the read ups request.

swagger:model

type ReadUPSResponse

type ReadUPSResponse struct {
	UPS device.UPSComponent `yaml:"ups" json:"ups" xml:"ups"`
	ReadResponse
}

ReadUPSResponse

ReadUPSResponse is the response struct for the read ups response.

swagger:model

type Request

type Request interface {
	// HandlePreProcessError implements request specific error handling (e.g. sets state to UNKNOWN and exit code to 3 in case
	// that the request is a check request).
	// Always call HandlePreProcessError if you want to correctly exit with an error before you call the process function
	// on a request.
	HandlePreProcessError(error) (Response, error)
	// contains filtered or unexported methods
}

Request is the interface which all requests must implement.

type Response

type Response interface {
	GetExitCode() int
}

Response is a generic interface that is returned by any Request.

func ProcessRequest

func ProcessRequest(ctx context.Context, request Request) (Response, error)

ProcessRequest is called by every request Thola receives

Jump to

Keyboard shortcuts

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