api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EPPulse is the endpoint for heartbeats from clients.
	EPPulse = "/pulse"
	// EPCanaries is the endpoint for canaries.
	EPCanaries = "/canaries"
	// EPCanary is the endpoint for a single canary.
	EPCanary = "/canary"
	// EPScouts is the endpoint for listing active checks.
	EPScouts = "/scouts"
	// EPScout is for watcher management.
	EPScout = "/scout"
	// EPKeys lists all keys.
	EPKeys = "/keys"
	// EPKey is for authentication management.
	EPKey = "/key"
	// EPHealth is the preferred health check endpoint for an active check.
	EPHealth = "/health"
)

Endpoints

View Source
const (
	// StatusWaiting means we're in the process of starting monitoring.
	StatusWaiting uint8 = iota
	// StatusOK if last check was fine.
	StatusOK
	// StatusWarning if it missed one check after retries.
	StatusWarning
	// StatusCritical if it missed more than one check after retries.
	StatusCritical
)

Status of a monitored host.

View Source
const Endpoints = `` /* 996-byte string literal not displayed */

Endpoints list

Variables

This section is empty.

Functions

func StatusString

func StatusString(status uint8) string

StatusString returns a string representation of the status.

Types

type CanaryList

type CanaryList struct {
	Canaries []CanaryListEntry `json:"canaries"`
}

CanaryList structure.

type CanaryListEntry

type CanaryListEntry struct {
	Hostname        string    `json:"hostname"`
	Assignee        string    `json:"assignee"`
	Key             string    `json:"key"`
	LastCheck       time.Time `json:"lastcheck"`
	Failed          time.Time `json:"failed"`
	Interval        int       `json:"interval"`
	Status          uint8     `json:"status"`
	Acknowledgement bool      `json:"acknowledgement"`
}

CanaryListEntry is a condensed version of the Scout struct.

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse is a JSON-encoded error response.

type Key

type Key struct {
	// ID is the name of the key user.
	ID string `json:"id"`
	// Key is the secret key.
	Key string `json:"key"`
	// Admin is true if this key can modify and view records.
	Admin bool `json:"admin"`
	// Expiry is the time at which the key expires.
	Expiry time.Time `json:"expiry"`
}

Key structure.

type KeyList

type KeyList struct {
	Keys []Key `json:"keys"`
}

KeyList structure.

type Message

type Message struct {
	// EventID for keeping track.
	EventID int64
	// OldStatus is the previous status.
	OldStatus uint8
	// NewStatus is the new status. May be the same as old if it's just an update.
	NewStatus uint8
	// Name of the monitored host.
	Name string
	// Text to go in the message.
	Text string
}

Message is sent when status changes from or to OK.

type Request

type Request map[string]string

Request header variables.

type ScoutList

type ScoutList struct {
	Scouts []ScoutListEntry `json:"scouts"`
}

ScoutList structure.

type ScoutListEntry

type ScoutListEntry struct {
	Hostname        string    `json:"hostname"`
	Assignee        string    `json:"assignee"`
	LastCheck       time.Time `json:"lastcheck"`
	Failed          time.Time `json:"failed"`
	Interval        int       `json:"interval"`
	Port            int16     `json:"port"`
	Status          uint8     `json:"status"`
	Acknowledgement bool      `json:"acknowledgement"`
}

ScoutListEntry is a condensed version of the Scout struct.

Jump to

Keyboard shortcuts

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