impl

package
v0.0.0-...-33d3dc2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_CONFIG_FILE_CONTENT = `` /* 320-byte string literal not displayed */
View Source
const TPL_INDEX = `` /* 1487-byte string literal not displayed */
View Source
const TPL_STYLE_CSS = `` /* 1799-byte string literal not displayed */
View Source
const TypeHttp = "http"
View Source
const TypeHttps = "https"
View Source
const TypeTcp = "tcp"
View Source
const TypeTls = "tls"

Variables

View Source
var (
	ErrUnreachable    = &ProbeError{message: "unreachble host"}
	ErrUnknown        = &ProbeError{message: "unknown"}
	ErrNotImplemented = &ProbeError{message: "not implemented"}
)

Functions

func ParseSmtpAuth

func ParseSmtpAuth(cfg ConfigSmtp) smtp.Auth

func RunWeb

func RunWeb(config ConfigWeb, instance *PingoInstance) error

func TargetTimeserie

func TargetTimeserie(length int, ticker timeserie.Ticker) *timeserie.Timeserie

Types

type Alerts

type Alerts struct {
	Emails   []string
	Webhooks map[string]Webhook
}

type ByName

type ByName []IndexDataTarget

ByAge implements sort.Interface for []Person based on the Age field.

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

type Config

type Config struct {
	Web     ConfigWeb
	Smtp    ConfigSmtp
	Targets map[string]ConfigTarget
	Alerts  Alerts
}

func LoadOrInitFile

func LoadOrInitFile(path string) (*Config, error)

type ConfigSmtp

type ConfigSmtp struct {
	Username string
	Password string
	Host     string
}

type ConfigTarget

type ConfigTarget struct {
	Type            string
	Hostname        string
	Port            int
	PollingInterval string

	HttpUrl            string
	HttpExpectedStatus int
}

type ConfigWeb

type ConfigWeb struct {
	Port int
}

type HttpProbe

type HttpProbe struct {
	URL            string
	ExpectedStatus int
}

func (*HttpProbe) Test

func (probe *HttpProbe) Test() *ProbeError

type IndexData

type IndexData struct {
	Now     string
	Targets []IndexDataTarget
}

type IndexDataTarget

type IndexDataTarget struct {
	Name       string
	Type       string
	LastCheck  string
	LastChange string
	Status     string
	Class      string
	Reason     string
	Timeseries map[string][]timeserie.Entry
}

type Instance

type Instance struct {
	SmtpAuth smtp.Auth
}

type PingoInstance

type PingoInstance struct {
	Targets map[string]*TargetEntry
}

func NewPingoInstance

func NewPingoInstance(config Config) (*PingoInstance, error)

func (*PingoInstance) LogState

func (this *PingoInstance) LogState()

func (*PingoInstance) Run

func (this *PingoInstance) Run() error

func (*PingoInstance) State

func (this *PingoInstance) State() map[string]TargetState

type Probe

type Probe interface {
	Test() *ProbeError
}

func MakeProbe

func MakeProbe(target ConfigTarget) (res Probe, err error)

type ProbeError

type ProbeError struct {
	// contains filtered or unexported fields
}

func (*ProbeError) Error

func (err *ProbeError) Error() string

type TargetEntry

type TargetEntry struct {
	Probe           Probe
	State           TargetState
	PollingInterval time.Duration
}

type TargetState

type TargetState struct {
	Config     ConfigTarget
	LastCheck  time.Time
	LastChange time.Time
	Status     TargetStatus
	Reason     string
	Timeseries map[string]*timeserie.Timeserie
}

type TargetStatus

type TargetStatus int
const (
	TargetStatusUnknown TargetStatus = 0
	TargetStatusOk      TargetStatus = 1
	TargetStatusError   TargetStatus = 2
)

type Webhook

type Webhook struct {
	Method       string
	UrlTemplate  string
	BodyTemplate string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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