service

package
v0.3.7-alpha6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchExecutableService = errors.New("no such scored service found")
View Source
var ErrRoundDelayLargerThanRoundUnits = errors.New("round delay should not be larger than round units")

Functions

This section is empty.

Types

type Service

type Service struct {
	ID uuid.UUID `json:"id,omitempty" gorm:"type:uuid;primary_key;"`

	// Name of the check_service that will be checked against known services
	Name string `json:"name" gorm:"not null;default:null"`

	// DisplayName is used by the front end to groups services together by a column
	DisplayName string `json:"display_name,omitempty"`

	// Weight is number of points granted for a successful check
	Weight *uint64 `json:"weight" gorm:"not null;default:0"`

	// PointsBoost is a static number of points added to the total points of a service
	PointsBoost *uint64 `json:"points_boost" gorm:"not null;default:0"`

	// RoundUnits is the frequency of a check_service check. If round_units is 5 and round_delay is 0, then check_service checks will happen on every 5th round. (5,10, etc)
	RoundUnits uint64 `json:"round_units,omitempty" gorm:"not null;default:1"`

	// RoundDelay is the initial delay in frequency of a check_service check. If round_units is 7 and round_delay is 3, then check_service checks will happen on every 7th round with an offset of 3. (10,17, etc)
	RoundDelay *uint64 `json:"round_delay,omitempty" gorm:"not null;default:0"`

	// ID of a check_service group the check_service belongs to
	ServiceGroupID uuid.UUID `json:"service_group_id" gorm:"type:uuid;not null"`

	// ID of a host the check_service belongs to
	HostID uuid.UUID `json:"host_id" gorm:"type:uuid;not null"`

	// Hide is to hide service on scoreboard
	Hide *bool `json:"pause,omitempty" gorm:"not null;default:false"`

	// Pause is to pause scoring of the service
	Pause *bool `json:"hide,omitempty" gorm:"not null;default:false"`

	// Properties is all child properties of a given service
	Properties []*property.Property `json:"properties,omitempty" gorm:"foreignkey:ServiceID; constraint:OnUpdate:RESTRICT,OnDelete:CASCADE"`

	// Checks is all child checks for a given service
	Checks []*check.Check `json:"checks,omitempty" gorm:"foreignkey:ServiceID; constraint:OnUpdate:RESTRICT,OnDelete:CASCADE"`
}

Service Model represents a check_service that is being scored for a given host

func (*Service) BeforeCreate

func (s *Service) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate ensures UUID is set.

func (*Service) BeforeSave

func (s *Service) BeforeSave(tx *gorm.DB) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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