blob: 88b76bdc3c40e9b6e21850cce323dc8a0b1c95d9 [file] [log] [blame]
Jamie Hannafordd44daa82014-11-04 12:30:01 +01001package monitors
2
3// Type represents the type of Monitor.
4type Type string
5
6// Useful constants.
7const (
8 CONNECT Type = "CONNECT"
9 HTTP Type = "HTTP"
10 HTTPS Type = "HTTPS"
11)
12
13// ConnectMonitor represents a CONNECT monitor which performs a basic connection
14// to each node on its defined port to ensure that the service is listening
15// properly. The connect monitor is the most basic type of health check and
16// does no post-processing or protocol specific health checks.
17type ConnectMonitor struct {
18 // Number of permissible monitor failures before removing a node from
19 // rotation. Must be a number between 1 and 10.
20 AttemptLimit int `mapstructure:"attemptsBeforeDeactivation"`
21
22 // The minimum number of seconds to wait before executing the health monitor.
23 // Must be a number between 1 and 3600.
24 Delay int
25
26 // Maximum number of seconds to wait for a connection to be established
27 // before timing out. Must be a number between 1 and 300.
28 Timeout int
29
30 // Type of the health monitor. Must be specified as "CONNECT" to monitor
31 // connections.
32 Type Type
33}
34
35// HTTPMonitor represents a HTTP monitor type, which is generally considered a
36// more intelligent and powerful type than CONNECT. It is capable of processing
37// a HTTP or HTTPS response to determine the condition of a node. It supports
38// the same basic properties as CONNECT and includes additional attributes that
39// are used to evaluate the HTTP response.
40type HTTPMonitor struct {
41 // Number of permissible monitor failures before removing a node from
42 // rotation. Must be a number between 1 and 10.
43 AttemptLimit int `mapstructure:"attemptsBeforeDeactivation"`
44
45 // The minimum number of seconds to wait before executing the health monitor.
46 // Must be a number between 1 and 3600.
47 Delay int
48
49 // Maximum number of seconds to wait for a connection to be established
50 // before timing out. Must be a number between 1 and 300.
51 Timeout int
52
53 // Type of the health monitor. Must be specified as "CONNECT" to monitor
54 // connections.
55 Type Type
56
57 // A regular expression that will be used to evaluate the contents of the
58 // body of the response.
59 BodyRegex string
60
61 // The name of a host for which the health monitors will check.
62 HostHeader string
63
64 // The HTTP path that will be used in the sample request.
65 Path string
66
67 // A regular expression that will be used to evaluate the HTTP status code
68 // returned in the response.
69 StatusRegex string
70}
71
72// HTTPSMonitor the HTTPS equivalent of HTTPMonitor
73type HTTPSMonitor HTTPMonitor