Documentation
¶
Overview ¶
Package monitor is what a person adds and edits to watch a service: a monitor of one type (HTTP, TCP, ping, DNS, push, a database, a message broker or a mail server, gRPC health, a Docker container, registry, git, RDAP, or a group of other monitors), how often it is checked and from which probe locations, when it counts as down, and which notification channels hear of it.
Monitors live in Beacon's configuration (package configdb), with its versions, history and revert. They compile to what the probes read, target groups and modules (compile.go), so that the probe protocol stays as it was; and Beacon judges them itself from the results the probes push (eval.go): down after the monitor's retries, from enough locations to agree, back up on the first success.
Index ¶
- Constants
- Variables
- func ModuleName(id string) string
- func Slug(name string) string
- func ValidColor(s string) bool
- func ValidID(s string) bool
- func ValidTagName(s string) bool
- type BasicAuth
- type Beat
- type Compiled
- type DNS
- type DayShare
- type Deps
- type Evaluator
- func (e *Evaluator) ClearStats(id string) bool
- func (e *Evaluator) Events(id string, limit int) []Event
- func (e *Evaluator) Flush()
- func (e *Evaluator) Heartbeats(id, location string, limit int) []Beat
- func (e *Evaluator) Locations(m Monitor) []LocationState
- func (e *Evaluator) Observe(results []Result)
- func (e *Evaluator) RecentEvents(from time.Time, limit int) []MonitorEvent
- func (e *Evaluator) Reload()
- func (e *Evaluator) Run(ctx context.Context, tick time.Duration)
- func (e *Evaluator) Stats(m Monitor) Stats
- func (e *Evaluator) Summaries(ms []Monitor, beats int) map[string]Summary
- func (e *Evaluator) Summary(m Monitor, beats int) Summary
- func (e *Evaluator) Tick()
- type Event
- type GRPC
- type Git
- type HTTP
- type JSONQuery
- type Known
- type Legacy
- type Line
- type LocationState
- type Login
- type MongoDB
- type Monitor
- func (m *Monitor) Check(k Known) error
- func (m *Monitor) CheckedFrom(loc string, locs map[string]string) bool
- func (m Monitor) Clone() Monitor
- func (m *Monitor) Group() targets.Group
- func (m *Monitor) HasTag(name string) bool
- func (m *Monitor) Module() (*probe.Module, error)
- func (m *Monitor) Normalize()
- func (m *Monitor) Probed() bool
- func (m *Monitor) Probes() bool
- func (m *Monitor) Refused() error
- func (m *Monitor) ResultLabels() map[string]string
- func (m *Monitor) RetryEvery() int
- type MonitorEvent
- type Ping
- type Point
- type RDAP
- type Registry
- type Result
- type SMTP
- type SQL
- type StateStore
- type Stats
- type Summary
- type TCP
- type Tag
- type TagDef
Constants ¶
const ( AlertDown = "ServiceDown" AlertDegraded = "ServiceDegraded" AlertMainland = "MainlandPathDegraded" AlertCert = "CertificateExpiring" AlertDomain = "DomainExpiring" )
The alerts a monitor raises, by name.
const ( TypeHTTP = "http" // an HTTP(S) request: status codes, keyword, JSON query TypeTCP = "tcp" // a TCP port answers (optionally over TLS) TypePing = "ping" // an ICMP echo is answered TypeDNS = "dns" // a name resolves (to what is expected) TypePush = "push" // a job reports in at least every interval TypePostgres = "postgres" // a PostgreSQL server answers (and runs a query) TypeMySQL = "mysql" // a MySQL or MariaDB server answers (and runs a query) TypeMongoDB = "mongodb" // a MongoDB server answers hello TypeRedis = "redis" // a Redis server answers PING TypeMQTT = "mqtt" // an MQTT broker accepts a connection TypeSMTP = "smtp" // a mail server greets and answers EHLO (and STARTTLS) TypeGRPC = "grpc" // a gRPC server's standard health service says SERVING TypeDocker = "docker" // a container on the probe location's own host runs (and is healthy) TypeRegistry = "registry" // a container registry serves a manifest TypeGit = "git" // a Git repository answers over HTTP TypeRDAP = "rdap" // a domain's registration, and its expiry TypeGroup = "group" // a group of monitors: down when one of them is )
The types of monitor.
const ( DefaultInterval = 60 MinInterval = 20 MaxInterval = 24 * 60 * 60 MaxPushInterval = 31 * 24 * 60 * 60 // a job may report monthly DefaultTimeout = 20 MaxTimeout = 120 MaxRetries = 10 MaxResend = 1000 MaxCertDays = 365 )
Limits and defaults.
const ( StatusUp = "up" // checks pass StatusDown = "down" // enough locations failed past the retries StatusPending = "pending" // a check failed; retrying before it counts StatusDegraded = "degraded" // some locations fail, too few to agree it is down StatusMaintenance = "maintenance" // a maintenance window covers it StatusPaused = "paused" // nobody checks it StatusUnknown = "unknown" // no result yet StatusStale = "stale" // a location's results stopped coming )
The states of a monitor, and of one location's checks of it.
const SetSuffix = "-monitors"
SetSuffix ends the names of the target sets monitors compile to.
Variables ¶
var Regions = targets.Regions
Regions are the probe location regions a monitor may be scoped to.
var ServiceTypes = []string{TypePostgres, TypeMySQL, TypeMongoDB, TypeRedis, TypeMQTT, TypeSMTP}
ServiceTypes are the types that speak a service's own protocol to a host, on its usual port unless the target names another.
var Severities = []string{"critical", "warning", "info"}
Severities are the alert levels a monitor may have.
var Statuses = []string{StatusDown, StatusDegraded, StatusPending, StatusMaintenance, StatusUp, StatusPaused, StatusUnknown}
Statuses lists the monitor states, the worst first.
var Types = []string{TypeHTTP, TypeTCP, TypePing, TypeDNS, TypePush, TypePostgres, TypeMySQL, TypeMongoDB, TypeRedis, TypeMQTT, TypeSMTP, TypeGRPC, TypeDocker, TypeRegistry, TypeGit, TypeRDAP, TypeGroup}
Types lists the types of monitor, in the order the console offers them.
Functions ¶
func ModuleName ¶
ModuleName is the name of a monitor's module, the module label of its results.
func ValidTagName ¶
ValidTagName reports whether s may be a tag's name: 1 to 40 printable characters.
Types ¶
type BasicAuth ¶
type BasicAuth struct {
Username string `json:"username" yaml:"username"`
PasswordFile string `json:"password_file,omitempty" yaml:"password_file,omitempty"`
}
BasicAuth is HTTP basic authentication with a password file in the probes' secrets directory.
type Beat ¶
type Beat struct {
At time.Time `json:"at"`
Status string `json:"status"`
OK bool `json:"ok"`
Location string `json:"location,omitempty"`
LatencyMS *float64 `json:"latency_ms,omitempty"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"` // what a push said
}
Beat is one check as the console's heartbeat bar shows it: when, from where, whether it passed (after upside-down), how long it took, why it failed, and the monitor's state after it.
type Compiled ¶
Compiled is what the probes read of the monitors: target groups in sets named as target files have always been (all-, a region or a location id, then "-monitors"), and a module for each monitor.
type DNS ¶
type DNS struct {
RecordType string `json:"record_type,omitempty" yaml:"record_type,omitempty"`
Resolver string `json:"resolver,omitempty" yaml:"resolver,omitempty"`
Expected []string `json:"expected,omitempty" yaml:"expected,omitempty"`
}
DNS resolves the target for RecordType with Resolver (or each probe's own) and, with Expected, wants one answer to be one of them.
type Deps ¶
type Deps struct {
Monitors func() []Monitor
Locations func() map[string]string
Maintenance func(id string, at time.Time) bool
Post func(sender string, alerts []router.Postable) error
Store StateStore
Now func() time.Time
Log *slog.Logger
// Runbooks is where an alert's runbook lives: the alert's name and .md are added.
Runbooks string
}
Deps are what the evaluator needs. Locations are the probe locations expected to report now, by id, with their region; Maintenance says whether a person's maintenance window covers a monitor at a time; Post takes the monitors' alerts (the router's Ingest as the rule engine). Store, Maintenance, Post, Now and Log may be nil.
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator holds every monitor's state.
func (*Evaluator) ClearStats ¶
ClearStats forgets what Beacon counted of a monitor: its latest checks, its hourly and daily uptime and response times, and its changes of state, and stores that at once. Its state now, each location's latest result and its alerts stay, so that clearing pages nobody and resolves nothing. It reports whether there was anything to clear.
func (*Evaluator) Events ¶
Events are the monitor's changes of state, the newest first, at most limit.
func (*Evaluator) Heartbeats ¶
Heartbeats are the monitor's latest checks, the newest first, at most limit; with location, only that location's.
func (*Evaluator) Locations ¶
func (e *Evaluator) Locations(m Monitor) []LocationState
Locations are the monitor's locations' latest results, by location id.
func (*Evaluator) RecentEvents ¶
func (e *Evaluator) RecentEvents(from time.Time, limit int) []MonitorEvent
RecentEvents are the changes of every monitor since from, the newest first, at most limit, each with its monitor's id.
func (*Evaluator) Reload ¶
func (e *Evaluator) Reload()
Reload reads the states from the store, as a new leader does.
func (*Evaluator) Run ¶
Run evaluates every tick, posts the alerts and stores what changed, until ctx ends. The leading instance runs it.
func (*Evaluator) Stats ¶
Stats are the monitor's uptime over a day, 30 days and a year, its latency, and the expiry dates its checks saw. They are Beacon's own counts of its judged checks: hourly for two days, daily for 400 days.
type Event ¶
type Event struct {
At time.Time `json:"at"`
Status string `json:"status"`
Previous string `json:"previous,omitempty"`
Reason string `json:"reason,omitempty"`
Locations []string `json:"locations,omitempty"`
DurationSeconds float64 `json:"duration_seconds,omitempty"`
}
Event is a change of a monitor's state: what it became, from what, why, from which locations, and how long the state it left had lasted.
type GRPC ¶
type GRPC struct {
Service string `json:"service,omitempty" yaml:"service,omitempty"`
Plaintext bool `json:"plaintext,omitempty" yaml:"plaintext,omitempty"`
IgnoreTLS bool `json:"ignore_tls,omitempty" yaml:"ignore_tls,omitempty"`
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}
GRPC asks the standard health service (grpc.health.v1.Health/Check) of the server at the target about Service, the server as a whole when empty, over TLS unless Plaintext (HTTP/2 in clear text, h2c), sending Metadata as request headers.
type Git ¶
type Git struct {
Username string `json:"username,omitempty" yaml:"username,omitempty"`
PasswordFile string `json:"password_file,omitempty" yaml:"password_file,omitempty"`
}
Git asks the repository at the target for its refs.
type HTTP ¶
type HTTP struct {
Method string `json:"method,omitempty" yaml:"method,omitempty"`
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
Body string `json:"body,omitempty" yaml:"body,omitempty"`
Accepted []string `json:"accepted_status,omitempty" yaml:"accepted_status,omitempty"`
Keyword string `json:"keyword,omitempty" yaml:"keyword,omitempty"`
KeywordAbsent bool `json:"keyword_absent,omitempty" yaml:"keyword_absent,omitempty"`
KeywordRegex bool `json:"keyword_regex,omitempty" yaml:"keyword_regex,omitempty"`
JSONQuery *JSONQuery `json:"json_query,omitempty" yaml:"json_query,omitempty"`
BasicAuth *BasicAuth `json:"basic_auth,omitempty" yaml:"basic_auth,omitempty"`
BearerTokenFile string `json:"bearer_token_file,omitempty" yaml:"bearer_token_file,omitempty"`
// MaxRedirects is how many redirects are followed: nil for 10, 0 for none.
MaxRedirects *int `json:"max_redirects,omitempty" yaml:"max_redirects,omitempty"`
IgnoreTLS bool `json:"ignore_tls,omitempty" yaml:"ignore_tls,omitempty"`
// RequireTLS fails a plain-HTTP answer (after redirects).
RequireTLS bool `json:"require_tls,omitempty" yaml:"require_tls,omitempty"`
}
HTTP is how an HTTP monitor asks and what it accepts. Accepted are status codes and ranges such as 200-299 (the default); Keyword must be in the body (with KeywordAbsent, must not be; with KeywordRegex it is a regular expression); JSONQuery checks one value of a JSON body. Secrets (BasicAuth's password, the bearer token) are files in the probes' secrets directory, by name.
type JSONQuery ¶
type JSONQuery struct {
Path string `json:"path" yaml:"path"`
Operator string `json:"operator,omitempty" yaml:"operator,omitempty"`
Value string `json:"value" yaml:"value"`
}
JSONQuery is a path into a JSON body, a comparison and a value: data.status == ok.
type Known ¶
Known is what a monitor's references are checked against: the probe locations (id to region) and the other monitors (id to type).
type Legacy ¶
type Legacy struct {
Sets map[string][]targets.Group
Modules *probe.Modules
Heartbeats []catalog.Heartbeat
Locations []string // the probe locations' ids, to read the sets' names
}
Legacy is what Beacon watched before monitors: target sets by name (the name says which locations probe them), the module file they name, and the heartbeats of jobs.
type Line ¶
type Line struct {
Expect string `json:"expect,omitempty" yaml:"expect,omitempty"`
Send string `json:"send,omitempty" yaml:"send,omitempty"`
}
Line is a line a TCP monitor sends, or waits for.
type LocationState ¶
type LocationState struct {
Location string `json:"location"`
Status string `json:"status"` // up, down, pending (failing within the retries), stale
At *time.Time `json:"at,omitempty"`
LatencyMS *float64 `json:"latency_ms,omitempty"`
Reason string `json:"reason,omitempty"`
HTTPStatus int `json:"http_status,omitempty"`
Failures int `json:"failures,omitempty"`
CertExpiry *time.Time `json:"cert_expires_at,omitempty"`
}
LocationState is one location's latest result of a monitor.
type Login ¶
type Login struct {
TLS bool `json:"tls,omitempty" yaml:"tls,omitempty"`
IgnoreTLS bool `json:"ignore_tls,omitempty" yaml:"ignore_tls,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
PasswordFile string `json:"password_file,omitempty" yaml:"password_file,omitempty"`
}
Login is how a Redis or MQTT monitor connects: over TLS when asked, as Username (a Redis ACL user) with the password in PasswordFile.
type MongoDB ¶
type MongoDB struct {
TLS bool `json:"tls,omitempty" yaml:"tls,omitempty"`
IgnoreTLS bool `json:"ignore_tls,omitempty" yaml:"ignore_tls,omitempty"`
RequirePrimary bool `json:"require_primary,omitempty" yaml:"require_primary,omitempty"`
}
MongoDB asks the server hello; with RequirePrimary it must be the writable primary.
type Monitor ¶
type Monitor struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
Target string `json:"target,omitempty" yaml:"target,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Parent is a group monitor this one belongs to.
Parent string `json:"parent,omitempty" yaml:"parent,omitempty"`
// Interval is how often the monitor is checked, in seconds (for a push monitor, how often its job
// must report); Timeout how long one check may take; Retries how many failed checks in a row are
// retried before the monitor is down, RetryInterval how soon after a failure (0: the interval);
// ResendInterval, when set, reminds the channels every so many checks while it is down.
Interval int `json:"interval" yaml:"interval"`
Timeout int `json:"timeout,omitempty" yaml:"timeout,omitempty"`
Retries int `json:"retries" yaml:"retries"`
RetryInterval int `json:"retry_interval,omitempty" yaml:"retry_interval,omitempty"`
ResendInterval int `json:"resend_interval,omitempty" yaml:"resend_interval,omitempty"`
// Locations are the probe locations (by id) and Regions the regions that check it; neither: every
// location.
Locations []string `json:"locations,omitempty" yaml:"locations,omitempty"`
Regions []string `json:"regions,omitempty" yaml:"regions,omitempty"`
Tags []Tag `json:"tags,omitempty" yaml:"tags,omitempty"`
Channels []string `json:"channels,omitempty" yaml:"channels,omitempty"`
Paused bool `json:"paused,omitempty" yaml:"paused,omitempty"`
UpsideDown bool `json:"upside_down,omitempty" yaml:"upside_down,omitempty"`
// CertExpiryDays warns this many days before the certificate (or, for RDAP, the domain) expires;
// 0 does not warn.
CertExpiryDays int `json:"cert_expiry_days,omitempty" yaml:"cert_expiry_days,omitempty"`
// Severity is the level of its alerts; FailureDomain names what fails together with it; Labels
// are further labels on its results and alerts (page, visibility and the like).
Severity string `json:"severity" yaml:"severity"`
FailureDomain string `json:"failure_domain,omitempty" yaml:"failure_domain,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
// Machine is the enrolled machine people should open when it is down; for a push monitor, the
// machine its job runs on, whose probe or host agent may then report for it.
Machine *targets.MachineBinding `json:"machine,omitempty" yaml:"machine,omitempty"`
// IPVersion is ip4 or ip6 alone; "" prefers IPv4 and falls back to IPv6.
IPVersion string `json:"ip_version,omitempty" yaml:"ip_version,omitempty"`
HTTP *HTTP `json:"http,omitempty" yaml:"http,omitempty"`
TCP *TCP `json:"tcp,omitempty" yaml:"tcp,omitempty"`
Ping *Ping `json:"ping,omitempty" yaml:"ping,omitempty"`
DNS *DNS `json:"dns,omitempty" yaml:"dns,omitempty"`
Registry *Registry `json:"registry,omitempty" yaml:"registry,omitempty"`
Git *Git `json:"git,omitempty" yaml:"git,omitempty"`
RDAP *RDAP `json:"rdap,omitempty" yaml:"rdap,omitempty"`
Postgres *SQL `json:"postgres,omitempty" yaml:"postgres,omitempty"`
MySQL *SQL `json:"mysql,omitempty" yaml:"mysql,omitempty"`
MongoDB *MongoDB `json:"mongodb,omitempty" yaml:"mongodb,omitempty"`
Redis *Login `json:"redis,omitempty" yaml:"redis,omitempty"`
MQTT *Login `json:"mqtt,omitempty" yaml:"mqtt,omitempty"`
SMTP *SMTP `json:"smtp,omitempty" yaml:"smtp,omitempty"`
GRPC *GRPC `json:"grpc,omitempty" yaml:"grpc,omitempty"`
}
Monitor is one thing Beacon watches. ID is its key and the service label of everything about it (probe results, alerts, status pages); Name is what people read.
func FromLegacy ¶
func FromLegacy(l Legacy, taken map[string]bool) (ms []Monitor, renamed map[string][]string, notes []string)
FromLegacy turns a legacy configuration into monitors: every target of every group is an HTTP, TCP, registry, Git or RDAP monitor as its module says, checked from the locations its set's name gives, and every heartbeat a push monitor. A service with one target keeps its name as the monitor's id, so that status pages, silences and alert history still find it; one with several targets gets a monitor for each, and Renamed lists their ids under the service's name. Notes say what could not be carried over exactly. The result is the same for the same input, so that converting again changes nothing.
func (*Monitor) Check ¶
Check checks a normalised monitor. The error says what to put right, in words for whoever sent it.
func (*Monitor) CheckedFrom ¶
CheckedFrom reports whether the location (id to region in locs) checks the monitor and is expected to report.
func (*Monitor) Module ¶
Module is the probe module that checks the monitor, checked as a module file's are.
func (*Monitor) Normalize ¶
func (m *Monitor) Normalize()
Normalize fills in the defaults and tidies what people type; Check then checks what is left.
func (*Monitor) Probed ¶
Probed reports whether probes check the monitor (not a push or group monitor, and not paused).
func (*Monitor) Probes ¶
Probes reports whether the monitor's type is checked by probes at all, paused or not.
func (*Monitor) Refused ¶
Refused says what a monitor asks for that its type cannot do, before Normalize drops it: a group's state is its monitors', so it has no upside-down mode of its own; set it on the monitors in it. Changes are refused with it; the configuration already stored and files imported are only normalised, so that a group saved with it before still loads.
func (*Monitor) ResultLabels ¶
ResultLabels are the labels on a monitor's results and alerts: its module, service and monitor (both its id), severity, failure domain and its own labels.
func (*Monitor) RetryEvery ¶
RetryEvery is the interval after a failed check.
type MonitorEvent ¶
MonitorEvent is an event with its monitor.
type Ping ¶
type Ping struct {
Packets int `json:"packets,omitempty" yaml:"packets,omitempty"`
}
Ping sends Packets echo requests (default 1).
type RDAP ¶
type RDAP struct {
Server string `json:"server,omitempty" yaml:"server,omitempty"`
}
RDAP looks the domain up at Server (default https://rdap.org).
type Registry ¶
type Registry struct {
Repository string `json:"repository" yaml:"repository"`
Reference string `json:"reference,omitempty" yaml:"reference,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
PasswordFile string `json:"password_file,omitempty" yaml:"password_file,omitempty"`
}
Registry pulls Repository:Reference's manifest from the registry at the target.
type Result ¶
type Result struct {
Monitor string
Location string
At time.Time
OK bool // as checked, before upside-down
Reason string
Latency time.Duration
HTTPStatus int
CertExpiry time.Time
DomainExpiry time.Time
Message string
}
Result is one check of a monitor: from a probe location, or a push (Location empty).
type SMTP ¶
type SMTP struct {
TLS bool `json:"tls,omitempty" yaml:"tls,omitempty"`
StartTLS bool `json:"starttls,omitempty" yaml:"starttls,omitempty"`
IgnoreTLS bool `json:"ignore_tls,omitempty" yaml:"ignore_tls,omitempty"`
}
SMTP greets a mail server and says EHLO; StartTLS upgrades the connection, TLS speaks TLS from the start (port 465).
type SQL ¶
type SQL struct {
TLS bool `json:"tls,omitempty" yaml:"tls,omitempty"`
IgnoreTLS bool `json:"ignore_tls,omitempty" yaml:"ignore_tls,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Database string `json:"database,omitempty" yaml:"database,omitempty"`
PasswordFile string `json:"password_file,omitempty" yaml:"password_file,omitempty"`
Query string `json:"query,omitempty" yaml:"query,omitempty"`
Expected string `json:"expected,omitempty" yaml:"expected,omitempty"`
}
SQL is how a PostgreSQL or MySQL monitor signs in and what it asks. Without Username it reads the server's greeting only; with it, it signs in to Database with the password in PasswordFile (a file in the probes' secrets directory), runs Query (PostgreSQL: SELECT 1; MySQL: a ping, when empty) and, with Expected, wants the first value of the first row to be Expected.
type StateStore ¶
type StateStore interface {
MonitorStates() (map[string][]byte, error)
PutMonitorStates(map[string][]byte) error
}
StateStore keeps the evaluator's state; *store.Store has it.
type Stats ¶
type Stats struct {
Uptime24h *float64 `json:"uptime_24h,omitempty"`
Uptime30d *float64 `json:"uptime_30d,omitempty"`
Uptime1y *float64 `json:"uptime_1y,omitempty"`
AvgLatency24hMS *float64 `json:"avg_latency_24h_ms,omitempty"`
LatencyMS *float64 `json:"latency_ms,omitempty"`
CertExpiresAt *time.Time `json:"cert_expires_at,omitempty"`
CertDaysLeft *int `json:"cert_days_left,omitempty"`
DomainExpiresAt *time.Time `json:"domain_expires_at,omitempty"`
DomainDaysLeft *int `json:"domain_days_left,omitempty"`
Checks24h int `json:"checks_24h"`
DownChecks24h int `json:"down_checks_24h"`
LastPush *time.Time `json:"last_push,omitempty"`
UptimeSource string `json:"uptime_source"`
DailyUptime []DayShare `json:"daily_uptime,omitempty"` // the last 90 days, the oldest first
HourlyLatencyMS []Point `json:"hourly_latency_ms,omitempty"`
ExpectedLocations int `json:"expected_locations"`
ReportingLocations int `json:"reporting_locations"`
}
Stats are a monitor's figures for its page.
type Summary ¶
type Summary struct {
Status string `json:"status"`
Since *time.Time `json:"since,omitempty"`
Reason string `json:"reason,omitempty"`
Failing []string `json:"failing,omitempty"` // locations (or, for a group, monitors) failing
LastCheck *time.Time `json:"last_check,omitempty"`
LatencyMS *float64 `json:"latency_ms,omitempty"` // the last passing check's
Uptime24h *float64 `json:"uptime_24h,omitempty"` // a share, 0 to 1
CertDays *int `json:"cert_days_left,omitempty"`
DomainDays *int `json:"domain_days_left,omitempty"`
// Beats are the latest checks, the oldest first, when asked for.
Beats []Beat `json:"beats,omitempty"`
}
Summary is a monitor's state as lists show it.
type TCP ¶
type TCP struct {
TLS bool `json:"tls,omitempty" yaml:"tls,omitempty"`
IgnoreTLS bool `json:"ignore_tls,omitempty" yaml:"ignore_tls,omitempty"`
QueryResponse []Line `json:"query_response,omitempty" yaml:"query_response,omitempty"`
}
TCP connects to host:port, over TLS when asked; QueryResponse are lines to send, or to wait for (a regular expression), in turn.